CrossMap icon indicating copy to clipboard operation
CrossMap copied to clipboard

gvcf KeyError: '>'

Open solivehong opened this issue 7 months ago • 3 comments

hi wang i crossmap gvcf 2 hg38

CrossMap.py gvcf /disk/reference/liftover_ref/hg19ToHg38.over.chain M248.g.vcf.gz /storage/data/reference/update_gatk_v0/Homo_sapiens_assembly38.fasta  crossmap_HG38/M248.g.vcf.gz_HG38.g.vcf.gz --compress --chromid l

version = 0.6.6

2023-11-07 05:04:03 [INFO]  Updating contig field ... 
2023-11-07 05:04:03 [INFO]  Lifting over ... 
Traceback (most recent call last):
  File "/home/solivehong/miniconda3/envs/bio_base/bin/CrossMap.py", line 329, in <module>
    crossmap_gvcf_file(mapping = mapTree, infile= in_file, outfile = out_file, liftoverfile = chain_file, refgenome = genome_file, noCompAllele = args.no_comp_alleles, compress = args.compression, cstyle = args.cstyle)
  File "/home/solivehong/miniconda3/envs/bio_base/lib/python3.11/site-packages/cmmodule/mapgvcf.py", line 228, in crossmap_gvcf_file
    fields[4] = revcomp_DNA(alt_allele, True) + ',<NON_REF>'
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/solivehong/miniconda3/envs/bio_base/lib/python3.11/site-packages/cmmodule/utils.py", line 94, in revcomp_DNA
    return ''.join([complement[base] for base in reversed(seq)])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/solivehong/miniconda3/envs/bio_base/lib/python3.11/site-packages/cmmodule/utils.py", line 94, in <listcomp>
    return ''.join([complement[base] for base in reversed(seq)])
                    ~~~~~~~~~~^^^^^^
KeyError: '>'

I check mapgvcf.py and see split, unsuccessful

pip install crossmap==0.6.1 is work best solivehong

solivehong avatar Nov 07 '23 09:11 solivehong

Hi Solivehong Genotypes in the "ALT" field can only be IUPAC characters plus dot (.), dash (-) and star (*). please double-check.

Liguo

liguowang avatar Nov 07 '23 19:11 liguowang

@liguowang show me error line

chr1    14542   .       A       G,<NON_REF>

This the normal GVCF line,for mine mind

solivehong avatar Nov 08 '23 04:11 solivehong

A quick fix is replacing the <NON_REF> with "." or "-". Or you can reinstall CrossMap using: pip3 install git+https://github.com/liguowang/CrossMap.git. please let me know if the problem persists.

liguowang avatar Nov 08 '23 19:11 liguowang

Hi Liguowang,

I have the same error with "<CN2>" in the "ALT" column, Do you suggest replacing the entire thing with either "." or "-"? or should I just remove "<" and ">" but that would lead to the column being "CN2" which is also not an acceptable parameter?

Thanks!

Shrishtee-kandoi avatar Apr 25 '24 22:04 Shrishtee-kandoi

Did you use the most recent version of CrossMap? Yes, you could try to replace "<NON_REF>" with "." or "-" to see how it works. My impression is that the recent version should be able to handle "<NON_REF>" (at least for the VCF command).

liguowang avatar Apr 26 '24 15:04 liguowang

I tried installing the latest version and it worked! Thanks :D

Shrishtee-kandoi avatar Apr 26 '24 16:04 Shrishtee-kandoi