Skip to content

Commit

Permalink
[Fix] Add prompt to confirm MS/MS type ElucidataInc#1347
Browse files Browse the repository at this point in the history
When loading a sample having MS1 and MS2 scans El-MAVEN has no way
of being able to tell whether these samples were from a DDA or a
PRM experiment. From now on, an input dialog will ask the user to
confirm the MS/MS data type, whenever they load such samples. For
now, this prevents MS2 events logic from interfering with PRM data
analysis. It could potentially help with other things in the
future.
  • Loading branch information
saif-el committed Mar 3, 2021
1 parent 4a96785 commit de5ca4c
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/core/libmaven/PeakGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,10 @@ vector<Scan*> PeakGroup::getFragmentationEvents()
mzSample* sample = peak.getSample();
if (sample == nullptr)
continue;
if (sample->ms2ScanCount() == 0)
if (sample->ms2ScanCount() == 0
|| sample->msMsType() != mzSample::MsMsType::DDA) {
continue;
}

mzSlice slice(minMz, maxMz, peak.rtmin, peak.rtmax);
vector<Scan*> scans = sample->getFragmentationEvents(&slice);
Expand Down
1 change: 1 addition & 0 deletions src/core/libmaven/mzSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ mzSample::mzSample() : _setName(""), injectionOrder(0)
_id = -1;
_numMS1Scans = 0;
_numMS2Scans = 0;
_msMsType = MsMsType::None;
maxMz = maxRt = 0;
minMz = minRt = 0;
isBlank = false;
Expand Down
11 changes: 10 additions & 1 deletion src/core/libmaven/mzSample.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,13 @@ class mzLink
*/
class mzSample
{
public:
enum class MsMsType {
DDA,
PRM,
None
};

public:
/**
* @brief Constructor for class mzSample
*/
Expand Down Expand Up @@ -681,6 +686,9 @@ class mzSample

vector<float> getIntensityDistribution(int mslevel);

inline void setMsMsType(MsMsType msMsType) { _msMsType = msMsType; }
inline MsMsType msMsType() const { return _msMsType; }

deque<Scan *> scans;
string sampleName;
string fileName;
Expand Down Expand Up @@ -728,6 +736,7 @@ class mzSample
int _id;
unsigned int _numMS1Scans;
unsigned int _numMS2Scans;
MsMsType _msMsType;

void sampleNaming(const char *filename);
void checkSampleBlank(const char *filename);
Expand Down
6 changes: 5 additions & 1 deletion src/gui/mzroll/eicwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2120,7 +2120,11 @@ void EicWidget::addMS2Events(float mzmin, float mzmax)

int count = 0;
for (auto const& sample : samples) {
if (sample->ms1ScanCount() == 0) continue;
if (sample->ms1ScanCount() == 0
|| sample->msMsType() != mzSample::MsMsType::DDA) {
continue;
}

for (auto const& scan : sample->scans) {
if (scan->mslevel == 2 && scan->precursorMz >= mzmin
&& scan->precursorMz <= mzmax) {
Expand Down
42 changes: 39 additions & 3 deletions src/gui/mzroll/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,10 @@ using namespace mzUtils;
SIGNAL(sampleLoaded()),
this,
SLOT(_warnIfNISTPolarityMismatch()));
connect(fileLoader,
&mzFileIO::sampleLoaded,
this,
&MainWindow::_confirmMsMsType);

connect(fileLoader,SIGNAL(sampleLoaded()), this, SLOT(setInjectionOrderFromTimeStamp()));
connect(fileLoader,SIGNAL(sampleLoaded()),projectDockWidget, SLOT(updateSampleList()));
Expand Down Expand Up @@ -1543,8 +1547,6 @@ void MainWindow::setCompoundFocus(Compound* compound,
if (fragPanel->isVisible())
showFragmentationScans(mz);

QString compoundName(compound->name().c_str());

if (compound)
setUrl(compound);
}
Expand Down Expand Up @@ -2143,6 +2145,38 @@ void MainWindow::_warnIfNISTPolarityMismatch()
}
}

void MainWindow::_confirmMsMsType()
{
QList<mzSample*> msMsSamples;
for (auto sample : samples) {
if (sample->ms1ScanCount() > 0 && sample->ms2ScanCount() > 0)
msMsSamples.append(sample);
}

if (msMsSamples.isEmpty())
return;

// TODO: add DIA when/if SWATH branch is merged
QStringList msMsTypes;
msMsTypes << tr("DDA") << tr("PRM");

QString type = QInputDialog::getItem(this,
tr("Select MS/MS type"),
tr("One or more samples have MS/MS "
"data. Please tell El-MAVEN the\n"
"acquisition type of this data:"),
msMsTypes,
0,
false);
for (auto sample : msMsSamples) {
if (type == "PRM") {
sample->setMsMsType(mzSample::MsMsType::PRM);
} else {
sample->setMsMsType(mzSample::MsMsType::DDA);
}
}
}

void MainWindow::setLastLoadedDatabase(QString filename)
{
QFileInfo fileInfo(filename);
Expand Down Expand Up @@ -4002,8 +4036,10 @@ void MainWindow::showFragmentationScans(float pmz)
return;
fragPanel->clearTree();
for (auto sample : samples) {
if (sample->ms1ScanCount() == 0)
if (sample->ms1ScanCount() == 0
|| sample->msMsType() != mzSample::MsMsType::DDA) {
continue;
}

for (auto scan : sample->scans) {
if (scan->mslevel != 2) continue;
Expand Down
1 change: 1 addition & 0 deletions src/gui/mzroll/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ private Q_SLOTS:

void _postProjectLoadActions();
void _handleUnrecognizedProjectVersion(QString projectFilename);
void _confirmMsMsType();

private:
Controller* _controller;
Expand Down
5 changes: 3 additions & 2 deletions src/gui/mzroll/peakdetectiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,9 @@ void PeakDetectionDialog::toggleFragmentation()
auto iter = find_if(begin(samples),
end(samples),
[](mzSample* s) {
return ((s->ms1ScanCount() > 0)
&& (s->ms2ScanCount() > 0));
return (s->ms1ScanCount() > 0
&& s->ms2ScanCount() > 0
&& s->msMsType() == mzSample::MsMsType::DDA);
});
bool foundDda = iter != end(samples);

Expand Down

0 comments on commit de5ca4c

Please sign in to comment.