perl应用:生物突变的随机模拟程序

perl应用:生物突变的随机模拟程序,第1张

概述use strict;use warnings; #随便找一个比较好识别的序列my $DNA="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n";my $i;my $mutant;srand(time|$$);$mutant=mutate($DNA);print "Mutate \n"



use strict;use warnings;            #随便找一个比较好识别的序列my $DNA="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n";my $i;my $mutant;srand(time|$$);$mutant=mutate($DNA);print "Mutate \n". $DNA;print "Here is the original DNA:\n";print "$DNA\n";print "Here is the mutant DNA:\n\n";print "$mutant\n";print "Here are 10 more successive mutations:\n";for ($i=0;$i<10;++$i){	$mutant=mutate($mutant);	print "$mutant\n";}            #子程序:根据序列的长度定义一个随机位置的子程序sub randomposition{	my($string)=@_;	return int(rand(length($string)));}            #子程序:从一个数组中随机选取一个元素sub randelement{	my(@array)=@_;	return $array[rand @array];}            #子程序:引用上面的子程序,从ATGC四个碱基中随机选取一个sub randomnucleotIDe{	my (@nucleotIDes)=qw/A T G C/;	return randelement(@nucleotIDes);}            #子程序:生成突变的子程序sub mutate{	my($dna)=@_;	my(@nucleotIDes)=qw(A T G C);	my($position)=randomposition($dna);	my($newbase)=randomnucleotIDe(@nucleotIDes);	substr($dna,$position,1,$newbase);#substr($string,$initial_position,$length,replacement substring)	return $dna;}						



结果如下:

F:\>perl\a.plMutateAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHere is the original DNA:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHere is the mutant DNA:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAHere are 10 more successive mutations:ACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAACAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAACAAAAAAAAACAAAAAAAAAAAAATAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAACAAAAAAAAACAAAAAAAAAAAAATAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAACAAAAAAAAACAAAAAAAAAAAAATAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAACAAAAAAAAACAAAAAAAAAAAAATAAAAAAAAAAAAAAATGAAAAAAAAAAAAAAACTAAAAAAAACAAAAAAAAAAAAATAAAAAAAAAAAAAAATGAAAAAAAAAAAAAAACTAAAAAAAACAAAAAAAAAAAAATAAGAAAAAAAAAAAATGAAAAAAAAAAAAAAACTAAAAAAAACAAAAAAAAAAAAATAAGAAAAAAAAAAAATGTAAAAAAAAAAAAAACTAAAAAAAACAAAAAAAAAAAAATAAGAAAAAAAAAAAATGTAAAAAAAAAAAAAF:\>
@H_301_30@ 总结

以上是内存溢出为你收集整理的perl应用:生物突变的随机模拟程序全部内容,希望文章能够帮你解决perl应用:生物突变的随机模拟程序所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1293522.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-10
下一篇 2022-06-10

发表评论

登录后才能评论

评论列表(0条)

保存