[Biopython] SeqIO.dict
Willis, Jordan R
jordan.r.willis at Vanderbilt.Edu
Fri Jun 11 02:12:45 UTC 2010
Thanks Peter,
One last question:
During my blast runs, at about midway through it will truncate my sequences... For example:
GYTFTNFA ----> Query
GY FTNFA ----> Score of: 34.0
GYIFTNFA ----> Template
Template becomes the query:
GYIFTN ----> Query
GYIFTN ----> Score of: 30.0
GYIFTN ----> Template
All sequences are the exact same size and I can't figure out which blast parameters would show all 8 amino acids every time.
Jordan
On 6/10/10 6:33 PM, "Peter" <biopython at maubp.freeserve.co.uk> wrote:
On Thu, Jun 10, 2010 at 11:47 PM, Willis, Jordan R wrote:
> Hello Community.
>
> I was wonderig if you could convert a dictionary object back into a fasta file.
>
>
> Dictionary = SeqIO.to_dict(SeqIO.parse('my.file', "fasta")
>
> Removed some objects from dictionary....
>
> SeqIO.write(Dictionary, 'my.file', "fasta")
>
>
> This is how I have removed items from my.file but I
> need to convert it back into a fasta file so it can be
> read by blast.
Doing Dictionary.values() will give a list of SeqRecord
objects, which you can give to the SeqIO.write(...)
function to save to a FASTA file. i.e.
Dictionary = SeqIO.to_dict(SeqIO.parse('my.file', "fasta")
#edit dictionary... then:
SeqIO.write(Dictionary.values(), "new.fas", "fasta")
If you care about the order then it is a little more
complicated.
Peter
More information about the Biopython
mailing list