From 21a8baad99a82c8098c0a77be11e3a930e6d33f2 Mon Sep 17 00:00:00 2001 From: Thomas Krannich <krannich479@googlemail.com> Date: Wed, 16 Mar 2022 12:24:35 +0100 Subject: [PATCH] add IO of non-ref alignment file name --- Makefile | 2 +- src/argument_parsing.h | 30 +++++++++++++++++++++--------- src/popins_find_locations.h | 2 +- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index b5e8591..9340625 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ TOOLS=-DSAMTOOLS=\"$(SAMTOOLS)\" -DBWA=\"$(BWA)\" -DSICKLE=\"$(SICKLE)\" -DVELVE # Date and version number from git DATE := on $(shell git log --pretty=format:"%cd" --date=iso | cut -f 1,2 -d " " | head -n 1) -VERSION := 0.0.4-snake-$(shell git log --pretty=format:"%h" --date=iso | head -n 1) +VERSION := 0.0.6-snake-$(shell git log --pretty=format:"%h" --date=iso | head -n 1) CXXFLAGS += -DDATE=\""$(DATE)"\" -DVERSION=\""$(VERSION)"\" # Compiler flags diff --git a/src/argument_parsing.h b/src/argument_parsing.h index e03cf5d..879ec93 100644 --- a/src/argument_parsing.h +++ b/src/argument_parsing.h @@ -243,6 +243,7 @@ struct FindLocationsOptions { CharString prefix; CharString sampleID; CharString referenceFile; + CharString non_ref_bam; int maxInsertSize; bool deleteNonRefNew; @@ -251,6 +252,7 @@ struct FindLocationsOptions { prefix("."), sampleID(""), referenceFile("genome.fa"), + non_ref_bam("non_ref.bam"), maxInsertSize(800), deleteNonRefNew(false) {} @@ -568,6 +570,8 @@ bool getOptionValues(FindLocationsOptions &options, seqan::ArgumentParser &parse getOptionValue(options.prefix, parser, "prefix"); if (isSet(parser, "reference")) getOptionValue(options.referenceFile, parser, "reference"); + if (isSet(parser, "non-ref")) + getOptionValue(options.non_ref_bam, parser, "non-ref"); if (isSet(parser, "maxInsertSize")) getOptionValue(options.maxInsertSize, parser, "maxInsertSize"); if (isSet(parser, "delNonRefNew")) @@ -1123,6 +1127,7 @@ void setupParser(seqan::ArgumentParser &parser, FindLocationsOptions &options){ addSection(parser, "Input/output options"); addOption(parser, ArgParseOption("p", "prefix", "Path to the sample directories.", ArgParseArgument::STRING, "PATH")); addOption(parser, ArgParseOption("r", "reference", "Name of reference genome file.", ArgParseArgument::INPUT_FILE, "FASTA_FILE")); + addOption(parser, ArgParseOption("n", "non-ref", "Non-reference reads alignment file name.", ArgParseArgument::INPUT_FILE, "BAM FILE")); addSection(parser, "Algorithm options"); addOption(parser, ArgParseOption("e", "maxInsertSize", "The maximum expected insert size of the read pairs.", ArgParseArgument::INTEGER, "INT")); @@ -1134,6 +1139,7 @@ void setupParser(seqan::ArgumentParser &parser, FindLocationsOptions &options){ // Set default values. setDefaultValue(parser, "prefix", "\'.\'"); setDefaultValue(parser, "reference", options.referenceFile); + setDefaultValue(parser, "non-ref", options.non_ref_bam); setDefaultValue(parser, "maxInsertSize", options.maxInsertSize); setDefaultValue(parser, "delNonRefNew", "false"); @@ -1578,6 +1584,11 @@ ArgumentParser::ParseResult checkInput(FindLocationsOptions &options){ res = ArgumentParser::PARSE_ERROR; } + if (!exists(options.non_ref_bam)){ + std::cerr << "ERROR: Non-reference reads input file \'" << options.non_ref_bam << "\' does not exist." << std::endl; + res = ArgumentParser::PARSE_ERROR; + } + return res; } @@ -1758,15 +1769,16 @@ void printMultikOptions(const MultikOptions &options){ void printFindLocationsOptions(const FindLocationsOptions &options){ - cout << "=========================================================" << endl; - cout << "popins version : " << VERSION << endl; - cout << "PARAMETER ======== : VALUE ==============================" << endl; - cout << "prefix : " << options.prefix << endl; - cout << "sample ID : " << options.sampleID << endl; - cout << "reference file : " << options.referenceFile << endl; - cout << "max insert size : " << options.maxInsertSize << endl; - cout << "delete non_ref_new : " << options.deleteNonRefNew << endl; - cout << "=========================================================" << endl; + cout << "==========================================================" << endl; + cout << "popins version : " << VERSION << endl; + cout << "PARAMETER ========= : VALUE ==============================" << endl; + cout << "prefix : " << options.prefix << endl; + cout << "sample ID : " << options.sampleID << endl; + cout << "reference file : " << options.referenceFile << endl; + cout << "non-reference reads : " << options.non_ref_bam << endl; + cout << "max insert size : " << options.maxInsertSize << endl; + cout << "delete non_ref_new : " << options.deleteNonRefNew << endl; + cout << "==========================================================" << endl; } diff --git a/src/popins_find_locations.h b/src/popins_find_locations.h index abce682..dc98eae 100644 --- a/src/popins_find_locations.h +++ b/src/popins_find_locations.h @@ -141,7 +141,7 @@ int popins_find_locations(int argc, char const ** argv){ //CharString fastqFirst = getFileName(workingDirectory, "paired.1.fastq"); //CharString fastqSecond = getFileName(workingDirectory, "paired.2.fastq"); //CharString fastqSingle = getFileName(workingDirectory, "single.fastq"); - CharString nonRefBam = getFileName(workingDirectory, "non_ref.bam"); + CharString nonRefBam = getFileName(workingDirectory, options.non_ref_bam); CharString nonRefNew = getFileName(workingDirectory, "non_ref_new.bam"); CharString locationsFile = getFileName(workingDirectory, "locations.txt"); -- GitLab