Skip to content

Commit

Permalink
- fixed BiblioSpec to use the spectrumNativeID attribute in pepXML wh…
Browse files Browse the repository at this point in the history
…en reading MSFragger pepXML (reported by Jennifer)

- fixed replacement of invalid output filename characters (thanks to Nick)
  • Loading branch information
chambm committed Feb 6, 2024
1 parent 1f52dda commit e0822ec
Show file tree
Hide file tree
Showing 5 changed files with 365 additions and 12 deletions.
20 changes: 13 additions & 7 deletions pwiz_tools/BiblioSpec/src/PepXMLreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,16 +305,22 @@ void PepXMLreader::startElement(const XML_Char* name, const XML_Char** attr)
}
// if morpheus or msfragger type
else if (analysisType_ == MORPHEUS_ANALYSIS || analysisType_ == MSFRAGGER_ANALYSIS || parentAnalysisType_ == MSFRAGGER_ANALYSIS) {
spectrumName = getRequiredAttrValue("spectrum", attr);
spectrumName = getAttrValue("spectrumNativeID", attr);
scanNumber = getIntRequiredAttrValue("start_scan", attr);
scanIndex = scanNumber - 1;

// HACK: remove zero padding of scan numbers in the spectrum attribute title because MSFragger MGF files don't have padding
if (lookUpBy_ == NAME_ID && (analysisType_ == MSFRAGGER_ANALYSIS || parentAnalysisType_ == MSFRAGGER_ANALYSIS))
{
namespace bxp = boost::xpressive;
auto scanNumberPaddingRegex = bxp::sregex::compile("(.*?\\.)0*(\\d+\\.)0*(\\d+\\.\\d+)");
spectrumName = bxp::regex_replace(spectrumName, scanNumberPaddingRegex, "$1$2$3");
if (!spectrumName.empty()) {
lookUpBy_ = NAME_ID;
}
else {
spectrumName = getRequiredAttrValue("spectrum", attr);
// HACK: remove zero padding of scan numbers in the spectrum attribute title because MSFragger MGF files don't have padding
if (lookUpBy_ == NAME_ID && (analysisType_ == MSFRAGGER_ANALYSIS || parentAnalysisType_ == MSFRAGGER_ANALYSIS))
{
namespace bxp = boost::xpressive;
auto scanNumberPaddingRegex = bxp::sregex::compile("(.*?\\.)0*(\\d+\\.)0*(\\d+\\.\\d+)");
spectrumName = bxp::regex_replace(spectrumName, scanNumberPaddingRegex, "$1$2$3");
}
}
}
// this should never happen, error should have been thrown earlier
Expand Down
5 changes: 3 additions & 2 deletions pwiz_tools/BiblioSpec/tests/Jamfile.jam
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,9 @@ blib-test-build comet : -o : output/comet.blib : comet.check zbuild.skip-lines :
blib-test-build comet-prg2012-wiff : -o -c@0 : output/comet-prg2012-wiff.blib : comet-prg2012-wiff.check zbuild.skip-lines : $(TEST_INPUTS_PATH)/201208-378803-cm.pep.xml : <vendor-api-support>off:<build>no ;
blib-test-build msfragger-tims : -o : output/msfragger-tims.blib : msfragger-tims.check : "$(TEST_INPUTS_PATH)/Hela$(.percent)20QC_PASEF_Slot1-5_01_57_cutout_2min.pepXML" ;
blib-test-build msfragger-thermo : -o : output/msfragger-thermo.blib : msfragger-thermo.check : $(TEST_INPUTS_PATH)/BSA_min_21.pepXML ;
blib-test-build peptideprophet-msfragger-thermo-mzml : -o : output/peptideprophet-msfragger-thermo-mzml.blib : peptideprophet-msfragger-thermo-mzml.check : $(TEST_INPUTS_PATH)/peptideprophet-msfragger-thermo-mzml.pep.xml ;
blib-test-build peptideprophet-msfragger-bruker-mgf : -o : output/peptideprophet-msfragger-bruker-mgf.blib : peptideprophet-msfragger-bruker-mgf.check : $(TEST_INPUTS_PATH)/peptideprophet-msfragger-bruker-mgf.pep.xml ;
blib-test-build-basic peptideprophet-msfragger-thermo-mzml : -o : $(TEST_INPUTS_PATH)/peptideprophet-msfragger-thermo-mzml.pep.xml ;
blib-test-build-basic peptideprophet-msfragger-thermo-mzml-nativeid : -o : $(TEST_INPUTS_PATH)/peptideprophet-msfragger-thermo-mzml-nativeid.pep.xml ;
blib-test-build-basic peptideprophet-msfragger-bruker-mgf : -o : $(TEST_INPUTS_PATH)/peptideprophet-msfragger-bruker-mgf.pep.xml ;
blib-test-build-basic msfragger-check-parent-path-first : -o : $(TEST_INPUTS_PATH)/msfragger-check-parent-path-first.pepXML ;
blib-test-build-basic msfragger-check-parent-path-first-with-missing-file : -o -e@inputs$(.slash)msfragger-check-parent-path-first : $(TEST_INPUTS_PATH)/msfragger-check-parent-path-first-with-missing-file.pepXML ;

Expand Down

0 comments on commit e0822ec

Please sign in to comment.