Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Another Reverse Complement Question...

by lkenefic (Initiate)
on Jun 04, 2012 at 19:33 UTC ( [id://974359]=perlquestion: print w/replies, xml ) Need Help??

lkenefic has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Another Reverse Complement Question...
by johngg (Canon) on Jun 04, 2012 at 21:15 UTC

    It might be that tr (see Quote and Quote like Operators) will perform your reverse complement.

    knoppix@Microknoppix:~$ perl -E ' > $seq = q{ACTGTGGCGTCAACTG}; > say $seq; > ( $revSeq = $seq ) =~ tr{ATCG}{TAGC}; > say $revSeq;' ACTGTGGCGTCAACTG TGACACCGCAGTTGAC knoppix@Microknoppix:~$

    I hope this is helpful.

    Cheers,

    JohnGG

Re: Another Reverse Complement Question...
by Cristoforo (Curate) on Jun 04, 2012 at 20:31 UTC
    I don't work with BioPerl, but they do have a reverse complement method, revcom and it can be used like this example:

    #!/usr/bin/perl use strict; use warnings; use 5.014; use Bio::PrimarySeq; my $seqobj = Bio::PrimarySeq->new(-seq => 'ACTGTGGCGTCAACTG', -alphabet => 'dna', -id => 'test'); say $seqobj->seq; say $seqobj->revcom->seq; __END__ *** print out ACTGTGGCGTCAACTG CAGTTGACGCCACAGT

    But this doesn't do the translation you want: A => T, C => G, G => C and T => A. So, I don't know if this is any help.

    Update: After examining the reversed complement sequence, I see indeed it performs the complement as you stated but it also reverses the sequence with the first letter in the original being complemented and last in the reversed sequence, the second in the original complemented and being next to last in the reversed complement sequence, etc.

Re: Another Reverse Complement Question...
by snape (Pilgrim) on Jun 04, 2012 at 20:16 UTC

    You haven't use while loop to read the file line by line after opening the file. You don't have to use <STDIN> when you have initialized $infile before. You use <STDIN> when you want the input from the user/keyboard. Also, you haven't defined your file handler. It should be :

    my $infile = "xxx_capillary_SNPs.txt\n"; open IN, $infile or die "open infile failed\n"; while(<IN>){ ## do your reverse complement } close(IN);
Re: Another Reverse Complement Question...
by snape (Pilgrim) on Jun 04, 2012 at 20:04 UTC

    Please refer to the following link before posting your code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-18 13:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found