// print help info int Help(int argc, char* argv[]) { // check for 'bamtools help COMMAND' to print tool-specific help message if (argc > 2) { // determine desired sub-tool AbstractTool* tool = CreateTool( argv[2] ); // if tool known, print its help screen if ( tool ) return tool->Help(); } // print general BamTools help message cerr << endl; cerr << "usage: bamtools [--help] COMMAND [ARGS]" << endl; cerr << endl; cerr << "Available bamtools commands:" << endl; cerr << "\tconvert Converts between BAM and a number of other formats" << endl; cerr << "\tcount Prints number of alignments in BAM file(s)" << endl; cerr << "\tcoverage Prints coverage statistics from the input BAM file" << endl; cerr << "\tfilter Filters BAM file(s) by user-specified criteria" << endl; cerr << "\theader Prints BAM header information" << endl; cerr << "\tindex Generates index for BAM file" << endl; cerr << "\tmerge Merge multiple BAM files into single file" << endl; cerr << "\trandom Select random alignments from existing BAM file(s), intended more as a testing tool." << endl; cerr << "\tresolve Resolves paired-end reads (marking the IsProperPair flag as needed)" << endl; cerr << "\trevert Removes duplicate marks and restores original base qualities" << endl; cerr << "\tsort Sorts the BAM file according to some criteria" << endl; cerr << "\tsplit Splits a BAM file on user-specified property, creating a new BAM output file for each value found" << endl; cerr << "\tstats Prints some basic statistics from input BAM file(s)" << endl; cerr << endl; cerr << "See 'bamtools help COMMAND' for more information on a specific command." << endl; cerr << endl; return EXIT_SUCCESS; }
void ToolsDockWidget::setScene(Scene * scene) { if (scene) this->connect(scene, SIGNAL(destroyed()), this, SLOT(setScene())); if (sender() && !scene && this->m_scene) return; m_scene = scene; QWidget * w = d->toolArea->widget(); AbstractTool * tool = dynamic_cast<AbstractTool*>(w); if (tool) tool->setScene(m_scene); }
/** * Sets the MapDocument on which the registered tools will operate. */ void ToolManager::setMapDocument(MapDocument *mapDocument) { if (mMapDocument == mapDocument) return; mMapDocument = mapDocument; const auto actions = mActionGroup->actions(); for (QAction *action : actions) { AbstractTool *tool = action->data().value<AbstractTool*>(); tool->setMapDocument(mapDocument); } }
// toolkit entry point int main(int argc, char* argv[]) { // just 'bamtools' if ( (argc == 1) ) return Help(argc, argv); // 'bamtools help', 'bamtools --help', or 'bamtools -h' if ( IsHelp(argv[1]) ) return Help(argc, argv); // 'bamtools version', 'bamtools --version', or 'bamtools -v' if ( IsVersion(argv[1]) ) return Version(); // determine desired sub-tool, run if found AbstractTool* tool = CreateTool( argv[1] ); if ( tool ) return tool->Run(argc, argv); // no tool matched, show help return Help(argc, argv); }
// toolkit entry point int main(int argc, char* argv[]) { // just 'bamtools' if ( (argc == 1) ) return Help(argc, argv); // 'bamtools help', 'bamtools --help', or 'bamtools -h' if ( IsHelp(argv[1]) ) return Help(argc, argv); // 'bamtools version', 'bamtools --version', or 'bamtools -v' if ( IsVersion(argv[1]) ) return Version(); // determine desired sub-tool AbstractTool* tool = CreateTool( argv[1] ); // if found, run tool... otherwise show help if ( tool ) return tool->Run(argc, argv); else return Help(argc, argv); }
void ToolsManager::runTool() { QObject* sender = QObject::sender(); for (QMap<QAction*,Tool>::const_iterator it = this->m_Tools.begin() ; it != this->m_Tools.end() ; ++it) { if (it.key() == sender) { AbstractTool* tool = (*it)(this->parentWidget()); AbstractTool::RunState res = tool->run(this->mp_ToolsData->commands(), this->mp_ToolsData); if (res == AbstractTool::Success) this->mp_ToolsData->commands()->push(); else if (res == AbstractTool::Error) { QMessageBox error(QMessageBox::Warning, "Tool error", "Error occurred during the run of a tool.", QMessageBox::Ok); error.setInformativeText("<nobr>Check the logger for more informations.</nobr>"); error.exec(); } } } };
void ToolManager::retranslateTools() { // Allow the tools to adapt to the new language const auto actions = mActionGroup->actions(); for (QAction *action : actions) { AbstractTool *tool = action->data().value<AbstractTool*>(); tool->languageChanged(); // Update the text, shortcut and tooltip of the action action->setText(tool->name()); action->setShortcut(tool->shortcut()); if (!tool->shortcut().isEmpty()) { action->setToolTip( QString(QLatin1String("%1 (%2)")).arg(tool->name(), tool->shortcut().toString())); } else { action->setToolTip(tool->name()); } } }