[Biopython] shuffle sequences

João Rodrigues anaryin at gmail.com
Tue Jun 7 14:46:28 UTC 2011


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