1 /**
2 * UGENE - Integrated Bioinformatics Tools.
3 * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru>
4 * http://ugene.net
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21
22 #include "BedtoolsSupport.h"
23
24 #include <U2Core/AppContext.h>
25 #include <U2Core/AppSettings.h>
26 #include <U2Core/DataPathRegistry.h>
27
28 #include <U2Formats/ConvertFileTask.h>
29
30 #include "BedtoolsSupportTask.h"
31
32 namespace U2 {
33
34 const QString BedtoolsSupport::ET_BEDTOOLS_ID = "USUPP_BEDTOOLS";
35 const QString BedtoolsSupport::GENOMES_DIR_NAME = "genome_lengths";
36 const QString BedtoolsSupport::GENOMES_DATA_NAME = "Genome files";
37
BedtoolsSupport(const QString & path)38 BedtoolsSupport::BedtoolsSupport(const QString &path)
39 : ExternalTool(ET_BEDTOOLS_ID, "bedtools", "bedtools", path) {
40 if (AppContext::getMainWindow() != nullptr) {
41 icon = QIcon(":external_tool_support/images/cmdline.png");
42 grayIcon = QIcon(":external_tool_support/images/cmdline_gray.png");
43 warnIcon = QIcon(":external_tool_support/images/cmdline_warn.png");
44 }
45 #ifdef Q_OS_WIN
46 executableFileName = "bedtools.exe";
47 #else
48 executableFileName = "bedtools";
49 #endif
50 validMessage = "bedtools v";
51 description = tr("<i>Bedtools</i>: flexible tools for genome arithmetic and DNA sequence analysis.");
52
53 versionRegExp = QRegExp("bedtools v(\\d+.\\d+.\\d+)");
54 validationArguments << "--version";
55 toolKitName = "bedtools";
56
57 connect(this, SIGNAL(si_toolValidationStatusChanged(bool)), SLOT(sl_validationStatusChanged(bool)));
58
59 U2DataPathRegistry *dpr = AppContext::getDataPathRegistry();
60 if (dpr != nullptr) {
61 U2DataPath *dp = new U2DataPath(GENOMES_DATA_NAME, QString(PATH_PREFIX_DATA) + ":" + GENOMES_DIR_NAME, "", U2DataPath::CutFileExtension);
62 dpr->registerEntry(dp);
63 }
64 }
65
sl_validationStatusChanged(bool)66 void BedtoolsSupport::sl_validationStatusChanged(bool /*newStatus*/) {
67 ConvertFactoryRegistry *registry = AppContext::getConvertFactoryRegistry();
68 if (isValid()) {
69 registry->registerConvertFactory(new BAMBEDConvertFactory());
70 }
71 }
72
73 } // namespace U2
74