I need to construct a PWM from every sequence in a fasta file, using biopython. The way I'm trying to do this is to import each line of sequence into a motif, then run a PWM on each instance of the motif. Currently, I'm trying it this way, but different variations of it have generated their fair share of errors, mostly "Wrong Alphabet" and "NoneType object is not iterable":
alphabet = IUPAC.unambiguous_dna
m = Motif.Motif(alphabet)
for seq_record in SeqIO.parse("10fasta.fasta", "fasta"):
m.add_instance(seq_record.seq)
print m1.pwm()
Does anyone see what's wrong with the way I'm adding instances to the motif? Of course, if there's a better way to do this that I'm completely missing, feel free to comment on that too.
Thanks. m1 == m, I just haven't updated all the variable names yet from my other program that I borrowed this block of code from.