来个小程序perl如下序列:E078 10 CTACATCCAACA 21 100E034 10 ATCCACATCAAGGATT 25 100E012 59 CCAAGTTTT 67 100E012 62 CAGAATCGGAGGAGGAAA 79 100E056 39 AAGGTTTACAAGGTTCACCTC 59 100E012 36 GCTGCCAACACCAA 49 100E012 24 GACCAAATCGTCAAGATGGCCAA 46 100

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/24 03:37:19
来个小程序perl如下序列:E07810CTACATCCAACA21100E03410ATCCACATCAAGGATT25100E01259CCAAGTTTT67100E01262CAGAATCGGA

来个小程序perl如下序列:E078 10 CTACATCCAACA 21 100E034 10 ATCCACATCAAGGATT 25 100E012 59 CCAAGTTTT 67 100E012 62 CAGAATCGGAGGAGGAAA 79 100E056 39 AAGGTTTACAAGGTTCACCTC 59 100E012 36 GCTGCCAACACCAA 49 100E012 24 GACCAAATCGTCAAGATGGCCAA 46 100
来个小程序perl
如下序列:
E078 10 CTACATCCAACA 21 100
E034 10 ATCCACATCAAGGATT 25 100
E012 59 CCAAGTTTT 67 100
E012 62 CAGAATCGGAGGAGGAAA 79 100
E056 39 AAGGTTTACAAGGTTCACCTC 59 100
E012 36 GCTGCCAACACCAA 49 100
E012 24 GACCAAATCGTCAAGATGGCCAA 46 100
E034 21 AACAAGATC 29 100
E012 4 CCGAGAAGCGCGGAAAGCGTCA 25 100
E034 57 AACCTTCCAAACGTC 71 100
目的:1 把有E012开头的行都提出来.2算出E012开头的序列,占总序列的百分比.
结果如下:
E012 59 CCAAGTTTT 67 100
E012 62 CAGAATCGGAGGAGGAAA 79 100
E012 36 GCTGCCAACACCAA 49 100
E012 24 GACCAAATCGTCAAGATGGCCAA 46 100
E012 4 CCGAGAAGCGCGGAAAGCGTCA 25 100
占据率:0.5(E012有5个,E开头行有10个,故5/10=0.5)

来个小程序perl如下序列:E078 10 CTACATCCAACA 21 100E034 10 ATCCACATCAAGGATT 25 100E012 59 CCAAGTTTT 67 100E012 62 CAGAATCGGAGGAGGAAA 79 100E056 39 AAGGTTTACAAGGTTCACCTC 59 100E012 36 GCTGCCAACACCAA 49 100E012 24 GACCAAATCGTCAAGATGGCCAA 46 100
my $E_num = 0;
my $E_total = 0;
my $res = 0;
while ()
{
if ($_ =~m/^E012.*?/g)
{
$E_num = $E_num + 1;
print $_;
}
if ($_ = ~m/^E.*?/g)
{
$E_total = $E_total +1;
}
}
$res = $E_num/$E_total;
print "占据率:$res(E012有 $E_num个,E开头行有$E_total个,故$res)";
以上假设命令行文件读取,可以参照自行修改