2 use lib
'E:/BGI/toGit/perlib/etc';
6 use Time
::HiRes qw
( gettimeofday tv_interval
);
17 \t-b No pause for batch runs
22 die "[x]Must specify output prefix !\n" if ! $opt_p;
26 open O
,'>',$opt_p.'.fa' or die "Error: $!\n";
31 if ($opti =~ /.bz2$/) {
32 open( $infile,"-|","bzip2 -dc $opti") or die "Error: $!\n";
33 } elsif ($opti =~ /.gz$/) {
34 open( $infile,"-|","gzip -dc $opti") or die "Error: $!\n";
35 } else {open( $infile,"<",$opti) or die "Error: $!\n";}
39 warn "Files: [@ARGV]\n";
42 while ($_=shift @ARGV) {
44 my $infile=openfile
($_);
48 die "[x]Not a FASTA file !\n" unless /^\s*>/;
53 my ($id,$desc)=split / /,$_,2;
54 if ($desc && $desc !~ /^\s*$/) {
57 } else { $desc='.';$Head=$id; }
64 my $lc = $seq=~tr/agct/nnnn/;
66 print STDERR
">$id\t$len, $lc\t[$desc]:\n";
67 print O
">$Head $desc\n";
68 for (my $i=0; $i<$len; $i+=$FASTAwidth) {
69 print O
substr($seq,$i,$FASTAwidth)."\n";
77 if ($TotalLen > 2000000000) {
80 system($cmd."-p $opt_p ${opt_p}.fa");
81 system("samtools faidx ${opt_p}.fa");