染色体的结构:
>Chr1
nnnnnnnnnnnnnnnnnnnnnnnnnnnn
>Chr2
ATGCATGC
下面是程序:
use strict;use warnings;my $dna_filename;my $DNA0='';my $DNA1='';my $DNA2='';my $DNA3='';my $DNA4='';my $DNA5='';print "please input the path just like this f:\\perl\\data.txt\n";chomp($dna_filename=<STDIN>);open(DNAfilename,$dna_filename)||dIE("can not open the file!");$/=">";$DNA0=<DNAfilename>;open (DNA0,">d:\19\DNA0.txt");print DNA0 $DNA0;close (DNA0);$DNA1=<DNAfilename>;open (DNA1,">d:\19\DNA1.txt");print DNA1 ">".$DNA1;close (DNA1);$DNA2=<DNAfilename>;open (DNA2,">d:\19\DNA2.txt");print DNA2 ">".$DNA2;close (DNA2);$DNA3=<DNAfilename>;open (DNA3,">d:\19\DNA3.txt");print DNA3 ">".$DNA3;close (DNA3);$DNA4=<DNAfilename>;open (DNA4,">d:\19\DNA4.txt");print DNA4 ">".$DNA4;close (DNA4);$DNA5=<DNAfilename>;open (DNA5,">d:\19\DNA5.txt");print DNA5 ">".$DNA5;close (DNA5);
2013年2月23日更新
上面的程序显然非常的麻烦,现在又重新用到了这个程序,所以进行了了简单的修改,程序在linux下运行:
#!/usr/bin/env perl use strict;use warnings;use utf8;my $i;my $DNA;open(IN,"IRGSP-1.0_genome.fasta")||dIE("can not open");$/=">";for($i=0;$i<13;$i++){ $DNA=<IN>; open(OUT,">chr$i")||dIE("can not open"); print OUT ">$DNA"; close OUT;}
最近闲着没事有修改了一下:2013-07-16
这里的i是染色体条数+1;
use strict; use warnings; use utf8; open(IN,"a.txt")||dIE("can not open"); $/=">"; for(my $i=0;$i<5;$i++) { my $DNA=<IN>; $DNA=~m/(.+)/; my $name=; open(OUT,">$name.txt")||dIE("can not open"); $DNA=~m/(.+)>/s; my $result=; print OUT ">$result"; close OUT; }总结
以上是内存溢出为你收集整理的perl应用:从基因组里分割染色体序列全部内容,希望文章能够帮你解决perl应用:从基因组里分割染色体序列所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)