I'm have several .gb files from Vector NTI that I need for convert to FASTA format. I figured it would be easy, using Biopython. However, as we all know, there's always something.
Here's the first few lines of sequence from the .gb file:
And here's the first few lines of sequenced from a Googled example:
ORIGIN 1 gatcctccat atacaacggt atctccacct caggtttaga tctcaacaac ggaaccattg 61 ccgacatgag acagttaggt atcgtcgaga gttacaagct aaaacgagca gtagtcagct 121 ctgcatctga agccgctgaa gttctactaa gggtggataa catcatccgt gcaagaccaa 181 gaaccgccaa tagacaacat atgtaacata tttaggatat acctcgaaaa taataaaccg 241 ccacactgtc attattataa ttagaaacag aacgcaaaaa ttatccacta tataattcaa
Here's the python code to convert:
from Bio import SeqIO
inp = sys.argv
out = inp + ".fasta"
input_handle = open(inp, "rU")
output_handle = open(out, "w")
sequences = SeqIO.parse(input_handle, "genbank")
count = SeqIO.write(sequences, output_handle, "fasta")
And here's the error:
Traceback (most recent call last):
File "abi2fastq.py", line 3, in <module>
from Bio import SeqIO
File "/usr/lib64/python2.6/site-packages/Bio/SeqIO/__init__.py", line 362, in <module>
from . import InsdcIO # EMBL and GenBank
File "/usr/lib64/python2.6/site-packages/Bio/SeqIO/InsdcIO.py", line 37, in <module>
from Bio.GenBank.Scanner import GenBankScanner, EmblScanner, _ImgtScanner
File "/usr/lib64/python2.6/site-packages/Bio/GenBank/__init__.py", line 52, in <module>
from .Scanner import GenBankScanner
File "/usr/lib64/python2.6/site-packages/Bio/GenBank/Scanner.py", line 38
different in layout to those produced by GenBank/DDBJ."""
IndentationError: expected an indented block
Does anyone know where the indentation error is here? My .gb file doesn't have lengths in the beginning of the sequence, and also isn't spaced in the body of the sequence. Could both be the problem? I've found other problems to be with Scanner.py source code from Biopython, but I updated to the newest release, and am now getting this error. I could just copy and paste the sequence into a new file with a header, but I have sever files in several directories to perform the conversion on, so this first one is just a test. Btw, all of the Vector NTI .gb files look the same.
All help is appreciated.