#!/usr/bin/perl -w # Author: yqy_135 # Program name: fasta-split.pl open (IN,"<$ARGV[0]") || die ("\nError: Couldn't open input file (*.txt) !\n\n"); open (OUT,">$ARGV[1]"); $lenth1=$ARGV[2]; $rep=$ARGV[3]; my $count; $/= ">"; while () { next unless (my ($id,$seq) = /(.*?)\n(.*)/s); $seq =~ s/[\d\s>]//g;#remove digits, spaces, line breaks,... my $lenseq= length $seq; $step=$lenth1-$rep; for ($i=1; $i<$lenseq; $i+=$step) { $id2="$id"."_"."$i"; $ii2=$i-1; $seq2=substr($seq,$ii2,$lenth1); print OUT ">"."$id2\n$seq2\n"; }; $count++; } ; print "\n$count records created.\n";
很不错哦,你可以试下
z伞mccz伞sж哗¢uq啷┒utā撺82023723072011-9-11 0:18:33