Skip to content

Commit

Permalink
add toggle to switch between normal/log intensity specta
Browse files Browse the repository at this point in the history
support "RT:" retention time flag in NIST formted files
  • Loading branch information
eugenemel committed May 18, 2017
1 parent b929401 commit f8815ca
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
6 changes: 4 additions & 2 deletions database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,9 @@ vector<Compound*> Database::loadNISTLibrary(QString fileName) {
if(!id.isEmpty()) cpd->id = id.toStdString();
} else if (line.startsWith("LOGP:",Qt::CaseInsensitive)) {
cpd->logP = line.mid(5,line.length()).simplified().toDouble();
} else if (line.startsWith("SMILE:",Qt::CaseInsensitive)) {
} else if (line.startsWith("RT:",Qt::CaseInsensitive)) {
cpd->expectedRt= line.mid(3,line.length()).simplified().toDouble();
} else if (line.startsWith("SMILE:",Qt::CaseInsensitive)) {
QString smileString = line.mid(7,line.length()).simplified();
if(!smileString.isEmpty()) cpd->smileString=smileString.toStdString();
} else if (line.startsWith("PRECURSORMZ:",Qt::CaseInsensitive)) {
Expand All @@ -572,7 +574,7 @@ vector<Compound*> Database::loadNISTLibrary(QString fileName) {
} else if (line.startsWith("ion mode:",Qt::CaseInsensitive)) {
if(line.contains("neg",Qt::CaseInsensitive)) cpd->ionizationMode=-1;
if(line.contains("pos",Qt::CaseInsensitive)) cpd->ionizationMode=+1;
} else if (line.startsWith("Comment:",Qt::CaseInsensitive)) {

QString comment = line.mid(8,line.length()).simplified();
if (comment.contains(formulaMatch)){
cpd->formula=formulaMatch.capturedTexts().at(1).toStdString();
Expand Down
12 changes: 12 additions & 0 deletions spectrawidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SpectraWidget::SpectraWidget(MainWindow* mw) {
this->mainwindow = mw;
_currentScan = NULL;
_avgScan = NULL;
_log10Transform=false;

initPlot();

Expand Down Expand Up @@ -71,6 +72,9 @@ void SpectraWidget::setCurrentScan(Scan* scan) {
//}
links.clear();
_currentScan->deepcopy(scan);
if(_log10Transform) {
_currentScan->log10Transform();
}
}
}

Expand Down Expand Up @@ -826,6 +830,8 @@ void SpectraWidget::resetZoom() {
replot();
}



void SpectraWidget::zoomIn() {
float D = (_maxX-_minX)/2;
if (D < 0.5 ) return;
Expand Down Expand Up @@ -866,6 +872,12 @@ void SpectraWidget::contextMenuEvent(QContextMenuEvent * event) {
QAction* a1 = menu.addAction("Go To Scan");
connect(a1, SIGNAL(triggered()), SLOT(gotoScan()));

QAction* a6 = menu.addAction("Log10 Transform");
a6->setCheckable(true);
a6->setChecked(_log10Transform);
connect(a6, SIGNAL(toggled(bool)), SLOT(setLog10Transform(bool)));
connect(a6, SIGNAL(toggled(bool)), SLOT(resetZoom()));

QAction* a3b = menu.addAction("Find Similar Scans");
connect(a3b, SIGNAL(triggered()), SLOT(findSimilarScans()));

Expand Down
2 changes: 2 additions & 0 deletions spectrawidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public slots:
void zoomOut();
void setProfileMode() { _profileMode=true; }
void setCentroidedMode() { _profileMode=false; }
void setLog10Transform(bool flag) { _log10Transform=flag; }
void setCurrentScan(Scan* scan);
void constructAverageScan(float rtmin, float rtmax);
void findSimilarScans();
Expand All @@ -59,6 +60,7 @@ public slots:
bool _resetZoomFlag;
bool _profileMode;
bool _showOverlay;
bool _log10Transform;

float _minX;
float _maxX;
Expand Down

0 comments on commit f8815ca

Please sign in to comment.