Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/raw-rev/818263bbcd1a
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 07:52:12 2012
Кодировка:

# HG changeset patch
# User Boris Nagaev
# Date 1330725166 -14400
# Node ID 818263bbcd1a46b21c7fb2b538e590adf7c37449
# Parent e8c9f0a3482ecabe2ec334bf6b242cb50a6c59cf
add web interface for pair-cores

It needs some fixes. At least, it is compilable.

diff -r e8c9f0a3482e -r 818263bbcd1a .hgignore
--- a/.hgignore Sat Mar 03 16:05:58 2012 +0400
+++ b/.hgignore Sat Mar 03 01:52:46 2012 +0400
@@ -31,6 +31,10 @@
blocks3d/wt/files/resources
blocks3d/html.htm
pair_cores/html.htm
+pair_cores/web/wc
+pair_cores/web/*.o
+pair_cores/web/*root
+pair_cores/web/pair-cores.wt
*.zip

# Temporary files from sphinx
diff -r e8c9f0a3482e -r 818263bbcd1a NEWS
--- a/NEWS Sat Mar 03 16:05:58 2012 +0400
+++ b/NEWS Sat Mar 03 01:52:46 2012 +0400
@@ -8,6 +8,7 @@
* new: add method blocks_from_homology() (allpy.structure)
* new: add MonomerHomology-based high blocks building algo to pair-cores
* new: print default values of command line args in help message (pair_cores)
+ * new: add web interface for pair-cores

1.4.1

diff -r e8c9f0a3482e -r 818263bbcd1a pair_cores/web/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pair_cores/web/Makefile Sat Mar 03 01:52:46 2012 +0400
@@ -0,0 +1,52 @@
+
+all: build environment
+
+.PHONY: build
+build: pair-cores.wt
+
+.PHONY: environment
+environment: wc
+ mkdir -p approot
+ cd approot && ln -fs ../wc/locales
+ mkdir -p docroot/resources
+ cd docroot/resources && ln -fs /usr/share/Wt/resources/* .
+ cd docroot/resources && rm -fr Wc
+ cd docroot/resources && mkdir -p Wc
+ cd docroot/resources/Wc && ln -fs ../../../wc/css/
+ cd docroot/resources/Wc && ln -fs ../../../wc/js/
+
+.SECONDEXPANSION:
+
+wc_cpp = wc/src/Wbi.cpp wc/src/TableForm.cpp wc/src/util.cpp \
+ wc/src/Countdown.cpp wc/src/TimeDuration.cpp wc/src/rand.cpp
+
+wc_hpp = $(wc_cpp:.cpp=.hpp) wc/src/global.hpp
+
+sources = $(wc_cpp) pair-cores.cpp
+objects = $(sources:.cpp=.o)
+headers = $(wc_hpp)
+
+WT_CONNECTOR=http
+CXX = g++
+LINK = g++
+LIBS += -lboost_signals -lboost_system -lboost_thread -lboost_filesystem
+LIBS += -lcurl -lssl
+LIBS += -lwt
+LIBS += -lwt$(WT_CONNECTOR)
+
+%.o: %.cpp $$(headers)
+ $(CXX) -c $(CXXFLAGS) $< -o $@
+
+$(wc_cpp) $(wc_hpp): wc
+
+pair-cores.wt: $$(objects)
+ $(LINK) $(LFLAGS) $(LIBS) $(objects) -o $@
+
+wc:
+ wget https://bitbucket.org/starius/wt-classes/get/1.3.1.tar.gz -O - | \
+ tar -xz
+ mkdir -p wc
+ cp -a starius-wt-classes-*/* wc
+ rm -r starius-wt-classes-*
+ $(MAKE) -C wc js/jquery.countdown.js
+
diff -r e8c9f0a3482e -r 818263bbcd1a pair_cores/web/README.rst
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pair_cores/web/README.rst Sat Mar 03 01:52:46 2012 +0400
@@ -0,0 +1,44 @@
+Pair-cores web interface
+========================
+
+Here is a web-interface for pair-cores program from allpy package.
+
+Requirements
+------------
+
+ * pair-cores command (hg rev e8c9f0a3482e +)
+ * Wt library 3.1.10+
+ * curl library
+ * ssl library
+
+Wt-classes library is included in this web ui, you do not need
+to have it installed. However it is linked with curl and openssl libraries,
+so these libraries should be installed.
+
+Build
+-----
+
+ $ make build
+
+This will build pair-cores.wt executable, linked with wt http connector.
+To build fcgi linked program, pass "WT_CONNECTOR=fcgi" to make.
+
+To test it, some files are needed:
+
+ $ make environment
+
+Run test script:
+
+ $ sh run.sh
+
+Links
+-----
+
+For more information please visit:
+ * allpy (and pair-cores) homepage:
+ http://kodomo.fbb.msu.ru/trac/allpy
+ * Distributed version control system of wt-classes:
+ https://bitbucket.org/starius/wt-classes/
+ * Wt homepage:
+ http://webtoolkit.eu/
+
diff -r e8c9f0a3482e -r 818263bbcd1a pair_cores/web/pair-cores.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pair_cores/web/pair-cores.cpp Sat Mar 03 01:52:46 2012 +0400
@@ -0,0 +1,139 @@
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "wc/src/Wbi.hpp"
+
+using namespace Wt;
+using namespace Wt::Wc;
+
+TaskNumberQueue queue(100);
+
+bool validate(AbstractTask* task, TextFileInput* input_markup,
+ TextFileInput* input_aln) {
+ if (input_markup->state() != input_aln->state()) {
+ task->set_message("");
+ return true;
+ } else {
+ task->set_message("Input alignment or input markup must be specified");
+ return false;
+ }
+}
+
+std::string name_gen(TextFileInput* input_markup, TextFileInput* input_aln,
+ std::string extension) {
+ TextFileInput* input = input_markup->state() == AbstractInput::VALID ?
+ input_markup : input_aln;
+ std::string file = input->file_upload()->clientFileName().toUTF8();
+ std::string without_extension = file.substr(0, file.find_last_of("."));
+ if (without_extension.empty()) {
+ without_extension = "pair-cores";
+ }
+ return without_extension + "." + extension;
+}
+
+class PairCoresApp : public WApplication {
+public:
+ PairCoresApp(const WEnvironment& env);
+};
+
+PairCoresApp::PairCoresApp(const WEnvironment& env):
+ WApplication(env) {
+ enableUpdates(true);
+ messageResourceBundle().use(Wt::WApplication::appRoot() +
+ "locales/wtclasses");
+ TableTask* task = new TableTask(root());
+ //
+ TextFileInput* input_markup = new TextFileInput("-m");
+ input_markup->set_required(false);
+ task->add_input(input_markup, "Input pdb markup file");
+ //
+ TextFileInput* input_aln = new TextFileInput("-i");
+ input_aln->set_required(false);
+ task->add_input(input_aln, "Input alignment file");
+ //
+ WLineEdit* delta_edit = new WLineEdit();
+ delta_edit->setValidator(new WDoubleValidator(0, 10));
+ LineEditInput* delta = new LineEditInput(delta_edit, "-d");
+ task->add_input(delta, "Distance spreading");
+ //
+ WLineEdit* width_edit = new WLineEdit();
+ width_edit->setValidator(new WIntValidator(3, 9999));
+ LineEditInput* width = new LineEditInput(width_edit, "-w");
+ task->add_input(width, "Min width of a block");
+ //
+ BoolInput* blocks3d = new BoolInput(new WCheckBox(), "--blocks3d");
+ task->add_input(blocks3d, "Use blocks3d algorithm for high blocks");
+ //
+ BoolInput* ioss = new BoolInput(new WCheckBox(), "-e", "True", "False");
+ task->add_input(ioss, "Ignore cores, owned by one SS element");
+ //
+ WLineEdit* pair_timeout_edit = new WLineEdit();
+ pair_timeout_edit->setValidator(new WIntValidator(-1, 30 * 24 * 3600));
+ LineEditInput* pair_timeout = new LineEditInput(pair_timeout_edit,
+ "--pair-timeout");
+ task->add_input(pair_timeout,
+ "Bron-Kerbosh (pair cores) timeout (-1 - unlimited)");
+ //
+ WLineEdit* blocks3d_timeout_edit = new WLineEdit();
+ blocks3d_timeout_edit->setValidator(new WIntValidator(-1, 30 * 24 * 3600));
+ LineEditInput* blocks3d_timeout = new LineEditInput(blocks3d_timeout_edit,
+ "--blocks3d-timeout");
+ task->add_input(blocks3d_timeout,
+ "Bron-Kerbosh (blocks3d) timeout (-1 - unlimited)");
+ //
+ // outputs
+ //
+ boost::function name_gen2 = boost::bind(name_gen,
+ input_markup, input_aln, _1);
+ //
+ ViewFileOutput* homology = new ViewFileOutput("-y");
+ homology->set_suggested_gen(boost::bind(name_gen2, "hom"));
+ homology->set_selectable(false);
+ task->add_output(homology, "Output homology file");
+ //
+ ViewFileOutput* pair_blocks = new ViewFileOutput("-b");
+ pair_blocks->set_suggested_gen(boost::bind(name_gen2, "blocks"));
+ task->add_output(pair_blocks, "Output pair cores file");
+ //
+ ViewFileOutput* pair_html = new ViewFileOutput("-H",
+ &FileOutput::unique_name,
+ "application/octet-stream",
+ "text/html");
+ pair_html->set_suggested_gen(boost::bind(name_gen2, "html"));
+ task->add_output(pair_html, "Output pair cores HTML file");
+ //
+ ViewFileOutput* pymol = new ViewFileOutput("-p");
+ pymol->set_suggested_gen(boost::bind(name_gen2, "pml"));
+ task->add_output(pymol, "Output PyMol file");
+ //
+ ViewFileOutput* high_blocks = new ViewFileOutput("--high-blocks");
+ high_blocks->set_suggested_gen(boost::bind(name_gen2, "blocks"));
+ task->add_output(high_blocks, "Output text file with high blocks");
+ //
+ ViewFileOutput* blocks3d_html = new ViewFileOutput("--high-blocks-html",
+ &FileOutput::unique_name,
+ "application/octet-stream",
+ "text/html");
+ blocks3d_html->set_suggested_gen(boost::bind(name_gen2, "html"));
+ task->add_output(blocks3d_html, "Output HTML file with high blocks");
+ //
+ task->set_runner(new ForkingRunner("pair-cores"));
+ task->set_queue(&queue);
+ task->set_validator(boost::bind(validate, task, input_markup, input_aln));
+ new TaskCountup(task, root());
+}
+
+WApplication* createPairCoresApp(const WEnvironment& env) {
+ return new PairCoresApp(env);
+}
+
+int main(int argc, char** argv) {
+ return WRun(argc, argv, &createPairCoresApp);
+}
+
diff -r e8c9f0a3482e -r 818263bbcd1a pair_cores/web/run.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pair_cores/web/run.sh Sat Mar 03 01:52:46 2012 +0400
@@ -0,0 +1,3 @@
+./pair-cores.wt --docroot docroot/ --approot approot/ \
+ --http-port 56929 --http-address 127.0.0.1
+