获取反向互补序列并计算GC含量

  1. 程序代码

  2. 1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    #!/usr/bin/perl 
     
    use strict;
    use warnings;
     
    my $dna    = "ACGGGCGGCACGGGAAAAAATTTTTAACTCTTACGCG";
    my $revcom = reverse $dna;
    $revcom =~ tr /ACGT/TGCA/;
    print "Input DNA:n$dnanReverse complementary DNA:n$revcomnn";
    my $gc = $revcom =~ tr/GC//;
    my $gc_content = sprintf( "%.2F", $gc / length($revcom) * 100 );
    print "GC number:t$gcn";
    print "GC content:t${gc_content}%n";
  3. 结果输出

  4. 1
    2
    3
    4
    5
    6
    7
    
    Input DNA:
    ACGGGCGGCACGGGAAAAAATTTTTAACTCTTACGCG
    Reverse complementary DNA:
    CGCGTAAGAGTTAAAAATTTTTTCCCGTGCCGCCCGT
     
    GC number:	18
    GC content:	48.65%