Skip to content

Commit

Permalink
Prevent NoneType from intensity frame
Browse files Browse the repository at this point in the history
  • Loading branch information
WangHong007 committed Jan 19, 2024
1 parent 5f3e3e5 commit bde58f5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pmultiqc/modules/quantms/quantms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit bde58f5

Please sign in to comment.