13
13
import pandas as pd
14
14
from multiqc .plots import bargraph
15
15
from multiqc .types import Anchor
16
- from utils .constant_variables import CLUSTER_PCONFIG , READ_DECLARATION
16
+ from utils .constant_variables import CLUSTER_PCONFIG
17
17
from utils .file_tools import filelist_to_df , get_module_selection , read_in_quast , write_df
18
18
from utils .module_data_processing import *
19
19
from utils .pandas_tools import filter_and_rename_columns , join_df , reorder_columns , select_columns
@@ -488,13 +488,6 @@ def write_results(contigs_mqc: pd.DataFrame, constraints_mqc: pd.DataFrame, cons
488
488
write_df (constraints_mqc .sort_values (by = ["sample" , "cluster" , "step" ]), "mapping_overview.tsv" , [])
489
489
samples .extend (constraints_mqc ["sample" ])
490
490
491
- if not constraints_genstats .empty :
492
- # Add to mqc
493
- module = mqc .BaseMultiqcModule (name = "Mapping Constraints Summary" , anchor = Anchor ("custom_data" ))
494
- content = constraints_genstats .to_dict (orient = "index" )
495
- module .general_stats_addcols (content )
496
- mqc .report .modules .append (module )
497
-
498
491
# Remove empty lines from the general stats data report
499
492
samples = list (set (samples ))
500
493
mqc .report .general_stats_data = [{k : v for k , v in d .items () if k in samples } for d in mqc .report .general_stats_data ]
@@ -503,6 +496,9 @@ def write_results(contigs_mqc: pd.DataFrame, constraints_mqc: pd.DataFrame, cons
503
496
logger .info ("Writing general stats file: samples_overview.tsv" )
504
497
samples_overview = pd .DataFrame .from_dict (get_general_stats_data_mod (), orient = "index" )
505
498
samples_overview ["sample" ] = samples_overview .index
499
+ if not constraints_genstats .empty :
500
+ samples_overview = samples_overview .join (constraints_genstats , on = "sample" , how = "left" )
501
+
506
502
write_df (reorder_columns (samples_overview , ["sample" ]), "samples_overview.tsv" , [])
507
503
508
504
mqc .write_report (
0 commit comments