How to use Perl script to get reverse complementary sequences
This article will explain in detail how to use Perl scripts to get reverse complementary sequences. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
The reverse complementary sequence function obtained by Perl script is as follows:
Sub reverse_complement_IUPAC {my $dna = shift; # reverse the DNA sequence my $revcomp = reverse ($dna); # complement the reversed DNA sequence $revcomp = ~ tr/ABCDGHMNRSTUVWXYabcdghmnrstuvwxy/TVGHCDKNYSAABWXRtvghcdknysaabwxr/; return $revcomp;} sub reverse_complement {my $dna = shift; # reverse the DNA sequence my $revcomp = reverse ($dna); # complement the reversed DNA sequence $revcomp = ~ tr/ACGTacgt/TGCAtgca/; return $revcomp;}
Usage, take reverse_complement as an example:
$str = & reverse_complement ($a)
The # $a variable stores the sequence string, and $str is the obtained reverse complementary sequence.
This is the end of this article on "how to use Perl scripts to get reverse complementary sequences". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.