6 open I
, "-|", "ls -1 ../c.sort_rmdup_bam/*.bam";
7 open O
, ">", "count_FLAG_CIGAR_result.txt";
12 $file{$_} = openfile
($_);
15 print STDERR
"Read file list complete!\n";
18 foreach (sort keys %file) {
19 $thread{$_} = threads
->new(\
&countsam
, $file{$_});
23 foreach (sort keys %thread) {
24 $count{$_} = $thread{$_}->join;
25 print STDERR
"Count $_ complete!\n";
28 print O
"#File\t#FLAG\t#CIGAR\n";
29 foreach (sort keys %count) {
30 print O
$_, "\t", (join "\t", @
{$count{$_}}), "\n";
33 print STDERR
"Done!\n";
38 open $infile, "-|", "samtools-0.1.7 view $filename" or die "Error opening $filename: $!\n";
49 my @b = $a[5] =~ /(\d+\D)/g;
58 $flag .= "#$_=$FLAG{$_}," foreach sort keys %FLAG;
59 $cigar .= "$CIGAR{$_}$_," foreach sort keys %CIGAR;
60 return [$flag, $cigar];