liguowang / CrossMap

CrossMap is a python program to lift over genome coordinates from one genome version to another.
https://crossmap.readthedocs.io/en/latest/
Other
64 stars 23 forks source link

gvcf KeyError: '>' #63

Open solivehong opened 7 months ago

solivehong commented 7 months ago

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

liguowang commented 7 months ago

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

Liguo

solivehong commented 7 months ago

@liguowang show me error line

chr1    14542   .       A       G,<NON_REF>

This the normal GVCF line,for mine mind

liguowang commented 7 months ago

A quick fix is replacing the 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.

Shrishtee-kandoi commented 2 months ago

Hi Liguowang,

I have the same error with "" 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!

liguowang commented 2 months ago

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

Shrishtee-kandoi commented 2 months ago

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