from Bio import SeqIO
sfile = open('/home/sb/bioinfo/seqwrep.fasta')
# mysel stores a SeqRecord object generated from the
# first (and only) record in the fasta file.
myseq = SeqIO.read(sfile, "fasta")
# title stores the "id" attribute of the SeqRecord object.
title = myseq.id
# seq stores the sequence converted into string and
seq = str(myseq.seq).upper()
win_size = 45
i = 0
number_l = 
# This while is used to walk over the sequence.
# Each position of number_l stores the amount of 'AAT'
# found on each window.
i += 1 # This is the same as i = i+1
# pos stores the position of the window with the highest
# amount of 'AAT'
fout = open('/home/sb/bioinfo/swforprimer3.txt','w')
=''' % (title,seq,pos,win_size,win_size,len(seq)))
# Saves the data formated as the input file needed by
This code is part of the book "Python for Bioinformatics", by Sebastian Bassi (firstname.lastname@example.org). Return to home page.