Reputation: 1
I have a list which contains the frame, start codon position, stop codon position, sequence of the gene, and gene length . Both sequence and length are based on the start and stop. I wanted to unpack this list and add frame, start/stop positions, sequence, and gene length for genes with a certain length to another list. My code is as follows:
for framenumber, startposition, stopposition, geneseq, genelength in range(len(codonpairsfwd)):
if len(gene_seq) < 200:
GenesToRemove_Fwd.append(framenumber)
GenesToRemove_Fwd.append(startposition)
GenesToRemove_Fwd.append(stopposition)
GenesToRemove_Fwd.append(geneseq)
GenesToRemove_Fwd.append(genelength)
and I get this error message: TypeError: cannot unpack non-iterable int object for the first line(i.e. line with for loop).
Any ideas where I might be going wrong would super appreciated
Upvotes: 0
Views: 427
Reputation: 533
range() will list numbers (int) to loop, so you cannot unpack that number onto framenumber, startposition, stopposition, ... etc... as it's only an integer, starting from 0 and ends with len(codonparisfwd).
Upvotes: 1