Skip to content

Commit

Permalink
development version 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiri Novak committed May 11, 2018
1 parent 331e441 commit 2e3d4db
Show file tree
Hide file tree
Showing 38 changed files with 1,014 additions and 289 deletions.
2 changes: 1 addition & 1 deletion CycloBranch/CycloBranch.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<SubSystem>Console</SubSystem>
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(QTDIR)\lib;C:\boost_1_57_0\lib64-msvc-11.0;C:\xerces-c-3.1.1\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
Expand Down
2 changes: 1 addition & 1 deletion CycloBranch/External/windows/any2mgf.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
SET PATH=%PATH%
SET PATH=%PATH:C:\Xcalibur\system\programs;=%
FileConverter.exe -in %1 -out %1.mgf
11 changes: 11 additions & 0 deletions CycloBranch/External/windows/baf2profile.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo off
set PATH=%PATH%
del "%~f1_converted*.csv" 2>NUL
del "%~f1.profile.*.csv" 2>NUL
"%programfiles(x86)%\Bruker Daltonik\CompassXport\CompassXport.exe" -mode 4 -raw 1 -a "%~f1" -o "%~f1_converted" 1>NUL
setlocal enabledelayedexpansion
set count=0
for %%i in ("%~f1_converted_*.csv") do (
set /a count=!count!+1
move "%%i" "%~f1.profile.!count!.csv" 1>NUL
)
2 changes: 1 addition & 1 deletion CycloBranch/External/windows/mis2csv.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ del "%~f1.baf.txt" 2>NUL

for /R %%f in (analysis.baf) do if exist "%%f" (
del "%%f_converted*.csv" 2>NUL
CompassXport.exe -mode 4 -a "%%f" -o "%%f_converted" 1>NUL
"%programfiles(x86)%\Bruker Daltonik\CompassXport\CompassXport.exe" -mode 4 -a "%%f" -o "%%f_converted" 1>NUL
(type "%%f_converted*.csv" 2>NUL) >> "%~f1.baf.csv"
del "%%f_converted*.csv" 2>NUL
)
Expand Down
2 changes: 1 addition & 1 deletion CycloBranch/External/windows/raw2peaks.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off
SET PATH=%PATH%
SET PATH=%PATH:C:\Xcalibur\system\programs;=%

