Skip to content

Commit e5d8d80

Browse files
committed
rename the parameter
1 parent 4048af4 commit e5d8d80

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

src/commons/LocalParameters.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ class LocalParameters : public Parameters {
6767
PARAMETER(PARAM_WRITE_FRAG_COORDS)
6868
int writeFragCoords;
6969

70-
PARAMETER(PARAM_LEN_SEARCH_START)
71-
int lenSearchStart;
70+
PARAMETER(PARAM_LEN_SCAN_FOR_START)
71+
int lenScanForStart;
7272

7373
private:
7474
LocalParameters() :
@@ -87,7 +87,7 @@ class LocalParameters : public Parameters {
8787
PARAM_ALLOW_OVERLAP(PARAM_ALLOW_OVERLAP_ID,"--overlap", "allow same-strand overlaps", "allow predictions to overlap another on the same strand. when not allowed (default), only the prediction with better E-value will be retained [0,1]", typeid(int), (void *) &overlapAllowed, "^[0-1]{1}$"),
8888
PARAM_WRITE_TKEY(PARAM_WRITE_TKEY_ID,"--target-key", "write target key instead of accession", "write the target key (internal DB identifier) instead of its accession. By default (0) target accession will be written [0,1]", typeid(int), (void *) &writeTargetKey, "^[0-1]{1}$"),
8989
PARAM_WRITE_FRAG_COORDS(PARAM_WRITE_FRAG_COORDS_ID,"--write-frag-coords", "write fragment contig coords", "write the contig coords of the stop-to-stop fragment in which putative exon lies. By default (0) only putative exon coords will be written [0,1]", typeid(int), (void *) &writeFragCoords, "^[0-1]{1}$"),
90-
PARAM_LEN_SEARCH_START(PARAM_LEN_SEARCH_START_ID,"--len-search-start", "length to search for start codon", "length to search for a start codon before the first exon and in the same frame. By default (0) no search", typeid(int), (void *) &lenSearchStart, "^[0-9]+$")
90+
PARAM_LEN_SCAN_FOR_START(PARAM_LEN_SCAN_FOR_START_ID,"--len-scan-for-start", "length to scan for start codon", "length to scan for a start codon before the first exon and in the same frame. By default (0) no scan", typeid(int), (void *) &lenScanForStart, "^[0-9]+$")
9191

9292
{
9393
collectoptimalset.push_back(&PARAM_METAEUK_EVAL_THR);
@@ -119,7 +119,7 @@ class LocalParameters : public Parameters {
119119
unitesetstofasta.push_back(&PARAM_TRANSLATION_TABLE);
120120
unitesetstofasta.push_back(&PARAM_WRITE_TKEY);
121121
unitesetstofasta.push_back(&PARAM_WRITE_FRAG_COORDS);
122-
unitesetstofasta.push_back(&PARAM_LEN_SEARCH_START);
122+
unitesetstofasta.push_back(&PARAM_LEN_SCAN_FOR_START);
123123
unitesetstofasta.push_back(&PARAM_MAX_SEQ_LEN);
124124
unitesetstofasta.push_back(&PARAM_THREADS);
125125
unitesetstofasta.push_back(&PARAM_V);
@@ -155,8 +155,8 @@ class LocalParameters : public Parameters {
155155
// default value 0 means only coords of putative exon are written
156156
writeFragCoords = 0;
157157

158-
// default value 0 means no searching before the first exon
159-
lenSearchStart = 0;
158+
// default value 0 means no scanning before the first exon
159+
lenScanForStart = 0;
160160

161161
citations.emplace(CITATION_METAEUK, "Levy Karin E, Mirdita M, Soeding J: MetaEuk – sensitive, high-throughput gene discovery and annotation for large-scale eukaryotic metagenomics. biorxiv, 851964 (2019).");
162162
}

src/exonpredictor/unitesetstofasta.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ int findStartInString (const std::string & seq) {
3434
return(lastPosOfClosestStart);
3535
}
3636

37-
int searchForStartBeforeFirstExon(Prediction & pred, const char* contigData, std::ostringstream & joinedExonsStream, const int searchLen) {
37+
int scanForStartBeforeFirstExon(Prediction & pred, const char* contigData, std::ostringstream & joinedExonsStream, const int scanLen) {
3838
// check if first exon's first codon is start and if so return 0 - already a start codon
3939
if (pred.strand == PLUS) {
4040
std::string firstCodon(&contigData[pred.lowContigCoord], 3);
@@ -53,34 +53,34 @@ int searchForStartBeforeFirstExon(Prediction & pred, const char* contigData, std
5353
}
5454
}
5555

56-
int seachLenLegal = searchLen - (searchLen % 3);
56+
int scanLenLegal = scanLen - (scanLen % 3);
5757

5858
// case PLUS
59-
int coordToStartSearch = pred.lowContigCoord - seachLenLegal;
59+
int coordToBeginScan = pred.lowContigCoord - scanLenLegal;
6060
int posAfterStopCodon = pred.optimalExonSet[0].potentialExonContigStartBeforeTrim;
6161
// case MINUS
6262
if (pred.strand == MINUS) {
63-
coordToStartSearch = pred.highContigCoord + 1;
63+
coordToBeginScan = pred.highContigCoord + 1;
6464
posAfterStopCodon = pred.optimalExonSet[0].potentialExonContigEndBeforeTrim;
6565
}
6666

6767
// be careful at the edge of the first exon - don't go over stop
6868
// case PLUS
69-
if ((pred.strand == PLUS) && (coordToStartSearch < posAfterStopCodon)) {
70-
coordToStartSearch = posAfterStopCodon;
71-
seachLenLegal = pred.lowContigCoord - coordToStartSearch;
69+
if ((pred.strand == PLUS) && (coordToBeginScan < posAfterStopCodon)) {
70+
coordToBeginScan = posAfterStopCodon;
71+
scanLenLegal = pred.lowContigCoord - coordToBeginScan;
7272
}
7373
// case MINUS
74-
if ((pred.strand == MINUS) && ((posAfterStopCodon - pred.highContigCoord) < (size_t)seachLenLegal)) {
75-
seachLenLegal = (posAfterStopCodon - pred.highContigCoord);
76-
if (seachLenLegal % 3 != 0) {
77-
Debug(Debug::ERROR) << "ERROR: seachLenLegal mod 3 is not 0.\n";
74+
if ((pred.strand == MINUS) && ((posAfterStopCodon - pred.highContigCoord) < (size_t)scanLenLegal)) {
75+
scanLenLegal = (posAfterStopCodon - pred.highContigCoord);
76+
if (scanLenLegal % 3 != 0) {
77+
Debug(Debug::ERROR) << "ERROR: scanLenLegal mod 3 is not 0.\n";
7878
EXIT(EXIT_FAILURE);
7979
}
8080
}
8181

8282
// extract the segment from the contig:
83-
std::string beforeFirstExonSeq(&contigData[coordToStartSearch], (size_t)seachLenLegal);
83+
std::string beforeFirstExonSeq(&contigData[coordToBeginScan], (size_t)scanLenLegal);
8484
std::string beforeFirstExonSeqRevCompSeq(beforeFirstExonSeq);
8585
if (pred.strand == MINUS) {
8686
reverseComplement (beforeFirstExonSeq, beforeFirstExonSeqRevCompSeq);
@@ -114,7 +114,7 @@ int searchForStartBeforeFirstExon(Prediction & pred, const char* contigData, std
114114

115115
void preparePredDataAndHeader (Prediction & pred, const std::string & targetHeaderAcc, const std::string & contigHeaderAcc,
116116
const char* contigData, std::ostringstream & joinedHeaderStream, std::ostringstream & joinedExonsStream,
117-
const int writeFragCoords, const int lenSearchStart, const size_t contigLen) {
117+
const int writeFragCoords, const int lenScanForStart, const size_t contigLen) {
118118

119119
// clear streams:
120120
joinedHeaderStream.str("");
@@ -134,13 +134,13 @@ void preparePredDataAndHeader (Prediction & pred, const std::string & targetHead
134134
joinedHeaderStream << "-|";
135135
}
136136
joinedHeaderStream << pred.totalBitscore << "|" << pred.combinedEvalue << "|" << pred.numExons << "|";
137-
if (lenSearchStart == 0) {
138-
// default case: user doesn't want to search for start codon before the first exon:
137+
if (lenScanForStart == 0) {
138+
// default case: user doesn't want to scan for start codon before the first exon:
139139
joinedHeaderStream << pred.lowContigCoord << "|" << pred.highContigCoord;
140140
} else {
141-
// special case: user wants to search for start codon before the first exon:
141+
// special case: user wants to scan for start codon before the first exon:
142142
// if found - padd it up/downstream and indicate the padding != 0 in []
143-
int numNucsAdded = searchForStartBeforeFirstExon(pred, contigData, joinedExonsStream, lenSearchStart);
143+
int numNucsAdded = scanForStartBeforeFirstExon(pred, contigData, joinedExonsStream, lenScanForStart);
144144
if (pred.strand == PLUS) {
145145
joinedHeaderStream << pred.lowContigCoord << "[" << numNucsAdded << "]" << "|" << pred.highContigCoord;
146146
} else {
@@ -385,8 +385,8 @@ int unitesetstofasta(int argn, const char **argv, const Command& command) {
385385

386386
// for the translated result
387387
TranslateNucl translateNucl(static_cast<TranslateNucl::GenCode>(par.translationTable));
388-
if ((par.translationTable != 1) && (par.lenSearchStart > 0)) {
389-
Debug(Debug::WARNING) << "Selected translation table is not canonical and search for start is turned on. Please note that only ATG/atg is considered a start codon for the search!\n";
388+
if ((par.translationTable != 1) && (par.lenScanForStart > 0)) {
389+
Debug(Debug::WARNING) << "Selected translation table is not canonical and scan for start is turned on. Please note that only ATG/atg is considered a start codon for the scan!\n";
390390
}
391391
// for now, opting to use only ATG/atg as start codon because:
392392
// In Euks ATG is super dominant, unlike proks
@@ -482,7 +482,7 @@ int unitesetstofasta(int argn, const char **argv, const Command& command) {
482482
}
483483

484484
if (plusPred.optimalExonSet.size() > 0) {
485-
preparePredDataAndHeader(plusPred, targetHeaderAcc, contigHeaderAcc, contigData, joinedHeaderStream, joinedExonsStream, par.writeFragCoords, par.lenSearchStart, contigLen);
485+
preparePredDataAndHeader(plusPred, targetHeaderAcc, contigHeaderAcc, contigData, joinedHeaderStream, joinedExonsStream, par.writeFragCoords, par.lenScanForStart, contigLen);
486486
std::string result = ">" + joinedHeaderStream.str();
487487
fastaAaWriter.writeData(result.c_str(), result.size(), 0, thread_idx, false, false);
488488
fastaCodonWriter.writeData(result.c_str(), result.size(), 0, thread_idx, false, false);
@@ -514,7 +514,7 @@ int unitesetstofasta(int argn, const char **argv, const Command& command) {
514514
fastaCodonWriter.writeData(result.c_str(), result.size(), 0, thread_idx, false, false);
515515
}
516516
if (minusPred.optimalExonSet.size() > 0) {
517-
preparePredDataAndHeader(minusPred, targetHeaderAcc, contigHeaderAcc, contigData, joinedHeaderStream, joinedExonsStream, par.writeFragCoords, par.lenSearchStart, contigLen);
517+
preparePredDataAndHeader(minusPred, targetHeaderAcc, contigHeaderAcc, contigData, joinedHeaderStream, joinedExonsStream, par.writeFragCoords, par.lenScanForStart, contigLen);
518518
std::string result = ">" + joinedHeaderStream.str();
519519
fastaAaWriter.writeData(result.c_str(), result.size(), 0, thread_idx, false, false);
520520
fastaCodonWriter.writeData(result.c_str(), result.size(), 0, thread_idx, false, false);
@@ -576,7 +576,7 @@ int unitesetstofasta(int argn, const char **argv, const Command& command) {
576576
}
577577

578578
if (plusPred.optimalExonSet.size() > 0) {
579-
preparePredDataAndHeader(plusPred, targetHeaderAcc, contigHeaderAcc, contigData, joinedHeaderStream, joinedExonsStream, par.writeFragCoords, par.lenSearchStart, contigLen);
579+
preparePredDataAndHeader(plusPred, targetHeaderAcc, contigHeaderAcc, contigData, joinedHeaderStream, joinedExonsStream, par.writeFragCoords, par.lenScanForStart, contigLen);
580580
std::string result = ">" + joinedHeaderStream.str();
581581
fastaAaWriter.writeData(result.c_str(), result.size(), 0, thread_idx, false, false);
582582
fastaCodonWriter.writeData(result.c_str(), result.size(), 0, thread_idx, false, false);
@@ -608,7 +608,7 @@ int unitesetstofasta(int argn, const char **argv, const Command& command) {
608608
fastaCodonWriter.writeData(result.c_str(), result.size(), 0, thread_idx, false, false);
609609
}
610610
if (minusPred.optimalExonSet.size() > 0) {
611-
preparePredDataAndHeader(minusPred, targetHeaderAcc, contigHeaderAcc, contigData, joinedHeaderStream, joinedExonsStream, par.writeFragCoords, par.lenSearchStart, contigLen);
611+
preparePredDataAndHeader(minusPred, targetHeaderAcc, contigHeaderAcc, contigData, joinedHeaderStream, joinedExonsStream, par.writeFragCoords, par.lenScanForStart, contigLen);
612612
std::string result = ">" + joinedHeaderStream.str();
613613
fastaAaWriter.writeData(result.c_str(), result.size(), 0, thread_idx, false, false);
614614
fastaCodonWriter.writeData(result.c_str(), result.size(), 0, thread_idx, false, false);

0 commit comments

Comments
 (0)