Skip to content

Commit 49fad4c

Browse files
committed
[INTERNAL] add hidden option not include versionnumber in outfile
1 parent baf5529 commit 49fad4c

3 files changed

Lines changed: 35 additions & 9 deletions

File tree

src/options.hpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ struct LambdaOptions : public SharedOptions
228228
std::bitset<64> samBamTags;
229229
bool samWithRefHeader;
230230
unsigned samBamSeq;
231+
bool versionInformationToOutputFile;
231232

232233
unsigned queryPart = 0;
233234

@@ -470,7 +471,15 @@ parseCommandLine(LambdaOptions & options, int argc, char const ** argv)
470471
setDefaultValue(parser, "sam-bam-tags", "AS NM ZE ZI ZF");
471472
setAdvanced(parser, "sam-bam-tags");
472473

473-
addSection(parser, "General Options");
474+
addOption(parser, ArgParseOption("", "version-to-outputfile",
475+
"Write the Lambda program tag and version number to the output file.",
476+
ArgParseArgument::STRING,
477+
"STR"));
478+
setValidValues(parser, "version-to-outputfile", "on off");
479+
setDefaultValue(parser, "version-to-outputfile", "on");
480+
hideOption(parser, "version-to-outputfile");
481+
482+
addSection(parser, "General Options");
474483
#ifdef _OPENMP
475484
addOption(parser, ArgParseOption("t", "threads",
476485
"number of threads to run concurrently.",
@@ -851,6 +860,9 @@ parseCommandLine(LambdaOptions & options, int argc, char const ** argv)
851860
(!options.samBamTags[SamBamExtraTags<>::Q_AA_CIGAR]))
852861
options.samBamSeq = 0;
853862

863+
getOptionValue(buffer, parser, "version-to-outputfile");
864+
options.versionInformationToOutputFile = (buffer == "on");
865+
854866
clear(buffer);
855867
getOptionValue(options.seedLength, parser, "seed-length");
856868
if ((!isSet(parser, "seed-length")) &&

src/output.hpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,16 @@ myWriteHeader(TGH & globalHolder, TLambdaOptions const & options)
261261
{
262262
open(globalHolder.outfile, toCString(options.output));
263263
context(globalHolder.outfile).fields = options.columns;
264+
auto & versionString = context(globalHolder.outfile).versionString;
265+
clear(versionString);
266+
append(versionString, _programTagToString(globalHolder.blastProgram));
267+
append(versionString, " 2.2.26+ [created by LAMBDA");
268+
if (options.versionInformationToOutputFile)
269+
{
270+
append(versionString, "-");
271+
append(versionString, SEQAN_APP_VERSION);
272+
}
273+
append(versionString, ", see http://seqan.de/lambda and please cite correctly in your academic work]");
264274
writeHeader(globalHolder.outfile);
265275
} else // SAM or BAM
266276
{
@@ -305,13 +315,16 @@ myWriteHeader(TGH & globalHolder, TLambdaOptions const & options)
305315
appendValue(header, firstRecord);
306316

307317
// Fill program header line.
308-
BamHeaderRecord pgRecord;
309-
pgRecord.type = BAM_HEADER_PROGRAM;
310-
appendValue(pgRecord.tags, TTag("ID", "lambda"));
311-
appendValue(pgRecord.tags, TTag("PN", "lambda"));
312-
appendValue(pgRecord.tags, TTag("VN", SEQAN_APP_VERSION));
313-
appendValue(pgRecord.tags, TTag("CL", options.commandLine));
314-
appendValue(header, pgRecord);
318+
if (options.versionInformationToOutputFile)
319+
{
320+
BamHeaderRecord pgRecord;
321+
pgRecord.type = BAM_HEADER_PROGRAM;
322+
appendValue(pgRecord.tags, TTag("ID", "lambda"));
323+
appendValue(pgRecord.tags, TTag("PN", "lambda"));
324+
appendValue(pgRecord.tags, TTag("VN", SEQAN_APP_VERSION));
325+
appendValue(pgRecord.tags, TTag("CL", options.commandLine));
326+
appendValue(header, pgRecord);
327+
}
315328

316329
// Fill homepage header line.
317330
BamHeaderRecord hpRecord0;

tests/maintests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ fi
7373
gunzip < "${SRCDIR}/tests/queries_${QALPHIN}.fasta.gz" > queries.fasta
7474
[ $? -eq 0 ] || errorout "Could not unzip queries.fasta"
7575

76-
${BINDIR}/bin/lambda -d db.fasta -di ${DI} -p ${PROG} -q queries.fasta -t 1 -o output_${PROG}_${DI}.${EXTENSION}
76+
${BINDIR}/bin/lambda -d db.fasta -di ${DI} -p ${PROG} -q queries.fasta -t 1 --version-to-outputfile off -o output_${PROG}_${DI}.${EXTENSION}
7777
[ $? -eq 0 ] || errorout "Search failed."
7878

7979
openssl md5 output_${PROG}_${DI}.${EXTENSION} >> /tmp/checksums
8080
## TODO compare checksums instead of generating them
8181

82+

0 commit comments

Comments
 (0)