Skip to content

Commit b448fa0

Browse files
authored
Merge pull request #102 from rpetit3/patch-1
Improved single end support
2 parents 4496ff4 + 38e5562 commit b448fa0

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

phyloFlash.pl

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ sub print_report {
755755
if (defined $ssu_sam_mapstats{"assem_ratio"}) {
756756
print {$fh} "Ratio of assembled SSU reads:\t".$ssu_sam_mapstats{"assem_ratio"}."\n";
757757
}
758-
my $chao1_3dp = sprintf("%.3f",$chao1);
758+
my $chao1_3dp = $chao1 eq "n.d." ? $chao1 : sprintf ("%.3f", $chao1);
759759

760760
print {$fh} qq~
761761
---
@@ -875,7 +875,7 @@ sub write_csv {
875875
"NTUs observed once",$xtons[0],
876876
"NTUs observed twice",$xtons[1],
877877
"NTUs observed three or more times",$xtons[2],
878-
"NTU Chao1 richness estimate",sprintf("%.3f",$chao1), # Round to 3 d.p.
878+
"NTU Chao1 richness estimate", $chao1 eq "n.d." ? $chao1 : sprintf ("%.3f", $chao1), # Round to 3 d.p.
879879
"program command",$progcmd,
880880
"database path",$DBHOME,
881881
));
@@ -1149,6 +1149,20 @@ sub parse_mapstats_from_sam_arr {
11491149
$splitname = $1.$2;
11501150
}
11511151
$qname_hash{$splitname} ++;
1152+
1153+
if ($SEmode == 0) {
1154+
if ($href->{'FLAG'} & 0x40) { # Fwd read
1155+
$ssu_f_reads ++ unless $href->{'FLAG'} & 0x4; # Unless fwd read unmapped
1156+
} elsif ($href->{'FLAG'} & 0x80) { # Rev read
1157+
$ssu_r_reads ++ unless $href->{'FLAG'} & 0x4; # Unless rev read unmapped
1158+
}
1159+
} else {
1160+
# Single end reads
1161+
if ($href->{'FLAG'} == 0 || $href->{'FLAG'} & 0x10) {
1162+
$ssu_f_reads ++;
1163+
}
1164+
}
1165+
11521166
if ($href->{'FLAG'} & 0x40) { # Fwd read
11531167
$ssu_f_reads ++ unless $href->{'FLAG'} & 0x4; # Unless fwd read unmapped
11541168
} elsif ($href->{'FLAG'} & 0x80) { # Rev read
@@ -2733,7 +2747,7 @@ sub write_report_html {
27332747
"XTONS0" => $xtons[0],
27342748
"XTONS1" => $xtons[1],
27352749
"XTONS2" => $xtons[2],
2736-
"CHAO1" => sprintf ("%.3f", $chao1), # Round to 3 decimal places
2750+
"CHAO1" => $chao1 eq "n.d." ? $chao1 : sprintf ("%.3f", $chao1), # Round to 3 decimal places
27372751
);
27382752

27392753
# Define suppress flags (which turn off writing of report)

0 commit comments

Comments
 (0)