Hi guys I have managed to write up the code below in python that accesses a file with protein ids and import their sequences from genbank. I now wanted to write one that would import all the protein sequences in a given chromosome since I don't have all their ids. i.e number. to import the entire protein sequences given the chromosome number.
Any suggestions would be appreciated!
from numpy import * z=genfromtxt('C:\Users\Mohammed\Desktop\ProteinIDs.txt', dtype='S12', delimiter=',', usecols=,unpack=True) exit
for i in range (500):
prot= '"%s"' %((z)[i])
from Bio import Entrez , SeqIO
Entrez.email = 'firstname.lastname@example.org'
handle = Entrez.efetch(db="protein", id="prot", rettype="fasta",retmode="text")
record = SeqIO.read(handle,"fasta")
f= open('C:\Users\Mohammed\Desktop\protein_seqs\%s.txt' % (z)[i], 'w') for i in range (1): SeqIO.write(record, f, "fasta") print record f.close()