Skip to content

Commit

Permalink
Fixing issue #63 related to MS3 data: some values were set only for M…
Browse files Browse the repository at this point in the history
…S1 and MS2 levels

Also some refactoring and added a warning on run slice insertion failure (that should not happen anymore !)
  • Loading branch information
AlexandreBurel committed Aug 2, 2017
1 parent 298f4fc commit 232bba1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ For details about mzDB concepts (scanSlice, runSlice...) and specifications, hav
### Roadmap v0.9.10

Bug fixes:
- [x] The field mzdb.param_tree can be corrupted for some Thermo raw files (#39)
- [x] Find and fix memory leak for AB Sciex data (#38)
- [ ] Issue #26 is for AB Sciex DIA acquisition (and accession 1001954)
- [x] Issue #24 sample name is empty for AB Sciex analyses (also check for Bruker)
- [ ] Improve cycle filtering by checking cycle number before centroiding data (#40)
- [x] Issue #26 is for AB Sciex DIA acquisition (and accession 1001954)
- [x] Issue #38: Find and fix memory leak for AB Sciex data
- [x] Issue #39: The field mzdb.param_tree can be corrupted for some Thermo raw files
- [x] Issue #57: Check MS3 analyses
- [x] Issue #60: Missing spectra in some mzDB files
- [x] Issue #61: Problem with DIA analyses

Improvements
- [x] Issue #40: Improve cycle filtering by checking cycle number before centroiding data
- [x] Issue #62: Improving DIA storing in bounding boxes

### Roadmap v1.0

Expand Down
17 changes: 12 additions & 5 deletions pwiz_mzdb/mzdb/writer/bb_inserter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ class mzBBInserter {
auto lastRunSliceIdx = bbs.back()->runSliceIdx();

if (m_lastMinRunSliceIdx && firstRunSliceIdx < m_lastMinRunSliceIdx) {
//printf("The first spectrum does not contain a low mass contained in the first runSlice.\n");
//printf("This is a bug and it will be fixed in a next release of raw2mzdb.\n");
//exit(0);
LOG(ERROR) << "The first spectrum does not contain a low mass contained in the first runSlice.";
LOG(ERROR) << "This is a bug and it will be fixed in a next release of raw2mzdb.";
exit(EXIT_FAILURE);
Expand All @@ -134,7 +131,12 @@ class mzBBInserter {
sqlite3_bind_double(m_mzdbFile.stmt, 5, moz + invBBheight);
sqlite3_bind_null(m_mzdbFile.stmt, 6);
sqlite3_bind_int(m_mzdbFile.stmt, 7, 1);
sqlite3_step(m_mzdbFile.stmt);
int rc = sqlite3_step(m_mzdbFile.stmt);
if (rc != SQLITE_DONE) {
LOG(ERROR) << "Error inserting run slice, request was:";
LOG(INFO) << "INSERT INTO run_slice VALUES (" << m_runSliceCount << ", " << msLevel << ", " << m_runSliceCount << ", " << moz << ", " << (moz+invBBheight) << ", null, 1);";
LOG(ERROR) << "SQLITE ERROR CODE: " << rc <<":" << sqlite3_errmsg(m_mzdbFile.db);
}
sqlite3_reset(m_mzdbFile.stmt);
m_runSliceCount++;
}
Expand All @@ -158,7 +160,12 @@ class mzBBInserter {
sqlite3_bind_double(m_mzdbFile.stmt, 5, moz + invBBheight);
sqlite3_bind_null(m_mzdbFile.stmt, 6);
sqlite3_bind_int(m_mzdbFile.stmt, 7, 1);
sqlite3_step(m_mzdbFile.stmt);
int rc = sqlite3_step(m_mzdbFile.stmt);
if (rc != SQLITE_DONE) {
LOG(ERROR) << "Error inserting run slice, request was:";
LOG(INFO) << "INSERT INTO run_slice VALUES (" << m_runSliceCount << ", " << msLevel << ", " << m_runSliceCount << ", " << moz << ", " << (moz+invBBheight) << ", null, 1);";
LOG(ERROR) << "SQLITE ERROR CODE: " << rc <<":" << sqlite3_errmsg(m_mzdbFile.db);
}
sqlite3_reset(m_mzdbFile.stmt);
m_runSliceCount++;
}
Expand Down
9 changes: 4 additions & 5 deletions pwiz_mzdb/mzdb/writer/dda_consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class mzDDAConsumer: QueueingPolicy, mzSpectrumInserter, mzBBInserter {

private:
// list of all possible data encodings, those who are really used will be inserted on the fly in spectrum_inserter.h
vector<DataEncoding> m_dataEncodings;

public:

/**
Expand Down Expand Up @@ -106,9 +106,9 @@ class mzDDAConsumer: QueueingPolicy, mzSpectrumInserter, mzBBInserter {
const int& msLevel = cycleCollection->msLevel;

// TODO check if spectra are correctly inserted (spectrum values are distinguished for PROFILE and CENTROID/FITTED)
this->buildAndInsertData<h_mz_t, h_int_t, l_mz_t, l_int_t>(msLevel, bbMzWidthByMsLevel[msLevel],
highResSpectra, lowResSpectra, runSlices[msLevel]);

double bbMzWidth = (msLevel == 1 ? bbMzWidthByMsLevel[1] : bbMzWidthByMsLevel[2]);
this->buildAndInsertData<h_mz_t, h_int_t, l_mz_t, l_int_t>(msLevel, bbMzWidth, highResSpectra, lowResSpectra, runSlices[msLevel]);
int newPercent = (int) (((float) progressionCount / nscans * 100.0));
if (newPercent == lastPercent + 2.0) {
mzdb::printProgBar(newPercent);
Expand All @@ -128,7 +128,6 @@ class mzDDAConsumer: QueueingPolicy, mzSpectrumInserter, mzBBInserter {
mzParamsCollecter& paramsCollecter,
pwiz::msdata::CVID rawFileFormat,
vector<DataEncoding> dataEncodings):
m_dataEncodings(dataEncodings),
QueueingPolicy(queue),
mzSpectrumInserter(mzdbFile, paramsCollecter, rawFileFormat, dataEncodings),
mzBBInserter(mzdbFile) {}
Expand Down
9 changes: 3 additions & 6 deletions pwiz_mzdb/mzdb/writer/mzdb_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,9 @@ class mzDBWriter: private boost::noncopyable {
bbHeightManager[1] = invms1;
bbWidthManager[1] = m_mzdbFile.bbWidth;

// TODO check if it works: MAX_MS used to be fixed at 2 so this loop was never used before !!
//for (int msnb = 2; msnb <= MAX_MS; ++msnb) {
for (int msnb = 2; msnb <= max_ms_level; ++msnb) {
bbHeightManager[msnb] = invmsn;
bbWidthManager[msnb] = m_mzdbFile.bbWidthMsn;
}
// use a single value for every MS level > 1
bbHeightManager[2] = invmsn;
bbWidthManager[2] = m_mzdbFile.bbWidthMsn;

//---begin a new transaction
sqlite3_exec(m_mzdbFile.db, "BEGIN;", 0, 0, 0);
Expand Down

0 comments on commit 232bba1

Please sign in to comment.