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

IndexError: string index out of range #48

Closed Z-Zen closed 2 years ago

Z-Zen commented 2 years ago

Hi,

I tried to convert a VCF from hg38 to hg19 with CrossMap.py (v.0.6.3) using the following command:

CrossMap.py vcf hg38ToHg19.over.chain.gz test.vcf hg38.fa out.vcf

I got the following error:

Traceback (most recent call last):
  File "/usr/local/bin/CrossMap.py", line 319, in <module>
    crossmap_vcf_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 "/usr/local/lib/python3.9/site-packages/cmmodule/mapvcf.py", line 168, in crossmap_vcf_file
    tmp = ref_allele[0] + alt_allele[1:] #replace the 1st nucleotide of ALT
IndexError: string index out of range

You can easily reproduce this example with the following VCF line:

chr1    248783950   .   A   G   60.28   .   AC=2;AF=1.00;AN=2;DP=2;ExcessHet=3.0103;FS=0.000;MLEAC=1;MLEAF=0.500;MQ=60.00;POLYX=1;QD=30.14;SOR=2.303    GT:AD:DP:GQ:PL  1/1:0,2:2:6:72,6,0

And this is another one

chr1    248813215   rs11205412  T   C   512.77  .   AC=1;AF=0.500;AN=2;BaseQRankSum=-0.658;ClippingRankSum=0.000;DB;DP=47;ExcessHet=3.0103;FS=10.301;MLEAC=1;MLEAF=0.500;MQ=60.00;MQRankSum=0.000;QD=10.91;ReadPosRankSum=-2.249;SOR=0.099  GT:AD:DP:GQ:PL  0/1:24,23:47:99:541,0,581
liguowang commented 2 years ago

Hi, You should use "hg19.fa" rather than "hg38.fa", as you were mapping variants from hg38 to hg19, CrossMap needs hg19 reference genome to find the REF alleles.

On Wed, Apr 6, 2022 at 9:20 AM Zen @.***> wrote:

Hi,

I tried to convert a VCF from hg38 to hg19 with CrossMap.py (v.0.6.3) using the following command:

CrossMap.py vcf hg38ToHg19.over.chain.gz test.vcf hg38.fa out.vcf

I got the following error:

Traceback (most recent call last): File "/usr/local/bin/CrossMap.py", line 319, in crossmap_vcf_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 "/usr/local/lib/python3.9/site-packages/cmmodule/mapvcf.py", line 168, in crossmap_vcf_file tmp = ref_allele[0] + alt_allele[1:] #replace the 1st nucleotide of ALT IndexError: string index out of range

You can easily reproduce this example with the following VCF line:

chr1 248783950 . A G 60.28 . AC=2;AF=1.00;AN=2;DP=2;ExcessHet=3.0103;FS=0.000;MLEAC=1;MLEAF=0.500;MQ=60.00;POLYX=1;QD=30.14;SOR=2.303 GT:AD:DP:GQ:PL 1/1:0,2:2:6:72,6,0

— Reply to this email directly, view it on GitHub https://github.com/liguowang/CrossMap/issues/48, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACN443SXUYTACP2ZKUODARTVDWMQ5ANCNFSM5SWGLBHQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>