Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Removing nucleotide frm sequence

by space_monk (Chaplain)
on Jun 06, 2013 at 14:42 UTC ( #1037468=note: print w/ replies, xml ) Need Help??


in reply to Removing nucleotide frm sequence

You probably want something more refined than this, but something similar to:

while (<>) { # $ denotes end of string s/AAAAA$//; s/>CC\@B$//; print; }
Not quite sure if your sequence is on one line or multiple lines, so the above will need some tweaking. If you need some more help, please amend your question, putting a complete sequence in code blocks
If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)


Comment on Re: Removing nucleotide frm sequence
Download Code
Re^2: Removing nucleotide frm sequence
by bingalee (Acolyte) on Jun 06, 2013 at 14:47 UTC
    Hey, thanks for that..but the quality and the last five nucleotides aren't the same in every sequence. It can also be like AAACT in another sequence..:(

      Please can you put a complete sequence or two in the comment, with a short explanation of what needs removing. Many of us aren't chemists (I only got a low grade at Chem A level 30 years ago :-)

      If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)
Re^2: Removing nucleotide frm sequence
by space_monk (Chaplain) on Jun 07, 2013 at 07:42 UTC
    local $/ = ""; while (<>) { # should have a whole record # split up 4 line record my (@line) = split( "\n"); # change if necessary to check we have a valid record if ($line[0] =~ /^@/) { $line[1] =~ s/([ACGT]{5})$//; $line[3] =~ s/(\w{5})$//; print join("\n", @line); } }
    If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2014-08-23 17:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (175 votes), past polls