From bde58f5f00d93ca28bc9a7871d12132e0ba6a5a6 Mon Sep 17 00:00:00 2001 From: Hong Wang <88552471+WangHong007@users.noreply.github.com> Date: Fri, 19 Jan 2024 21:36:15 +0800 Subject: [PATCH 1/2] Prevent NoneType from intensity frame --- pmultiqc/modules/quantms/quantms.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pmultiqc/modules/quantms/quantms.py b/pmultiqc/modules/quantms/quantms.py index 288ed82..c917d86 100755 --- a/pmultiqc/modules/quantms/quantms.py +++ b/pmultiqc/modules/quantms/quantms.py @@ -1008,6 +1008,7 @@ def CalHeatMapScore(self): meta_data = dict(mztab_data.metadata) if self.pep_table_exists: pep_table = mztab_data.peptide_table + pep_table = pep_table.fillna(np.nan) pep_table.loc[:, 'stand_spectra_ref'] = pep_table.apply( lambda x: self.file_prefix(meta_data[x.spectra_ref.split(':')[0] + '-location']), axis=1) study_variables = list(filter(lambda x: re.match(r'peptide_abundance_study_variable.*?', x) is not None, @@ -1018,11 +1019,10 @@ def CalHeatMapScore(self): group[group['accession'].str.contains(config.kwargs["contaminant_affix"])][study_variables])) / \ np.sum(np.sum(group[study_variables])) if config.kwargs['remove_decoy']: - T = sum(group[(group['opt_global_cv_MS:1002217_decoy_peptide'] == 0)][study_variables].values. \ - tolist(), []) + pep_median = np.nanmedian(group[(group['opt_global_cv_MS:1002217_decoy_peptide'] == 0)][study_variables]. \ + to_numpy()) else: - T = sum(group[study_variables].values.tolist(), []) - pep_median = np.median([j for j in T if not math.isnan(j) is True]) + pep_median = np.nanmedian(group[study_variables].to_numpy()) self.heatmap_pep_intensity[name] = np.minimum(1.0, pep_median / (2 ** 23)) # Threshold # HeatMapMissedCleavages From 8d019ed7a7c84770c90133e6f6846c18ac0ea04d Mon Sep 17 00:00:00 2001 From: WangHong007 <88552471+WangHong007@users.noreply.github.com> Date: Sat, 20 Jan 2024 12:59:27 +0800 Subject: [PATCH 2/2] try fix table_object issue --- pmultiqc/modules/quantms/sparklines.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pmultiqc/modules/quantms/sparklines.py b/pmultiqc/modules/quantms/sparklines.py index eb58102..28c24c5 100755 --- a/pmultiqc/modules/quantms/sparklines.py +++ b/pmultiqc/modules/quantms/sparklines.py @@ -29,8 +29,8 @@ def plot(data, headers=None, pconfig=None, maxValue=0.0): for k, v in config.custom_plot_config[pconfig["id"]].items(): pconfig[k] = v - # Make a datatable object - dt = table_object.datatable(data, headers, pconfig) + # Make a DataTable object + dt = table_object.DataTable(data, headers, pconfig) # Collect unique sample names s_names = set()