Skip to content

Commit

Permalink
Merge branch 'alpha_hotfixes' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhra-agrawal committed Jul 24, 2019
2 parents 406f637 + 6692d12 commit fed910d
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 58 deletions.
4 changes: 2 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ after_build:
if ( -Not (Test-Path $BIN -PathType Container) ) { mkdir $BIN }
cd $BIN ; rm -Recurse -Force *
$excludes = "linux","node","node_bin","node_modules","node.exe","MavenTests.exe"
$excludes = "linux","node","node_bin","node.exe","MavenTests.exe"
Get-ChildItem $ELMAVEN_BIN |
Where-Object{$_.Name -notin $excludes} |
Copy-Item -Destination $BIN -Recurse -Force
Expand Down Expand Up @@ -186,7 +186,7 @@ after_build:
# copy node
echo "Copying node requirements ..."
Get-ChildItem -Path $NODE_WIN | Move-Item -Destination $BIN
robocopy $NODE_WIN $BIN /e /copyall > $null
# expose pre-installed Qt Installer Framework binaries
$env:PATH="C:\Qt\QtIFW-3.0.1\bin;$env:PATH"
Expand Down
1 change: 0 additions & 1 deletion src/gui/mzroll/alignmentdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ void AlignmentDialog::setWorkerThread(BackgroundPeakUpdate* alignmentWorkerThrea
void AlignmentDialog::samplesAligned(bool status)
{
_mw->samplesAlignedFlag = status;
UndoAlignment->setEnabled(status);
}

void AlignmentDialog::updateRestoreStatus()
Expand Down
69 changes: 33 additions & 36 deletions src/gui/mzroll/forms/masscalcwidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,17 @@
<item>
<widget class="QLineEdit" name="precursorMz">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
Expand Down Expand Up @@ -86,7 +92,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>20</width>
<height>20</height>
</size>
</property>
Expand Down Expand Up @@ -138,6 +144,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
Expand All @@ -148,6 +160,12 @@
</item>
<item>
<widget class="QDoubleSpinBox" name="precursorPpm">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<double>10000.000000000000000</double>
</property>
Expand All @@ -171,13 +189,25 @@
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Fragment PPM</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="fragPpm">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="value">
<double>20.000000000000000</double>
</property>
Expand All @@ -189,7 +219,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -199,39 +229,6 @@
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Ionization</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="ionization">
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>-99.000000000000000</double>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
Expand Down
1 change: 0 additions & 1 deletion src/gui/mzroll/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,6 @@ void MainWindow::setIonizationModeLabel() {

ionizationModeLabel->setText(ionMode);

massCalcWidget->setCharge(mode);
isotopeWidget->setCharge(mode);
setTotalCharge();
}
Expand Down
31 changes: 22 additions & 9 deletions src/gui/mzroll/masscalcgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,27 @@ MassCalcWidget::MassCalcWidget(MainWindow* mw) {
setupUi(this);
_mw = mw;
_mz = 0;
setCharge(-1);
_currentGroup = nullptr;
_currentScan = nullptr;
setMassCutoff(mw->getUserMassCutoff());

database->addItem("All");

connect(computeButton, SIGNAL(clicked(bool)), SLOT(compute()));
connect(database, SIGNAL(currentIndexChanged(int)), SLOT(showTable()));
connect(precursorMz,SIGNAL(returnPressed()),SLOT(compute()));
connect(ionization,SIGNAL(valueChanged(double)),SLOT(compute()));
connect(precursorPpm,SIGNAL(valueChanged(double)),SLOT(compute()));
connect(mTable, SIGNAL(itemSelectionChanged()), SLOT(_showInfo()));
connect(fragPpm, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [&] {
if (_currentGroup) {
auto newGroup = new PeakGroup(*_currentGroup);
setPeakGroup(newGroup);
} else if (_currentScan) {
auto newScan = new Scan(nullptr, -1, 1, 0.0f, 0.0f, -1);
newScan->deepcopy(_currentScan);
setFragmentationScan(newScan);
}
});
}

void MassCalcWidget::setMass(float mz) {
Expand All @@ -38,11 +48,6 @@ void MassCalcWidget::setMass(float mz) {
showTable();
}

void MassCalcWidget::setCharge(float charge) {

ionization->setValue(charge);
_charge=charge;
}
void MassCalcWidget::setMassCutoff(MassCutoff *massCutoff) { precursorPpm->setValue(massCutoff->getMassCutoff()); _massCutoff=massCutoff;
precursorPpm->setValue(massCutoff->getMassCutoff());
string massCutoffType=massCutoff->getMassCutoffType();
Expand All @@ -54,10 +59,8 @@ void MassCalcWidget::setMassCutoff(MassCutoff *massCutoff) { precursorPpm->setVa
void MassCalcWidget::compute() {
bool isDouble =false;
_mz = precursorMz->text().toDouble(&isDouble);
_charge = ionization->value();
_massCutoff->setMassCutoff(precursorPpm->value());
if (!isDouble) return;
cerr << "massCalcGui:: compute() " << _charge << " " << _mz << endl;

_mw->setStatusText("Searching for formulas..");
getMatches();
Expand Down Expand Up @@ -180,7 +183,12 @@ void MassCalcWidget::setPeakGroup(PeakGroup* grp) {
if(!grp)
return;

if (_currentGroup)
delete _currentGroup;
_currentGroup = new PeakGroup(*grp);

_mz = grp->meanMz;
precursorMz->setText(QString(to_string(_mz).c_str()));
getMatches();

if(grp->ms2EventCount == 0)
Expand All @@ -204,6 +212,11 @@ void MassCalcWidget::setFragmentationScan(Scan* scan) {
if(!scan)
return;

if (_currentScan)
delete _currentScan;
_currentScan = new Scan(nullptr, -1, 1, 0.0f, 0.0f, -1);
_currentScan->deepcopy(scan);

Fragment f(scan, 0, 0, 1024);
_mz = scan->precursorMz;
getMatches();
Expand Down
8 changes: 4 additions & 4 deletions src/gui/mzroll/masscalcgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class MassCalcWidget: public QDockWidget, public Ui_MassCalcWidget {

public Q_SLOTS:
void setMass(float mz);
void setCharge(float charge);
void setMassCutoff(MassCutoff *massCutoff);
void compute();
QSet<Compound*> findMathchingCompounds(float mz, MassCutoff *massCutoff, float charge);
Expand All @@ -44,9 +43,10 @@ private Q_SLOTS:
std::vector< MassCalculator::Match* > matches;
std::vector<Compound*> sortedcompounds;

double _mz;
double _charge;
MassCutoff* _massCutoff;
double _mz;
MassCutoff* _massCutoff;
PeakGroup* _currentGroup;
Scan* _currentScan;

void pubChemLink(QString formula);
void keggLink(QString formula);
Expand Down
14 changes: 9 additions & 5 deletions src/gui/mzroll/spectrawidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,12 @@ void SpectraWidget::overlaySpectralHit(SpectralHit& hit)
MassCutoff* productMassCutoff = new MassCutoff();
productMassCutoff->setMassCutoffAndType(hit.productPPM, "ppm");
int pos = _currentScan->findHighestIntensityPos(hit.precursorMz, productMassCutoff);
if(pos >= 0) {
if (pos >= 0) {
_focusCoord.setX(hit.precursorMz);
_focusCoord.setY(_currentScan->intensity[pos]);
} else {
_focusCoord.setX(0.0f);
_focusCoord.setY(0.0f);
}
delete productMassCutoff;
}
Expand Down Expand Up @@ -563,7 +566,8 @@ void SpectraWidget::drawScan(Scan* scan, QColor sampleColor)
sline->addPoint(x, y);
}

if (abs(scan->mz[j] - _focusedMz) < 0.005) {
if (!mzUtils::almostEqual(_focusedMz, 0.0f)
&& abs(scan->mz[j] - _focusedMz) < 0.005) {
QPen redpen(Qt::red, 3);
QGraphicsLineItem* line = new QGraphicsLineItem(x, y, x, yzero, 0);
scene()->addItem(line);
Expand Down Expand Up @@ -929,14 +933,12 @@ void SpectraWidget::setMzFocus(float mz)
if(pos >= 0) {
float bestMz = _currentScan->mz[pos];
mainwindow->setMzValue(bestMz);
mainwindow->massCalcWidget->setCharge(_currentScan->getPolarity());
mainwindow->massCalcWidget->setMass(bestMz);
}

} else if (_currentScan->mslevel == 2 && _currentScan->precursorMz > 0) {
float bestMz = _currentScan->precursorMz;
mainwindow->setMzValue(bestMz);
mainwindow->massCalcWidget->setCharge(_currentScan->getPolarity());
mainwindow->massCalcWidget->setMass(bestMz);

} else if (!_currentScan->filterLine.empty()) {
Expand Down Expand Up @@ -965,7 +967,6 @@ void SpectraWidget::setMzFocus(float mz)
float bestMz = _currentScan->mz[bestMatch];
mainwindow->setMzValue(bestMz);
mainwindow->massCalcWidget->setCharge(_currentScan->getPolarity());
mainwindow->massCalcWidget->setMass(bestMz);
//mainwindow->massCalc->compute();
}
Expand Down Expand Up @@ -1034,6 +1035,9 @@ int SpectraWidget::findNearestMz(QPointF pos)

void SpectraWidget::drawArrow(float mz1, float intensity1, float mz2, float intensity2)
{
if (mzUtils::almostEqual(static_cast<float>(_focusCoord.x()), 0.0f))
return;

float SCALE = 1.0;
float OFFSET = 0;
if (_showOverlay) {
Expand Down

0 comments on commit fed910d

Please sign in to comment.