Python error for variant call
1
0
Entering edit mode
7.4 years ago
Cindy ▴ 70

Dear all,

I got a error when output VCF file.

"in VCFoutput
  i.INFO['AC'][index] += 1
  IndexError: list index out of range"                          

Here is the part where error from:
  for x in xrange(len(variant[3])):
                                if variant[3][x] in i.ALT and variant[1][x] in i.REF:
                                    index=i.REF.index(variant[1][x])
                                    **i.INFO['AC'][index] += 1**
                                    i.INFO['AN']+=1
                                    aplotype=index+1
                                    genotype=[aplotype]

Anyone knows how to fix it? Thanks ahead

Assembly • 1.2k views
ADD COMMENT
0
Entering edit mode

I added code markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:

101010 Button

ADD REPLY
0
Entering edit mode

The obvious answer is that it is telling you that the position in the list does not exist. Is this your script? Or taken from somewhere else? Without more of the code, or a brief description in pseudocode explaining what you're doing, it's hard to tell what everything is.

ADD REPLY
0
Entering edit mode
7.4 years ago

It is not possible to answer this question withouth knowing what i.REF.index and the variant object contains.

Do note that the AC field is the allele count and ensure that there is a reason that i.REF.index(variant[1][x]) returns values that are within the range of i.INFO['AC']

ADD COMMENT

Login before adding your answer.

Traffic: 1830 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6