From f251a889dd9458f15e88d80dfdf9736dbec332fd Mon Sep 17 00:00:00 2001 From: Long Date: Fri, 31 May 2024 13:34:30 -0500 Subject: [PATCH] www root set. atomic stage number added. --- ArchiveSearch/CSpectralArchive.cpp | 5 ++++- ArchiveSearch/CSpectralArchive.h | 3 +++ ArchiveSearch/spectroscapeMain.cpp | 6 ++++-- scripts/start_service.bash | 7 +++++++ 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100755 scripts/start_service.bash diff --git a/ArchiveSearch/CSpectralArchive.cpp b/ArchiveSearch/CSpectralArchive.cpp index ed0325e..d6931e9 100644 --- a/ArchiveSearch/CSpectralArchive.cpp +++ b/ArchiveSearch/CSpectralArchive.cpp @@ -188,7 +188,8 @@ CSpectralArchive::CSpectralArchive(string mzXMLList, string pepxml, string index bool usegpu, bool rebuildsqldb, int seedpvalue, const int topPeakNum, bool createfilenameBlackList, bool saveBackgroundScore, bool verbose, string archivename, string indexshuffleseeds, string gpuidx) : PeakNumPerSpec( - topPeakNum) { + topPeakNum), m_stage(STAGE_INIT) { + m_savebackgroundscore = saveBackgroundScore; // checking the parameters. if(mzXMLList.empty()){ @@ -311,6 +312,7 @@ void CSpectralArchive::createMzFileObject() { // get number of indices to be created, using indexstr, split by ';' // create multiIndices object. each corresponding to a file in multiIndices folder. void CSpectralArchive::createIndices(bool myOwnIndex, shared_ptr option, string &indexstrings, string indexshuffleseeds) { + m_stage = STAGE_TRAIN; int cnts = count(indexstrings.begin(), indexstrings.end(), ';') + 1; if (cnts > 6 and cnts < 1) { cout << "Error: invalid cnts " << cnts << endl; @@ -332,6 +334,7 @@ CSpectralArchive::~CSpectralArchive() {} void CSpectralArchive::update(string new_experimental_data, string new_search_result, string new_search_result_list, string new_experimental_datalist) { + m_stage = STAGE_UPDATE; updateIndex(m_verbose); bool newFilesAdded = false; addRawData(new_experimental_data, newFilesAdded); diff --git a/ArchiveSearch/CSpectralArchive.h b/ArchiveSearch/CSpectralArchive.h index 442107e..8b0c923 100644 --- a/ArchiveSearch/CSpectralArchive.h +++ b/ArchiveSearch/CSpectralArchive.h @@ -8,6 +8,7 @@ #include #include #include +#include using namespace std; class CAnnotationDB; class ICQuery; @@ -217,6 +218,8 @@ class CSpectralArchive { int m_tol; int m_minPeakNum; bool m_usegpu; + std::atomic_int m_stage; + enum Archive_Stage {STAGE_ANNOTATION, STAGE_TRAIN, STAGE_ADD, STAGE_INIT, STAGE_INDEX, STAGE_SEARCH, STAGE_UPDATE}; public: CSpectralArchive(string mzXMLList, string pepxml, string indexfile, bool removeprecursor, bool useflankingbins, int tol, int minPeakNum, bool myOwnIndex, CPQParam option, string indexstrings, bool usegpu, diff --git a/ArchiveSearch/spectroscapeMain.cpp b/ArchiveSearch/spectroscapeMain.cpp index a03d03c..40b7446 100644 --- a/ArchiveSearch/spectroscapeMain.cpp +++ b/ArchiveSearch/spectroscapeMain.cpp @@ -35,8 +35,10 @@ void sigint_handler(int signal) { std::cout << "Force to exit Spectroscape." << std::endl; exit(0); } - std::cout << "Please wait for a few seconds for Spectroscape save data and exit safely.\n" << std::endl; - std::cout << "To stop Spectroscape immediately, press ctrl-c again .\n" << std::endl; + std::cout << "If spectroscape is adding new raw data files, please wait for a few seconds for Spectroscape save data and exit safely.\n" << std::endl; + std::cout << "Otherwise, to stop Spectroscape immediately, press ctrl-c again .\n" << std::endl; + std::cout << "Attention:" << std::endl; + std::cout << "Forced interruption when adding new data files to archive can results in corrupted files. A fresh building is required. " << std::endl; } boost::program_options::variables_map getParam(int argc, char *argv[]) { diff --git a/scripts/start_service.bash b/scripts/start_service.bash new file mode 100755 index 0000000..99d7cb0 --- /dev/null +++ b/scripts/start_service.bash @@ -0,0 +1,7 @@ +#!/bin/bash + + +archive_path="$HOME/data/spectroscape/spectral_archives_latest" +bin_path="$HOME/code/SpectralArchive/build/bin/spectroscape" +wwwroot_path="`dirname $bin_path`/../www" +cd $archive_path && spawn-fcgi -p 8710 -n -- $bin_path --run --wwwroot $wwwroot_path \ No newline at end of file