(type NUL 2>NUL) > "%~1mgf"
for %%f in ("%~d1%~p1%~n1.00*.mgf") do (
Expand Down
2 changes: 1 addition & 1 deletion CycloBranch/External/windows/ser2csv.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ del "%~f1.txt" 2>NUL

for /R %%f in (fid) do if exist "%%f" (
del "%%f_converted*.csv" 2>NUL
CompassXport.exe -mode 4 -a "%%f" -o "%%f_converted" -raw 1 1>NUL
"%programfiles(x86)%\Bruker Daltonik\CompassXport\CompassXport.exe" -mode 4 -a "%%f" -o "%%f_converted" -raw 1 1>NUL
(type "%%f_converted*.csv" 2>NUL) >> "%~f1.csv"
del "%%f_converted*.csv" 2>NUL
echo %%f >> "%~f1.txt"
Expand Down
44 changes: 40 additions & 4 deletions CycloBranch/core/cParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ void cParameters::clear() {
iondefinitions.recalculateFragments(false, false, s);
peptidetype = linear;
peaklistfilename = "";
useprofiledata = false;
convertprofiledata = true;
peaklistfileformat = txt;
peaklistseries.clear();
scannumber = 1;
Expand Down Expand Up @@ -242,7 +244,9 @@ int cParameters::checkAndPrepare(bool& terminatecomputation) {
break;
case baf:
#if OS_TYPE == WIN
*os << "Converting the file " + peaklistfilename + " ... ";
*os << "Processing the file " + peaklistfilename + ":" << endl;

*os << "centroid spectra ... ";
s = "External\\windows\\baf2csv.bat \"" + peaklistfilename + "\"";
if (system(s.c_str()) != 0) {
error = true;
Expand All @@ -255,18 +259,39 @@ int cParameters::checkAndPrepare(bool& terminatecomputation) {
}

if (!error) {
*os << "ok" << endl << endl;
*os << "ok" << endl;
peakliststream.open(peaklistfilename + ".csv");
}

if (useprofiledata && convertprofiledata) {
*os << "profile spectra ... ";
s = "External\\windows\\baf2profile.bat \"" + peaklistfilename + "\"";
if (system(s.c_str()) != 0) {
error = true;
errormessage = "The file cannot be converted.\n";
errormessage += "Does the file '" + peaklistfilename + "' exist ?\n";
errormessage += "Do you have Bruker Daltonik's CompassXport installed ?\n";
errormessage += "Do you have path to the CompassXport.exe in your PATH variable ?\n";
errormessage += "Is the directory with the file '" + peaklistfilename + "' writable ?\n";
errormessage += "Do you have 'baf2profile.bat' file located in the 'External/windows' folder ?\n";
}

if (!error) {
*os << "ok" << endl;
}
}

*os << endl;
#endif
break;
case raw:
#if OS_TYPE == WIN
* os << "Converting the file " + peaklistfilename + " ... ";
*os << "Converting the file " + peaklistfilename + " ... ";
s = "External\\windows\\raw2mzml.bat \"" + peaklistfilename + "\"";
if (system(s.c_str()) != 0) {
error = true;
errormessage = "The file cannot be converted.\n";
errormessage += "Is the file '" + peaklistfilename + "' opened elsewhere ?\n";
errormessage += "Does the file '" + peaklistfilename + "' exist ?\n";
errormessage += "Is the directory with the file '" + peaklistfilename + "' writable ?\n";
errormessage += "Do you have msconvert.exe installed (OpenMS 2.x including ProteoWizard must be installed) ?\n";
Expand Down Expand Up @@ -753,7 +778,7 @@ string cParameters::printToString() {
s += "De Novo Search Engine";
break;
case singlecomparison:
s += "Compare Peaklist with Spectrum of Searched Sequence";
s += "Compare Peaklist(s) with Spectrum of Searched Sequence";
break;
case databasesearch:
s += "Compare Peaklist with Database - MS/MS data";
Expand Down Expand Up @@ -797,6 +822,11 @@ string cParameters::printToString() {
s += "\n";

s += "File: " + peaklistfilename + "\n";

s += "Use Profile Data: ";
s += useprofiledata ? "on" : "off";
s += "\n";

s += "Scan no.: " + to_string(scannumber) + "\n";
s += "Precursor m/z Ratio: " + to_string(precursormass) + "\n";
s += "Precursor Ion Adduct: " + precursoradduct + "\n";
Expand Down Expand Up @@ -1130,6 +1160,9 @@ void cParameters::store(ofstream& os) {
os.write((char *)&peaklistfileformat, sizeof(ePeakListFileFormat));
peaklistseries.store(os);

os.write((char *)&useprofiledata, sizeof(bool));
os.write((char *)&convertprofiledata, sizeof(bool));

os.write((char *)&scannumber, sizeof(int));
os.write((char *)&precursormass, sizeof(double));

Expand Down Expand Up @@ -1251,6 +1284,9 @@ void cParameters::load(ifstream& is) {
is.read((char *)&peaklistfileformat, sizeof(ePeakListFileFormat));
peaklistseries.load(is);

is.read((char *)&useprofiledata, sizeof(bool));
is.read((char *)&convertprofiledata, sizeof(bool));

is.read((char *)&scannumber, sizeof(int));
is.read((char *)&precursormass, sizeof(double));

Expand Down
12 changes: 12 additions & 0 deletions CycloBranch/core/cParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ class cParameters {
string peaklistfilename;


/**
\brief Use profile data.
*/
bool useprofiledata;


/**
\brief Convert profile data.
*/
bool convertprofiledata;


/**
\brief A file format of peak list.
*/
Expand Down
23 changes: 21 additions & 2 deletions CycloBranch/core/cPeakListSeries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ void cPeakListSeries::clear() {
}


void cPeakListSeries::resize(int size) {
peaklists.resize(size);
}


void cPeakListSeries::addPeakList(cPeaksList& peaklist) {
peaklists.push_back(peaklist);
}
Expand Down Expand Up @@ -193,7 +198,14 @@ int cPeakListSeries::loadFromMZMLStream(string& mzmlfilename, ifstream &mzmlstre
string convertedmzmlfilename;
string mgfname = mzmlfilename.substr(0, (int)mzmlfilename.size() - 4);

*os << "ok" << endl << "Total number of spectra: " << peaklists.size() << endl << endl << "Converting raw data to peaklists... ";
*os << "ok" << endl;
if (mode == dereplication) {
*os << "Total number of MS spectra: ";
}
else {
*os << "Total number of MS/MS spectra: ";
}
*os << peaklists.size() << endl << endl << "Converting raw data to peaklists... ";

string s;
#if OS_TYPE == UNX
Expand Down Expand Up @@ -240,7 +252,14 @@ int cPeakListSeries::loadFromMZMLStream(string& mzmlfilename, ifstream &mzmlstre
}
else {

*os << "ok" << endl << endl;
*os << "ok" << endl;
if (mode == dereplication) {
*os << "Total number of MS spectra: ";
}
else {
*os << "Total number of MS/MS spectra: ";
}
*os << peaklists.size() << endl << endl;

}

Expand Down
7 changes: 7 additions & 0 deletions CycloBranch/core/cPeakListSeries.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ class cPeakListSeries {
void clear();


/**
\brief Resize the peaklist series.
\param size new size
*/
void resize(int size);


/**
\brief Add a peaklist.
\param peaklist peaklist which will be added
Expand Down
26 changes: 26 additions & 0 deletions CycloBranch/core/cPeaksList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,13 @@ int cPeaksList::normalizeIntenzity() {
}

double maximum = 0.0f;

for (int i = 0; i < (int)peaks.size(); i++) {
if (peaks[i].absoluteintensity > maximum) {
maximum = peaks[i].absoluteintensity;
}
}

if (maximum > 0) {
for (int i = 0; i < (int)peaks.size(); i++) {
peaks[i].relativeintensity = peaks[i].absoluteintensity/maximum*100.0f;
Expand All @@ -362,6 +364,19 @@ int cPeaksList::normalizeIntenzity() {
}


void cPeaksList::normalizeIntenzityByValue(double value) {
if (peaks.size() == 0) {
return;
}

if (value > 0) {
for (int i = 0; i < (int)peaks.size(); i++) {
peaks[i].relativeintensity = peaks[i].absoluteintensity / value * 100.0f;
}
}
}


void cPeaksList::cropRelativeIntenzity(double minimumrelativeintensitythreshold) {
sortbyRelativeIntensityDesc();

Expand Down Expand Up @@ -696,6 +711,17 @@ double cPeaksList::getMaximumAbsoluteIntensityFromMZInterval(double minmz, doubl
}


double cPeaksList::getMaximumAbsoluteIntensity() {
double intensity = 0;
for (int i = 0; i < (int)peaks.size(); i++) {
if (peaks[i].absoluteintensity > intensity) {
intensity = peaks[i].absoluteintensity;
}
}
return intensity;
}


void cPeaksList::setCoordinates(int x, int y) {
this->x = x;
this->y = y;
Expand Down
14 changes: 14 additions & 0 deletions CycloBranch/core/cPeaksList.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ class cPeaksList {
int normalizeIntenzity();


/**
\brief Normalize intensities of peaks using a value.
\param value normalization value
*/
void normalizeIntenzityByValue(double value);


/**
\brief Remove peaks with relative intensities lower than the threshold.
\param minimumrelativeintensitythreshold minimum threshold of relative intensity
Expand Down Expand Up @@ -338,6 +345,13 @@ class cPeaksList {
double getMaximumAbsoluteIntensityFromMZInterval(double minmz, double maxmz, bool hidematched, bool hideunmatched, ePeptideType peptidetype, bool hidescrambled);


/**
\brief Get the maximum absolute intensity.
\retval double maximum absolute intensity
*/
double getMaximumAbsoluteIntensity();


/**
\brief Set the coordinates.
\param x X coordinate
Expand Down
2 changes: 1 addition & 1 deletion CycloBranch/core/cTheoreticalSpectrum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ void cTheoreticalSpectrum::removeUnmatchedIsotopePatterns(cPeaksList& theoretica
return;
}

int minimumenvelopepeaks = (parameters->mode == dereplication)?parameters->minimumpatternsize:1;
int minimumenvelopepeaks = parameters->minimumpatternsize;

int groupid = theoreticalpeaks[0].groupid;
int start = 0;
Expand Down
28 changes: 20 additions & 8 deletions CycloBranch/core/cTheoreticalSpectrumList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ int cTheoreticalSpectrumList::parallelCompareAndStore(cCandidateSet& candidates,
else {

cTheoreticalSpectrum t(parameters, (cCandidate &)(*candidates.getSet().begin()));
theoreticalspectra.push_back(t);
int cnt = parameters->peaklistseries.size();
for (int i = 0; i < cnt; i++) {
theoreticalspectra.push_back(t);
}

}

Expand All @@ -246,6 +249,7 @@ int cTheoreticalSpectrumList::parallelCompareAndStore(cCandidateSet& candidates,

// fill descriptions of peaks
cPeaksList unmatchedpeaksinmatchedpatterns;
cPeaksList tmppeaklist;
resultspectra.resize(theoreticalspectra.size());
for (int i = 0; i < (int)theoreticalspectra.size(); i++) {

Expand All @@ -257,24 +261,32 @@ int cTheoreticalSpectrumList::parallelCompareAndStore(cCandidateSet& candidates,

unmatchedpeaksinmatchedpatterns.clear();

if (parameters->mode == singlecomparison) {
tmppeaklist = parameters->peaklistseries[i];
tmppeaklist.sortbyMass();
}
else {
tmppeaklist = peaklist;
}

switch (parameters->peptidetype) {
case linear:
theoreticalpeaksrealsize = tsp.compareLinear(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence, unmatchedpeaksinmatchedpatterns, &isotopeformuladesctoid);
theoreticalpeaksrealsize = tsp.compareLinear(tmppeaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence, unmatchedpeaksinmatchedpatterns, &isotopeformuladesctoid);
break;
case cyclic:
theoreticalpeaksrealsize = tsp.compareCyclic(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence, unmatchedpeaksinmatchedpatterns, &isotopeformuladesctoid);
theoreticalpeaksrealsize = tsp.compareCyclic(tmppeaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence, unmatchedpeaksinmatchedpatterns, &isotopeformuladesctoid);
break;
case branched:
theoreticalpeaksrealsize = tsp.compareBranched(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence, unmatchedpeaksinmatchedpatterns, &isotopeformuladesctoid);
theoreticalpeaksrealsize = tsp.compareBranched(tmppeaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence, unmatchedpeaksinmatchedpatterns, &isotopeformuladesctoid);
break;
case branchcyclic:
theoreticalpeaksrealsize = tsp.compareBranchCyclic(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence, unmatchedpeaksinmatchedpatterns, &isotopeformuladesctoid);
theoreticalpeaksrealsize = tsp.compareBranchCyclic(tmppeaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence, unmatchedpeaksinmatchedpatterns, &isotopeformuladesctoid);
break;
case linearpolyketide:
theoreticalpeaksrealsize = tsp.compareLinearPolyketide(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence, unmatchedpeaksinmatchedpatterns, &isotopeformuladesctoid);
theoreticalpeaksrealsize = tsp.compareLinearPolyketide(tmppeaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence, unmatchedpeaksinmatchedpatterns, &isotopeformuladesctoid);
break;
case cyclicpolyketide:
theoreticalpeaksrealsize = tsp.compareCyclicPolyketide(peaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence, unmatchedpeaksinmatchedpatterns, &isotopeformuladesctoid);
theoreticalpeaksrealsize = tsp.compareCyclicPolyketide(tmppeaklist, *bricksdb, true, rxsequencetag, rxsearchedsequence, unmatchedpeaksinmatchedpatterns, &isotopeformuladesctoid);
break;
case other:
break;
Expand Down Expand Up @@ -412,7 +424,7 @@ double cTheoreticalSpectrumList::updatekNNList(cTheoreticalSpectrum& theoretical
break;
}

if ((currentscore == score) && (it1->getCandidate().getPath() == theoreticalspectrum.getCandidate().getPath())) {
if ((parameters->mode == denovoengine) && (currentscore == score) && (it1->getCandidate().getPath() == theoreticalspectrum.getCandidate().getPath())) {
if (!it1->isValid() && theoreticalspectrum.isValid()) {
*it1 = theoreticalspectrum;
it1->resizePeakList(theoreticalpeaksrealsize);
Expand Down
2 changes: 1 addition & 1 deletion CycloBranch/core/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


QString appname = "CycloBranch";
QString appversion = "v. 1.2.748 (64-bit)";
QString appversion = "v. 1.3.0 (64-bit)";


#if OS_TYPE == UNX
Expand Down
Loading

0 comments on commit 2e3d4db

Please sign in to comment.