I have a set of sequences in a fasta file, i read them into biopython and then i want to make some changes to them (adding or replacing or deleting) and then i want to save them to a new fastafile.
what i'm doing in the example is a small shifting of 5 nucleotides :
> allrecords=list(SeqIO.parse("test.fasta", 'fasta')) > fullseq=0 > tochangeseq =0 > oldfullseq=0 > > for y in range(len(allrecords)): > > > oldfullseq=allrecords[y].seq > tochange=5 #might be dynamically included by another for loop > tochangeseq = allrecords[y].seq[0:tochange] > fullseq = oldfullseq[tochange:len(oldfullseq)] > fullseq += tochangeseq > allrecords[y].seq = fullseq > print allrecords.seq ### it should print the new updated sequence, but it's not
but the problem is when i print the sequences after the loop, i found that they did not changed, how can i update them and then write the new version to a fasta file.
help would be appreciated