perl 指定长度并生成一个随机的DNA序列的脚本代码
代码如下:
#!/bin/perl use strict; use warnings; #进行定义 my @dna; my $dna_length; my $newbase; my $i=0; print "please input the DNA length\n"; chomp($dna_length=<>); while($i<$dna_length) { #从四个碱基中随机选取一个 my(@nucleotides)=qw/A T G C/; $newbase=$nucleotides[rand @nucleotides]; #将随机生成的序列添加到@dna的数组中 push(@dna,$newbase); ++$i; } print "@dna";
相关推荐
边城客栈学无止境 2020-07-05
Walter的学习笔记 2020-07-04
A宇 2020-06-14
边城客栈学无止境 2020-06-10
邓博学习笔记 2020-06-03
davidliu00 2020-05-26
ShiShuo 2020-05-16
Aggressivesnail 2020-05-10
ShiShuo 2020-04-26
hanxingwang00 2020-04-22
davidliu00 2020-03-06
ShiShuo 2020-03-06
ShiShuo 2020-03-05
Aggressivesnail 2020-02-28
aaLiweipeng 2020-02-01
amberom 2020-01-16
Walter的学习笔记 2020-01-06