Click here to get back home

Help: Reverse Letters

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Help: Reverse Letters Amy Lee 05-02-2008
Posted by Amy Lee on May 2, 2008, 10:44 am
Please log in for more thread options
Hello,

There's a problem while I'm processing sequences. My file content.

>seq1
ATGCCCTGACGTAAACGTAGGCTACG
>seq2
GCATGCCCTACGGGTACCCCAGTA

And I hope I can reverse the sequences to be this.

>seq1
GCATCGGATGCAAATGCAGTCCCGTA
>seq2
ATGACCCCATGGGCATCCCGTACG

I use "reverse" to do this, but it dose not work any more.
So could you tell me how to solve this problem?

Thank you very much~

Regards,

Amy Lee

Posted by Jürgen Exner on May 2, 2008, 10:48 am
Please log in for more thread options
>There's a problem while I'm processing sequences. My file content.
>ATGCCCTGACGTAAACGTAGGCTACG
>And I hope I can reverse the sequences to be this.
>GCATCGGATGCAAATGCAGTCCCGTA

You asked a self answering question: The reverse() function does exactly
that.

>I use "reverse" to do this, but it dose not work any more.

?????
Are you saying that coming back into the office after yesterday's Labour
Day the functionality of reverse() in Perl has changed?

jue

Posted by Amy Lee on May 2, 2008, 10:53 am
Please log in for more thread options
On Fri, 02 May 2008 14:48:28 +0000, Jürgen Exner wrote:

>>There's a problem while I'm processing sequences. My file content.
>>ATGCCCTGACGTAAACGTAGGCTACG
>>And I hope I can reverse the sequences to be this.
>>GCATCGGATGCAAATGCAGTCCCGTA
>
> You asked a self answering question: The reverse() function does exactly
> that.
>
>>I use "reverse" to do this, but it dose not work any more.
>
> ?????
> Are you saying that coming back into the office after yesterday's Labour
> Day the functionality of reverse() in Perl has changed?
>
> jue
Well, I'd better paste my codes here. I'm still working :(
while (<$FILE_IN>)
{
unless (/^>.*$/)
{
reverse $_;
}
print $_;
}
Thank you very much~

Amy

Posted by Mirco Wahab on May 2, 2008, 11:04 am
Please log in for more thread options
Amy Lee wrote:
> while (<$FILE_IN>)
> {
> unless (/^>.*$/)
> {
> reverse $_;

You need to reverse the order of the reverse
operator, before reversing the text:

$_ =reverse;

Regards

M.

Posted by Glenn Jackman on May 2, 2008, 11:51 am
Please log in for more thread options
At 2008-05-02 11:04AM, "Mirco Wahab" wrote:
> Amy Lee wrote:
> > while (<$FILE_IN>)
> > {
> > unless (/^>.*$/)
> > {
> > reverse $_;
>
> You need to reverse the order of the reverse
> operator, before reversing the text:
>
> $_ =reverse;

Also, the newline character will be reversed, so that should be removed
first:

while (<$FILE_IN>) {
chomp;
$_ = reverse unless /^>/;
print "$_\n";
}

--
Glenn Jackman
"If there is anything the nonconformist hates worse than a conformist,
it's another nonconformist who doesn't conform to the prevailing
standard of nonconformity." -- Bill Vaughan

Similar ThreadsPosted
Matching words and letters December 8, 2004, 11:33 pm
Lower casing letters of words July 15, 2005, 8:35 am
How to manipulate the cases of letters in a string? October 4, 2007, 7:47 pm
Getting Perl to ignore Letters when calculating numbers. March 30, 2005, 9:54 pm
regular expression consecutive numbers or letters November 1, 2006, 11:10 am
Perl Regex Question: how to translate only the leading letters of a line July 10, 2004, 4:52 pm
reverse dns August 18, 2006, 2:40 pm
FAQ 4.24 How do I reverse a string? May 12, 2005, 11:03 pm
FAQ 4.24 How do I reverse a string? January 21, 2005, 6:03 pm
FAQ 4.24 How do I reverse a string? July 28, 2005, 4:03 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap