Skip to content

Sp18 - #19

Closed
trofimovamw wants to merge 6 commits into
cbielow:QC2018from
trofimovamw:SP18
Closed

Sp18#19
trofimovamw wants to merge 6 commits into
cbielow:QC2018from
trofimovamw:SP18

Conversation

@trofimovamw

Copy link
Copy Markdown

add charge distribution metric

#include <OpenMS/KERNEL/FeatureMap.h>
#include <vector>

class OPENMS_DLLAPI QCChargeDistribution

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enclose the class declaration in

namespace OpenMS 
{
  class .... {}
}

maps.push_back (it->second);
}

for (unsigned long m = 0; m < maps.size(); m++)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size instead of unsigned long (which could have wrong type, depending on platform)


vector<PeptideIdentification> pep_id = f_it->getPeptideIdentifications();

if (pep_id.empty())

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

charge should be taken 1:1 from the features, not their PepIDs or PepHits.

row.sequence = PepSeq;

//Set optional columns: original RT and source file
vector<MzTabOptionalColumnEntry> v;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is duplicated code, right?!
You can leave the other columns empty and just add charge. Even if that means its only a single column.

//Else: append rows
else
{
for (unsigned i = 0; i < rows.size(); i++)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is highly unstable.
Rows should be added "in order" not at the bottom. This could be done via UniqueIDInterface, for example.

mztab.setPeptideSectionRows(mztabRows);
}

return rows.size()!=0 ? 1:0;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return !rows.empty() ?

MzTabPeptideSectionRows mztabRows = mztab.getPeptideSectionRows();
int pepIDCount = 0;

for(vector<pair<String,FeatureMap>>::const_iterator it = feat_map_.begin();it!=feat_map_.end();++it)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please get rid of this pair-construct. Pass vector to Constructor

@cbielow cbielow closed this Mar 11, 2019
cbielow pushed a commit that referenced this pull request May 12, 2020
minor style. add version for protein inference
cbielow pushed a commit that referenced this pull request Aug 26, 2026
…MS#9767 audit (OpenMS#9790)

Fixes 14 of the "no-doubt, easy" defects catalogued in the implementation-
consistency audit OpenMS#9767. Each fix is small and localized, ships with a focused
regression test that fails (crash/hang/assert) before and passes after, and
preserves behavior on valid inputs (only the buggy edge cases change). The set
was reviewed with Codex and CodeRabbit; their findings are incorporated below.

Boundary / crash / underflow:
- #4  QTClusterFinder / FeatureGroupingAlgorithmKD: guard the empty mass range so
      feature-empty input maps don't dereference front()/back()/size()-1. The
      guards run before the linking work: KD calls postprocess_() first so per-map
      protein/unassigned-peptide IDs survive; QT returns before the single-partition
      branch, whose setParameters_() otherwise throws on the empty maps' invalid
      max m/z (the <2-maps case is validated by the caller).
- #5  TheoreticalSpectrumGenerator: internal-fragment loop bound underflowed for
      peptides shorter than 4 (l < size-1-2) -> use additive l+3 < size.
- #18 MzTab nextPSMRow (both streams): empty hit list underflowed size()-1 and
      looped forever with export_all_psms -> use current_psm_idx_+1 >= size().
- #30 OMSSACSVFile::load: bound the quote-skipping scan by line.end().

Correctness (wrong field / sentinel / flag):
- #3  IDScoreGetterSetter::addToPeptideScoreMap_: the try_emplace "inserted" flag
      was misused, so a duplicated sequence never kept a later better score. Now
      updates BOTH the score and its target/decoy label, and resolves equal-score
      target/decoy ties to the target (matching getPickedProteinScores_), so the
      peptide-level representative is deterministic and input-order independent.
- #6  MRMFeatureFilter: group retention_time_u %RSD read the _l mean/variance.
- #12 ConsensusFeature range max sentinel minPositive() -> minNegative().
- #35 TIC::Result::operator== now includes relative_intensities.

Serialization round-trip:
- #17 Base64::decodeStrings: keep length-1 segments (dropped single-char strings).
      Also updates the malformed "====" corrupted-input expectation (now decodes
      to one placeholder byte instead of being silently dropped).
- #19 ArrowIOHelpers: parse int meta with stoll -> SignedSize (was 32-bit).
- #20 FeatureMapArrowIO::importPSMsFromArrow: group PSM rows by P_ID value, not by
      row adjacency (matches QPXFile/ConsensusMapArrowIO).

Stale-state on reload / clear:
- #27 QcMLFile::load: also clear derived run_/set_Name_ID_map_.
- #32 CalibrationData::clear: also clear groups_.
- #33 KDTreeFeatureMaps: init num_maps_{0}; clear() also clears rt_ cache.

Not included: #1 (=OpenMS#9488 PROC-23, already in open PR OpenMS#9616); #2 (correct but the
pooled split-charge FDR path has order-dependent side effects that preclude a
clean regression test in isolation); #7 (percentile index -- verified NOT a bug:
the "-1" is part of the double expression, so the negative value truncates to 0,
no underflow); #38 (TOPP-tool aux-array desync, needs a CLI test). Remaining audit
items need an API/deprecate decision.

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants