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 "BaseAttributes.h"
23 
24 #include <QVariant>
25 
26 static const QString URL_LOCATION_ATTR_ID("url_location");
27 static const QString URL_OUT_ATTR_ID("url-out");
28 static const QString URL_SUFFIX_ATTR_ID("url-suffix");
29 static const QString URL_IN_ATTR_ID("url-in");
30 static const QString DATA_STORAGE_ATTR_ID("data-storage");
31 static const QString DATABASE_ATTR_ID("database");
32 static const QString DB_PATH_ID("db-path");
33 static const QString DOCUMENT_FORMAT_ATTR_ID("document-format");
34 static const QString APPEND_ATTR_ID("accumulate");
35 static const QString READ_BY_LINES_ATTR_ID("read-by-lines");
36 static const QString FILE_MODE_ATTR_ID("write-mode");
37 
38 static const QString STRAND_ATTR_ID("strand");
39 static const QString AMINO_TRANSLATION_OFFSET_ATTR_ID("translation");
40 static const QString SPLIT_ATTR("split");
41 
42 namespace U2 {
43 namespace Workflow {
44 
URL_IN_ATTRIBUTE()45 const Descriptor BaseAttributes::URL_IN_ATTRIBUTE() {
46     return Descriptor(URL_IN_ATTR_ID, tr("Input file(s)"), tr("Semicolon-separated list of paths to the input files."));
47 }
48 
URL_OUT_ATTRIBUTE()49 const Descriptor BaseAttributes::URL_OUT_ATTRIBUTE() {
50     return Descriptor(URL_OUT_ATTR_ID, tr("Output file"), tr("Location of output data file. If this attribute is set,"
51                                                              " slot \"Location\" in port will not be used."));
52 }
53 
URL_SUFFIX()54 const Descriptor BaseAttributes::URL_SUFFIX() {
55     return Descriptor(URL_SUFFIX_ATTR_ID, tr("Output file suffix"), tr("This suffix will be used for generating the output file name."));
56 }
57 
URL_LOCATION_ATTRIBUTE()58 const Descriptor BaseAttributes::URL_LOCATION_ATTRIBUTE() {
59     return Descriptor(URL_LOCATION_ATTR_ID, tr("Located on"), tr("Machine file(s) are located on"));
60 }
61 
DATA_STORAGE_ATTRIBUTE()62 const Descriptor BaseAttributes::DATA_STORAGE_ATTRIBUTE() {
63     return Descriptor(DATA_STORAGE_ATTR_ID, tr("Data storage"), tr("Place to store workflow results"));
64 }
65 
LOCAL_FS_DATA_STORAGE()66 const QString BaseAttributes::LOCAL_FS_DATA_STORAGE() {
67     return "Local file system";
68 }
69 
SHARED_DB_DATA_STORAGE()70 const QString BaseAttributes::SHARED_DB_DATA_STORAGE() {
71     return "Shared UGENE database";
72 }
73 
DATA_STORAGE_ATTRIBUTE_VALUES_MAP()74 const QVariantMap BaseAttributes::DATA_STORAGE_ATTRIBUTE_VALUES_MAP() {
75     QVariantMap resultMap;
76 
77     resultMap[LOCAL_FS_DATA_STORAGE()] = LOCAL_FS_DATA_STORAGE();
78     resultMap[SHARED_DB_DATA_STORAGE()] = SHARED_DB_DATA_STORAGE();
79 
80     return resultMap;
81 }
82 
DATABASE_ATTRIBUTE()83 const Descriptor BaseAttributes::DATABASE_ATTRIBUTE() {
84     return Descriptor(DATABASE_ATTR_ID, tr("Database"), tr("The URL or name of a shared UGENE database"));
85 }
86 
DB_PATH()87 const Descriptor BaseAttributes::DB_PATH() {
88     return Descriptor(DB_PATH_ID, tr("Output path"), tr("Location of output objects in a shared database"));
89 }
90 
DOCUMENT_FORMAT_ATTRIBUTE()91 const Descriptor BaseAttributes::DOCUMENT_FORMAT_ATTRIBUTE() {
92     return Descriptor(DOCUMENT_FORMAT_ATTR_ID, tr("Document format"), tr("Document format of output file."));
93 }
94 
ACCUMULATE_OBJS_ATTRIBUTE()95 const Descriptor BaseAttributes::ACCUMULATE_OBJS_ATTRIBUTE() {
96     return Descriptor(APPEND_ATTR_ID, tr("Accumulate objects"), tr("Accumulate all incoming data in one file or create separate files for each input."
97                                                                    "In the latter case, an incremental numerical suffix is added to the file name."));
98 }
99 
SPLIT_SEQ_ATTRIBUTE()100 const Descriptor BaseAttributes::SPLIT_SEQ_ATTRIBUTE() {
101     return Descriptor(SPLIT_ATTR, tr("Split sequence"), tr("Split each incoming sequence on several parts."));
102 }
103 
READ_BY_LINES_ATTRIBUTE()104 const Descriptor BaseAttributes::READ_BY_LINES_ATTRIBUTE() {
105     return Descriptor(READ_BY_LINES_ATTR_ID, tr("Read by lines"), tr("Reads the input file line by line."));
106 }
107 
FILE_MODE_ATTRIBUTE()108 const Descriptor BaseAttributes::FILE_MODE_ATTRIBUTE() {
109     return Descriptor(FILE_MODE_ATTR_ID, tr("Existing file"), tr("If a target file already exists, you can specify"
110                                                                  " how it should be handled: either overwritten, renamed"
111                                                                  " or appended (if supported by file format). If Rename option is chosen existing file will be renamed."));
112 }
113 
STRAND_ATTRIBUTE()114 const Descriptor BaseAttributes::STRAND_ATTRIBUTE() {
115     return Descriptor(STRAND_ATTR_ID, tr("Search in"), tr("Which strands should be searched: direct, complement or both."));
116 }
117 
STRAND_BOTH()118 const QString BaseAttributes::STRAND_BOTH() {
119     return "both";
120 }
121 
STRAND_DIRECT()122 const QString BaseAttributes::STRAND_DIRECT() {
123     return "direct";
124 }
125 
STRAND_COMPLEMENTARY()126 const QString BaseAttributes::STRAND_COMPLEMENTARY() {
127     return "complementary";
128 }
129 
STRAND_ATTRIBUTE_VALUES_MAP()130 const QVariantMap BaseAttributes::STRAND_ATTRIBUTE_VALUES_MAP() {
131     QVariantMap strandMap;
132 
133     // The constant strings are used to generate the translations properly.
134     // When a string is used as an argument of the strandMap, nothing is generated.
135     const QString bothStrands = tr("both strands");
136     const QString directStrand = tr("direct strand");
137     const QString complementaryStrand = tr("complementary strand");
138 
139     strandMap[bothStrands] = STRAND_BOTH();
140     strandMap[directStrand] = STRAND_DIRECT();
141     strandMap[complementaryStrand] = STRAND_COMPLEMENTARY();
142 
143     return strandMap;
144 }
145 
146 }  // namespace Workflow
147 }  // namespace U2
148