perlで塩基配列を扱ってみたよん(^^)

perlを用いて、DNAの塩基配列を出力したり、二つのDNAフラグメントを結合したりしてみました(^_^)

$ vim 110215.1.pl

a

use strict;
use warnings;
#Storing DNA in a variable, and printing it

#First we store the DNA in a variable called $DNA
my $DNA = 'AGCGGAGGACGGGAAAATTACTACGGCATTAGC';

# Next, we print the DNA onto the screen
print "$DNA\n";



Esc

:wq



$ perl 110215.1.pl
AGCGGAGGACGGGAAAATTACTACGGCATTAGC



$ vim 110215.2.pl

a

  1 use strict;
  2
  3 #Store two DNA fragments into two vairiables called $DAN1 and $DNA2
  4 my $DNA1 = 'ACGGGAGGACGGGAAAATTACTACGGCATTAGC';
  5 my $DNA2 = 'ATAGTGCCGTGAGAGTGATGTAGTA';
  6
  7 # Print the DNA onto the screen
  8 print "Here are the original two DNA fragments:\n\n";
  9 print "DNA1 is $DNA1\n";
 10 print "DNA2 is $DNA2\n\n";
 11
 12 #Concatenate the DNA fragments into a third variable and print them
 13 #Using #string interpolation"
 14 my $DNA3 = "$DNA1$DNA2";
 15
 16 print "Here is the concatenation of the first two fragments(version1):\n\n";
 17 print "$DNA3\n\n";
 18
 19 #An alternative way using the "dot operator";
 20 #Concatenate the DNA fragments into a third variable and print them
 21 my $DNA3 = $DNA1 . $DNA2;
 22
 23 print "Here is the concatenation of the first two fragments(version2):\n";
 24 print "$DNA3\n\n";
 25
 26 #print the same thing without using the variable $DNA3
 27 print "Here is the concatenation of the first two fragments(version3):\n";
 28 print $DNA1, $DNA2, "\n";
 29
 30


Esc

$ perl 110215.2.pl
Here are the original two DNA fragments:

DNA1 is ACGGGAGGACGGGAAAATTACTACGGCATTAGC
DNA2 is ATAGTGCCGTGAGAGTGATGTAGTA

Here is the concatenation of the first two fragments(version1):

ACGGGAGGACGGGAAAATTACTACGGCATTAGCATAGTGCCGTGAGAGTGATGTAGTA

Here is the concatenation of the first two fragments(version2):
ACGGGAGGACGGGAAAATTACTACGGCATTAGCATAGTGCCGTGAGAGTGATGTAGTA

Here is the concatenation of the first two fragments(version3):
ACGGGAGGACGGGAAAATTACTACGGCATTAGCATAGTGCCGTGAGAGTGATGTAGTA