Entering edit mode
4.0 years ago
adampepper313
•
0
Hi I am working on a project and am wanting to write a command that calculates the length of my gene and outputs those genes with a length shorter than my setting point written in the command line.
I am writing my code within nano and executing it using python within a command line.
This is my code:
from Bio import SeqIO
for seq_record in SeqIO.parse(sys.argv[1], "fasta"):
if str(len(seq_record)) < (sys.argv[2]):
print(seq_record.description)
However, I don’t seem to be getting the desired output.
Thanks
I think you should use
len(str(seq_record))
, since you're interested in the length of a string.