Entering edit mode
23 months ago
CHemsley001 • 0
very silly question from an absolute newbie, but I am trying to run a python script I found online and am running into some issues with defining the genbank file that is required as the input for the script.
This is the beginning of the script:
#!/usr/bin/env python import sys import Bio from Bio import SeqIO, SeqFeature from Bio.SeqRecord import SeqRecord import os def get_interregions(genbank_path, intergene_length=1): seq_record = SeqIO.parse(open(genbank_path), "genbank").next()
I have tried replacing the both instances of genbank_path with the name of the gb file (both with and without quotation marks) or the path to the current folder, but I am either getting a syntax error or a message saying
"AttributeError: 'GenBankIterator' object has no attribute 'next'
Any suggestion would be much appreciated.
nextis build in function of
python, not class function of
GenBankIterator. If you want to use it, you can do it like this:
If you are sure, that the files you are working with will always contain one sequence, you can use the
Hope this helps.
Btw.: don't forget to close the handle to the opened
genbank_pathfile (you can run into problems with file handle limits). If you don't want to bother with opening and closing files here, the SeqIO will happily accept just path to a file. You can do just