-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathq27.py
More file actions
31 lines (20 loc) · 914 Bytes
/
q27.py
File metadata and controls
31 lines (20 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from Bio import Entrez
from Bio import SeqIO
f = open ("rosalind_frmt.txt",'r') #Parsing the input from the input file
input = f.read()
input1 = input.replace(" ",", ")
shorteststring = ''
Slength = 0
shorteststringdesc = ''
Entrez.email = "your_name@your_mail_server.com"
handle = Entrez.efetch(db="nucleotide", id=[input1], rettype="fasta") #USing Bio.Entres module retrieving the strings associated with the GenBank entry IDs.
records = list(SeqIO.parse(handle,"fasta"))
length = len(records) #to format and print the output appropriately.
slength = len(records[0].seq)
for i in range(1,length):
if len(records[i].seq) < slength:
slength = len(records[i].seq)
shorteststring = records[i].seq
shorteststringdesc = records[i].description
print ">"+shorteststringdesc
print shorteststring