@@ -146,7 +146,10 @@ def create_toc(content: str):
146
146
if header_level != current_level :
147
147
if header_level > current_level :
148
148
for i in range (header_level - current_level ):
149
- toc .write ('<li><ul class="toc_list">' )
149
+ # List style type: none prevents seeing two bullets in
150
+ # front of the list item.
151
+ toc .write ('<li style="list-style-type:none;">'
152
+ '<ul class="toc_list">' )
150
153
else :
151
154
for i in range (current_level - header_level ):
152
155
toc .write ("</ul></li>" )
@@ -1893,12 +1896,12 @@ def to_html(self) -> str:
1893
1896
<th>Adapter Sequence</th><th>Best match</th></tr>
1894
1897
<tr>
1895
1898
<td>Read 1</td>
1896
- <td>{ self .longest_adapter_read1 } </td>
1899
+ <td style="font-family:monospace;" >{ self .longest_adapter_read1 } </td>
1897
1900
<td>{ self .longest_adapter_read1_match } </td>
1898
1901
</tr>
1899
1902
<tr>
1900
1903
<td>Read 2</td>
1901
- <td>{ self .longest_adapter_read2 } </td>
1904
+ <td style="font-family:monospace;" >{ self .longest_adapter_read2 } </td>
1902
1905
<td>{ self .longest_adapter_read2_match } </td>
1903
1906
</tr>
1904
1907
</table>
@@ -1910,7 +1913,7 @@ def to_html(self) -> str:
1910
1913
for adapter , count in self .adapters_read1 :
1911
1914
report .write (
1912
1915
f"""<tr>
1913
- <td>{ adapter } </td>
1916
+ <td style="font-family:monospace;" >{ adapter } </td>
1914
1917
<td style="text-align:right;">{ count } </td>
1915
1918
</tr>
1916
1919
""" )
@@ -1922,7 +1925,7 @@ def to_html(self) -> str:
1922
1925
for adapter , count in self .adapters_read2 :
1923
1926
report .write (
1924
1927
f"""<tr>
1925
- <td>{ adapter } </td>
1928
+ <td style="font-family:monospace;" >{ adapter } </td>
1926
1929
<td style="text-align:right;">{ count } </td>
1927
1930
</tr>
1928
1931
""" )
@@ -1952,6 +1955,33 @@ def to_html(self) -> str:
1952
1955
CLASS_TO_NAME : Dict [Type [ReportModule ], str ] = {
1953
1956
value : key for key , value in NAME_TO_CLASS .items ()}
1954
1957
1958
+ CLASS_TO_ORDER = {
1959
+ Meta : 0 ,
1960
+ Summary : 1 ,
1961
+ SequenceLengthDistribution : 2 ,
1962
+ PerBaseQualityScoreDistribution : 3 ,
1963
+ PerPositionMeanQualityAndSpread : 4 ,
1964
+ PerSequenceAverageQualityScores : 5 ,
1965
+ PerPositionBaseContent : 6 ,
1966
+ PerPositionNContent : 7 ,
1967
+ PerSequenceGCContent : 8 ,
1968
+ AdapterContent : 9 ,
1969
+ AdapterFromOverlapReport : 10 ,
1970
+ InsertSizeMetricsReport : 11 ,
1971
+ PerTileQualityReport : 12 ,
1972
+ DuplicationCounts : 13 ,
1973
+ OverRepresentedSequences : 14 ,
1974
+ NanoStatsReport : 15 ,
1975
+ }
1976
+
1977
+
1978
+ def module_sort_key (m : ReportModule ):
1979
+ prio = CLASS_TO_ORDER [type (m )]
1980
+ read_pair_info = ""
1981
+ if hasattr (m , "read_pair_info" ):
1982
+ read_pair_info = getattr (m , "read_pair_info" )
1983
+ return prio , read_pair_info
1984
+
1955
1985
1956
1986
def report_modules_to_dict (report_modules : Iterable [ReportModule ]):
1957
1987
def get_name (module : ReportModule ) -> str :
@@ -2113,39 +2143,31 @@ def calculate_stats(
2113
2143
data_ranges = list (equidistant_ranges (max_length , graph_resolution ))
2114
2144
modules = [
2115
2145
Meta .from_filepath (filename , filename_reverse ),
2116
- ]
2117
- # Generic modules for both read1 and read2 come first.
2118
- if insert_size_metrics :
2119
- modules .append (
2120
- AdapterFromOverlapReport .from_insert_size_metrics (insert_size_metrics ))
2121
- modules .append (
2122
- InsertSizeMetricsReport .from_insert_size_metrics (insert_size_metrics ))
2123
- if filename_reverse :
2124
- modules .append (
2125
- DuplicationCounts .from_dedup_estimator (dedup_estimator ),
2126
- )
2127
- modules .extend (qc_metrics_modules (metrics , data_ranges ,
2128
- read_pair_info = read_pair_info1 ))
2129
- if adapter_counter :
2130
- modules .append (
2131
- AdapterContent .from_adapter_counter_adapters_and_ranges (
2132
- adapter_counter , adapters , data_ranges , read_pair_info = read_pair_info1 )
2133
- )
2134
- modules .append (PerTileQualityReport .from_per_tile_quality_and_ranges (
2135
- per_tile_quality , data_ranges , read_pair_info = read_pair_info1 ),)
2136
- if not filename_reverse :
2137
- modules .append (
2138
- DuplicationCounts .from_dedup_estimator (dedup_estimator )
2139
- )
2140
- modules .append (
2146
+ * qc_metrics_modules (metrics , data_ranges , read_pair_info = read_pair_info1 ),
2147
+ PerTileQualityReport .from_per_tile_quality_and_ranges (
2148
+ per_tile_quality , data_ranges , read_pair_info = read_pair_info1 ),
2141
2149
OverRepresentedSequences .from_sequence_duplication (
2142
2150
sequence_duplication ,
2143
2151
fraction_threshold = fraction_threshold ,
2144
2152
min_threshold = min_threshold ,
2145
2153
max_threshold = max_threshold ,
2146
2154
read_pair_info = read_pair_info1 ,
2155
+ ),
2156
+ DuplicationCounts .from_dedup_estimator (dedup_estimator ),
2157
+ NanoStatsReport .from_nanostats (nanostats )
2158
+ ]
2159
+ if adapter_counter :
2160
+ modules .append (
2161
+ AdapterContent .from_adapter_counter_adapters_and_ranges (
2162
+ adapter_counter , adapters , data_ranges , read_pair_info = read_pair_info1 )
2147
2163
)
2148
- )
2164
+
2165
+ # Generic modules for both read1 and read2 come first.
2166
+ if insert_size_metrics :
2167
+ modules .append (
2168
+ AdapterFromOverlapReport .from_insert_size_metrics (insert_size_metrics ))
2169
+ modules .append (
2170
+ InsertSizeMetricsReport .from_insert_size_metrics (insert_size_metrics ))
2149
2171
2150
2172
if (metrics_reverse and per_tile_quality_reverse and
2151
2173
sequence_duplication_reverse ):
@@ -2168,6 +2190,5 @@ def calculate_stats(
2168
2190
max_threshold = max_threshold ,
2169
2191
read_pair_info = READ2 ,
2170
2192
))
2171
-
2172
- modules .append (NanoStatsReport .from_nanostats (nanostats ))
2193
+ modules .sort (key = module_sort_key )
2173
2194
return modules
0 commit comments