38 / d4-format

The D4 Quantitative Data Format
MIT License
156 stars 20 forks source link

change tracking #46

Closed brentp closed 2 years ago

brentp commented 2 years ago

mosdepth supports d4 output, but it's difficult to track what is needed as there is no changelog and no documentation for d4binding

It used to be that cargo build --release would create the libd4binding stuff in target/release. That is no longer the case. I think that I have fixed this by using : cd d4binding/ && cargo build --release && cd .. Is that the recommended way? using cargo build --release --all-features did not compile d4binding

Did I miss the docs on this change or on installation?

brentp commented 2 years ago

Another recent change causes this error:

Invalid dictionary range setting - At least one value should be present in the file
/home/runner/work/mosdepth/mosdepth/mosdepth.nim(878) mosdepth
/home/runner/work/mosdepth/mosdepth/mosdepth.nim(596) main
/home/runner/.nimble/pkgs/d4-0.0.2/d4pkg/d4.nim(123) set_chromosomes
/home/runner/.nimble/pkgs/d4-0.0.2/d4pkg/d4.nim(24) check
Error: unhandled exception: d4: error updating metadata [ValueError]

full log here

I don't think this is anything I can fix in the bindings, perhaps d4 doesn't like seeing those chromosomes in the header and not getting any data for them?

Here is the sam file:

@HD VN:1.5  GO:none SO:coordinate
@SQ SN:1    LN:249250621
@SQ SN:2    LN:243199373
@SQ SN:3    LN:198022430
@SQ SN:4    LN:191154276
@SQ SN:5    LN:180915260
@SQ SN:6    LN:171115067
@SQ SN:7    LN:159138663
@SQ SN:8    LN:146364022
@SQ SN:9    LN:141213431
@SQ SN:10   LN:135534747
@SQ SN:11   LN:135006516
@SQ SN:12   LN:133851895
@SQ SN:13   LN:115169878
@SQ SN:14   LN:107349540
@SQ SN:15   LN:102531392
@SQ SN:16   LN:90354753
@SQ SN:17   LN:81195210
@SQ SN:18   LN:78077248
@SQ SN:19   LN:59128983
@SQ SN:20   LN:63025520
@SQ SN:21   LN:48129895
@SQ SN:22   LN:51304566
@SQ SN:X    LN:155270560
@SQ SN:Y    LN:59373566
@SQ SN:MT   LN:16569
@SQ SN:NC_007605    LN:171823
@SQ SN:hs37d5   LN:35477943
@SQ SN:phix LN:5386
@RG ID:GT04008021_119   LB:GT04008021   PL:ILLUMINA PU:ILLUMINA_119 SM:GT04008021
D8WCT8Q1_0255:5:1116:4474:27171#CGATGTCGATGT    163 MT  1   21  32S42M  =   7   80  CACACGTTCCCCTTAAATAAGACATCACGATGGATCACAGGTCTATCACCCTATTAACCACTCACGGGAGCTCT  @=BDDDDHHHH3CFGHHIHIIIIGHIGHIECGGHGGG@FEGHIEGEIIFDBBFHF@F@GIGGEHIIHEBDCEEE  XA:Z:17,+22020695,74M,4;    MC:Z:74M    MD:Z:42 RG:Z:GT04008021_119 NM:i:0  MQ:i:60 AS:i:42 XS:i:54
D8WCT8Q1_0255:5:1116:4474:27171#CGATGTCGATGT    83  MT  7   60  74M =   1   -80 AGGTCTATCACCCTATTAACCACTCACGGGAGCTCTCCATGCATTTGGTATTTTCGTCTGGGGGGCATGCACGC  CCCDDCCB?ABDCDECEDCA?;B?EAFHIIHCF@JIIGFF=@IJIJIHGEIIJJJJIGHIGEFHHHHDFDFFCC  MC:Z:32S42M MD:Z:65T8   RG:Z:GT04008021_119 NM:i:1  MQ:i:21 AS:i:69 XS:i:39
38 commented 2 years ago

Hi Brent, I think this is caused by the recent change of the metadata

https://github.com/brentp/d4-nim/blob/master/src/d4pkg/d4_sys.nim#L34

Recently, I added an fix point feature so there's one more additional value in the metadata, so this causing misinterpretation of the metadata data structure defined in the nim binding.

See this change for details https://github.com/38/d4-format/commit/aa52c5ad542f4b2cb7b1db88eff7ea148893fb43#diff-d5877174f5c0724488ee2ff49a41e0e2b9c6e16ce572164ca2f0600631610859

Also, I am not sure how nim pulls the D4 code. But we are now moving to bioconda to make a stable release version for D4binding. https://bioconda.github.io/recipes/d4binding/README.html#package-d4binding

And I think it should be more stable if you can relies on the released version of d4binding

brentp commented 2 years ago

Hi Hao, thanks for finding the change that caused the problem. I fixed it by updating the struct as you suggested. I'll start tracking tagged versions or using the conda package; as you know, I started supporting d4 quite early in mosdepth so it wasn't practical originally to rely even on tags.

brentp commented 2 years ago

Hi Hao, another recent change has cause this:

$ cargo build --all --target x86_64-unknown-linux-musl --release                              
error: cannot produce cdylib for `pyd4 v0.1.13 (/home/brentp/src/d4-format/pyd4)` as the target `x86_64-unknown-linux-musl` does not support these crate types

I see in the repo you have something about d4tools, but I really just need libd4binding.a. (and d4.h)

thanks in advance for any help with this.

38 commented 2 years ago

Hi Brent, I think you can just build the d4binding library so you can just build with

cargo build --package=d4binding --release 

Please let me know if you have any other question.

arq5x commented 2 years ago

did this work for you, @brentp ?

brentp commented 2 years ago

Yes, this works now. Thanks!