Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension of bruker precursor information (2nd attempt) #3191

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ba475f1
Feature Reader Bruker with extended precursor info
xjasg Nov 6, 2023
c9f071e
Collisional Cross Sectional Area added
Andre99999999 Sep 4, 2024
5c7e77a
mzXML and MGF Reader/Writer externded
xjasg Nov 19, 2023
e8e5c5e
Bugfix Typo
xjasg Nov 25, 2023
112bf17
Changes after review
Andre99999999 Sep 4, 2024
0b8ffc4
Bugfix merges
Andre99999999 Sep 4, 2024
ee17fef
Test files changed
Andre99999999 Sep 7, 2024
8aeecd0
lowest and highest observed mz
Andre99999999 Sep 29, 2024
0f3b1a3
small cleanup
Andre99999999 Sep 29, 2024
8104588
Merge branch 'master' into feature/bruker_precursor_2
xjasg Oct 10, 2024
3ab4cff
Bugfix
Andre99999999 Oct 10, 2024
912c3c6
Fix Build exception
Andre99999999 Oct 11, 2024
56949cf
Bugfix unused header
Andre99999999 Oct 11, 2024
e7bf0d5
Revert changes after review
Andre99999999 Oct 11, 2024
3e7fd96
Remove unnecessary code
Andre99999999 Oct 11, 2024
5f5a974
Remove unused function
Andre99999999 Oct 11, 2024
ef4e5d4
cleanup
Andre99999999 Oct 11, 2024
e2e6ea2
Revert "lowest and highest observed mz"
Andre99999999 Oct 11, 2024
bb1a8ee
Partially revert last changes ( add intensity population again )
Andre99999999 Oct 31, 2024
853d207
Whitespace issues
Andre99999999 Nov 1, 2024
701ac75
merge latest version
Andre99999999 Nov 1, 2024
a80d333
Whitespace issue
Andre99999999 Nov 1, 2024
f4213a0
MGF Serializer + Spectrum list changes (Revwiew findings)
Andre99999999 Nov 6, 2024
e487769
Bugfix Build error
Andre99999999 Nov 6, 2024
73aca39
Extend MGF test with new parameters
Andre99999999 Nov 8, 2024
c18d414
Cleanup
Andre99999999 Nov 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions pwiz/data/msdata/Diff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,25 @@ void diff(const Spectrum& a,
}
}

if (config.ignoreSpectrumTitle)
{
vector<CVParam>::const_iterator it =
find_if(a_b.cvParams.begin(), a_b.cvParams.end(), CVParamIs(MS_spectrum_title));

if (it != a_b.cvParams.end())
{
a_b.cvParams.erase(it);
}

it =
find_if(b_a.cvParams.begin(), b_a.cvParams.end(), CVParamIs(MS_spectrum_title));

if (it != b_a.cvParams.end())
{
b_a.cvParams.erase(it);
}
}

// provide context
if (!a_b.empty() || !b_a.empty())
{
Expand Down
5 changes: 4 additions & 1 deletion pwiz/data/msdata/Diff.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,17 @@ struct PWIZ_API_DECL DiffConfig : public pwiz::data::BaseDiffConfig

bool ignoreDataProcessing;

bool ignoreSpectrumTitle;

Copy link
Member

Choose a reason for hiding this comment

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

Why is this necessary? I would expect the new CCS-in-title code to round trip the CCS so the title will be preserved and not different. What diffs were you getting without this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, unfortunately it is different. The serializer writes it into the title string, but the reference does not contain the text ‘ccs=...’. But this reference is used for both - reading and writing.
The other cases of code where the title is extended too seem not to run through the test, so it was not a problem there.

DiffConfig()
: pwiz::data::BaseDiffConfig(),
ignoreIdentity(false),
ignoreMetadata(false),
ignoreExtraBinaryDataArrays(false),
ignoreSpectra(false),
ignoreChromatograms(false),
ignoreDataProcessing(false)
ignoreDataProcessing(false),
ignoreSpectrumTitle(false)
{}
};

Expand Down
3 changes: 3 additions & 0 deletions pwiz/data/msdata/Serializer_MGF_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ void initializeTinyMGF(MSData& msd)
s21.scanList.scans.push_back(Scan());
Scan& s21scan = s21.scanList.scans.back();
s21scan.set(MS_scan_start_time, 42.0, UO_second);
s21scan.set(MS_inverse_reduced_ion_mobility, 421.0, MS_volt_second_per_square_centimeter);
s21scan.set(MS_collisional_cross_sectional_area, 1.376, UO_square_angstrom);

s21.setMZIntensityArrays(vector<double>(), vector<double>(), MS_number_of_detector_counts);
BinaryData<double>& s21_mz = s21.getMZArray()->data;
Expand Down Expand Up @@ -154,6 +156,7 @@ void testWriteRead(const MSData& msd)
DiffConfig diffConfig;
diffConfig.ignoreIdentity = true;
diffConfig.ignoreChromatograms = true;
diffConfig.ignoreSpectrumTitle = true;

Diff<MSData, DiffConfig> diff(msd, msd2, diffConfig);
if (os_ && diff) *os_ << diff << endl;
Expand Down
7 changes: 5 additions & 2 deletions pwiz/data/msdata/SpectrumList_MGF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@ class SpectrumList_MGFImpl : public SpectrumList_MGF
return -1; // not found

start += strlen(startTag);
const string endTags[] = { "", " ", ",",";","\n","\r","\t" };
const string endTags[] = { " ", ",",";","\t" };
string ccsStr;

for(int i=0; i< sizeof(endTags)/sizeof(endTags[0]); i++)
{
const size_t end = title.find(endTags[i], start);
Expand All @@ -379,6 +379,9 @@ class SpectrumList_MGFImpl : public SpectrumList_MGF
}
}

if(ccsStr.empty())
ccsStr = title.substr(start, title.length() - start);
Copy link
Member

Choose a reason for hiding this comment

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

I think this can be simplified to:

        const size_t end = title.length();
        for(int i=0; i< sizeof(endTags)/sizeof(endTags[0]); i++)
        {
            const size_t tmpEnd = title.find(endTags[i], start);
            if(tmpEnd != string::npos)
            {
                end = tmpEnd;
                break;
            }
        }

        ccsStr = title.substr(start,  end - start);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay, looks good, I change this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


try
{
return boost::lexical_cast<double>(ccsStr);
Expand Down
Loading