Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: A Question about strings in lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102305] Re: [mg102240] A Question about strings in lists
  • From: Thomas Dowling <thomasgdowling at gmail.com>
  • Date: Wed, 5 Aug 2009 05:42:18 -0400 (EDT)
  • References: <200908021000.GAA01671@smc.vnet.net>

Hello,


This can be most conveniently done using the Characters[ ] function.


For Example, the BSA sequence from PubMed, which has been truncated to the
first 20 amino acids

pubmed[BSApart] = "  1 mkwvtfisll llfssaysrg  //";

bsalist =
  ToUpperCase[
   StringReplace[
    StringReplace[
     pubmed[BSApart], {Characters["1234567890//"] -> " "}],
    Whitespace -> ""]];

And:

aaCharList = Characters [bsalist];
Length[aaCharList]

Out[56]= 20

PERSONALLY, I like to convert from a string and to three-letter code, but
using VaL **not Val** for Valine (and
thanks to Wolfram for changing this) as I can then use commands that I am
familiar with such as Count and Position, but you may prefer to work with
strings.


list3 = aaCharList /. {"A" -> Ala, "C" -> Cys,  "D" -> Asp,
    "E" -> Glu,  "F" -> Phe,  "G" -> Gly,  "H" -> His,
    "I" -> Ile,   "K" -> Lys, "L" -> Leu , "M" -> Met, "N" -> Asn,
    "P" -> Pro, "Q" -> Gln, "R" -> Arg, "S" -> Ser, "T" -> Thr,
    "V" -> VaL, "W" -> Trp, "Y" -> Tyr};

For Example:

Count[list3, Met]

Tom Dowling.


  ";On Sun, Aug 2, 2009 at 11:00 AM, Marwa Abd El-Wahaab <
m.a.elwahaab at gmail.com> wrote:

> Dear Sir,
>
> I have a question about lists
>
> If I recall a protein sequence for example, the output will be
>
> { ACDQXXYWT ...............  }
>
> This output contains amino acids but as one element in list & its length is
> =1
>
> How can I transform this one element to this form
>
> {A,C,D,Q,X,X,Y,W,T,......... }
>
> So, the length will be number of amino acids the protein contains
>
> I need your advice
>
> Thanks in advance
>
> *Marwa Ali Abd El Wahaab
> Teaching Assistant*
> Faculty of Engineering
> Mansoura University
>
>
>


  • Prev by Date: Creating Documentation Center material: a screencast
  • Next by Date: Documentation Center tool screencast: Edited posting....
  • Previous by thread: Re: A Question about strings in lists
  • Next by thread: Re: A Question about strings in lists