perl应用之从基因组里分割染色体序列

发布时间:2020-11-05编辑:脚本学堂
perl应用之从基因组里分割染色体序列

染色体的结构:
>Chr1
nnnnnnnnnnnnnnnnnnnnnnnnnnnn
>Chr2
ATGCATGC

下面是程序:
 

复制代码 代码如下:
#!/bin/perl
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.txtn"; 
chomp($dna_filename=<STDIN>); 
open(DNAFILENAME,$dna_filename)||die("can not open the file!"); 
 
$/=">"; 
 
$DNA0=<DNAFILENAME>; 
open (DNA0,">d:19DNA0.txt"); 
print DNA0 $DNA0; 
close (DNA0); 
 
$DNA1=<DNAFILENAME>; 
open (DNA1,">d:19DNA1.txt"); 
print DNA1 ">".$DNA1; 
close (DNA1); 
 
$DNA2=<DNAFILENAME>; 
open (DNA2,">d:19DNA2.txt"); 
print DNA2 ">".$DNA2; 
close (DNA2); 
 
$DNA3=<DNAFILENAME>; 
open (DNA3,">d:19DNA3.txt"); 
print DNA3 ">".$DNA3; 
close (DNA3); 
 
$DNA4=<DNAFILENAME>; 
open (DNA4,">d:19DNA4.txt"); 
print DNA4 ">".$DNA4; 
close (DNA4); 
 
$DNA5=<DNAFILENAME>; 
open (DNA5,">d:19DNA5.txt"); 
print DNA5 ">".$DNA5; 
close (DNA5);