[Biopython] shuffle sequences

George Devaniranjan devaniranjan at gmail.com
Tue Jun 7 15:01:41 UTC 2011


Hello João,

Thanks for the answer but I am confused--"new sequence object with that"
so I still need to create a seq object?
I tried this ...
myseq=Seq('KVFGRCELAAAMKRHGL', my_protein)

I was thinking if it would be possible to have FOR loop and loop throught
the entire sequence then shuffle it and then write the shuffled list (going
though it one by one using another FOR loop) to a seq object.

Thank you,
George

On Tue, Jun 7, 2011 at 10:46 AM, João Rodrigues <anaryin at gmail.com> wrote:

> Hey George,
>
> random.shuffle works on lists or other datatypes that support item
> assignment. Therefore, neither a string nor Seq will work. I would extract
> the sequence out of Seq and build a new sequence object with that.
>
> Cheers,
>
> João [...] Rodrigues
> http://nmr.chem.uu.nl/~joao
>
>
>
> On Tue, Jun 7, 2011 at 3:39 PM, George Devaniranjan <
> devaniranjan at gmail.com> wrote:
>
>> Hello everyone,
>> I need to 'shuffle' a sequence so that I can calculate the statistical
>> alignment scores--I tried the random.shuffle opetion but it does not seem
>> to
>> work
>>
>> I defined the sequence as a string like the following
>>
>> w="KVYGRCELAAAMKRHGLDKYQGYSLGNWVCAAKFE"
>> random.shuffle(w)
>>
>>
>> also like this...
>> my_protein=IUPAC.protein
>> from Bio.Seq import Seq
>> myseq=Seq('KVFGRCELAAAMKRHGL', my_protein)
>>
>> random.shuffle(myseq)
>>
>> Both don't seem to work--where am I going wrong?
>>
>> Thanks a lot,
>> George
>> _______________________________________________
>> Biopython mailing list  -  Biopython at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/biopython
>>
>
>




More information about the Biopython mailing list