Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

convert ambiguous letters in a DNA sequence to all possible non-ambiguous letters

by lrl1997 (Novice)
on Feb 16, 2013 at 01:09 UTC ( #1018993=perlquestion: print w/ replies, xml ) Need Help??
lrl1997 has asked for the wisdom of the Perl Monks concerning the following question:

I would like to use perl script to convert all ambiguous letters (R, Y, K, M, S etc) in a DNA sequence to all possible non-ambiguous letters.

For example,

to convert sequence "ARGBCTC" to:

AAGCCTC

AAGGCTC

AAGTCTC

AGGCCTC

AGGGCTC

AGGTCTC

However, there are so many different combinations (let's say only 2 ambiguous letter maximum in one sequence, how to do this in an efficient way??????????// Could anyone point me to the right direction?

Thank you.

Comment on convert ambiguous letters in a DNA sequence to all possible non-ambiguous letters
Re: convert ambiguous letters in a DNA sequence to all possible non-ambiguous letters
by BrowserUk (Pope) on Feb 16, 2013 at 01:29 UTC

    For strings with upto say a half a dozen or so wildcards, glob does this quite efficiently:

    $in = 'ARGBCTC';; $in =~ s[[^ACGT]][{A,C,G,T}]g;; print $in;; A{A,C,G,T}G{A,C,G,T}CTC print for glob $in;; AAGACTC AAGCCTC AAGGCTC AAGTCTC ACGACTC ACGCCTC ACGGCTC ACGTCTC AGGACTC AGGCCTC AGGGCTC AGGTCTC ATGACTC ATGCCTC ATGGCTC ATGTCTC

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Gee whiz. That's clever.

      so smart!!!! Thank you indeed!!!

Re: convert ambiguous letters in a DNA sequence to all possible non-ambiguous letters
by AnomalousMonk (Abbot) on Feb 16, 2013 at 04:28 UTC

    Also see section 4.3.2 "Genomic Sequence Generator" of Dominus's excellent Higher Order Perl available for free download here.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1018993]
Approved by muba
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2014-11-28 20:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (200 votes), past polls