Skip to content
Snippets Groups Projects
Commit 8ca524d9 authored by Kedi Cao's avatar Kedi Cao
Browse files

Merge branch 'fix-find-locations-io' into 'main'

add IO of non-ref alignment file name

See merge request !6
parents b740c065 21a8baad
Branches
1 merge request!6add IO of non-ref alignment file name
...@@ -18,7 +18,7 @@ TOOLS=-DSAMTOOLS=\"$(SAMTOOLS)\" -DBWA=\"$(BWA)\" -DSICKLE=\"$(SICKLE)\" -DVELVE ...@@ -18,7 +18,7 @@ TOOLS=-DSAMTOOLS=\"$(SAMTOOLS)\" -DBWA=\"$(BWA)\" -DSICKLE=\"$(SICKLE)\" -DVELVE
# Date and version number from git # Date and version number from git
DATE := on $(shell git log --pretty=format:"%cd" --date=iso | cut -f 1,2 -d " " | head -n 1) 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)"\" CXXFLAGS += -DDATE=\""$(DATE)"\" -DVERSION=\""$(VERSION)"\"
# Compiler flags # Compiler flags
......
...@@ -243,6 +243,7 @@ struct FindLocationsOptions { ...@@ -243,6 +243,7 @@ struct FindLocationsOptions {
CharString prefix; CharString prefix;
CharString sampleID; CharString sampleID;
CharString referenceFile; CharString referenceFile;
CharString non_ref_bam;
int maxInsertSize; int maxInsertSize;
bool deleteNonRefNew; bool deleteNonRefNew;
...@@ -251,6 +252,7 @@ struct FindLocationsOptions { ...@@ -251,6 +252,7 @@ struct FindLocationsOptions {
prefix("."), prefix("."),
sampleID(""), sampleID(""),
referenceFile("genome.fa"), referenceFile("genome.fa"),
non_ref_bam("non_ref.bam"),
maxInsertSize(800), maxInsertSize(800),
deleteNonRefNew(false) deleteNonRefNew(false)
{} {}
...@@ -568,6 +570,8 @@ bool getOptionValues(FindLocationsOptions &options, seqan::ArgumentParser &parse ...@@ -568,6 +570,8 @@ bool getOptionValues(FindLocationsOptions &options, seqan::ArgumentParser &parse
getOptionValue(options.prefix, parser, "prefix"); getOptionValue(options.prefix, parser, "prefix");
if (isSet(parser, "reference")) if (isSet(parser, "reference"))
getOptionValue(options.referenceFile, parser, "reference"); getOptionValue(options.referenceFile, parser, "reference");
if (isSet(parser, "non-ref"))
getOptionValue(options.non_ref_bam, parser, "non-ref");
if (isSet(parser, "maxInsertSize")) if (isSet(parser, "maxInsertSize"))
getOptionValue(options.maxInsertSize, parser, "maxInsertSize"); getOptionValue(options.maxInsertSize, parser, "maxInsertSize");
if (isSet(parser, "delNonRefNew")) if (isSet(parser, "delNonRefNew"))
...@@ -1123,6 +1127,7 @@ void setupParser(seqan::ArgumentParser &parser, FindLocationsOptions &options){ ...@@ -1123,6 +1127,7 @@ void setupParser(seqan::ArgumentParser &parser, FindLocationsOptions &options){
addSection(parser, "Input/output options"); addSection(parser, "Input/output options");
addOption(parser, ArgParseOption("p", "prefix", "Path to the sample directories.", ArgParseArgument::STRING, "PATH")); 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("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"); addSection(parser, "Algorithm options");
addOption(parser, ArgParseOption("e", "maxInsertSize", "The maximum expected insert size of the read pairs.", ArgParseArgument::INTEGER, "INT")); 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){ ...@@ -1134,6 +1139,7 @@ void setupParser(seqan::ArgumentParser &parser, FindLocationsOptions &options){
// Set default values. // Set default values.
setDefaultValue(parser, "prefix", "\'.\'"); setDefaultValue(parser, "prefix", "\'.\'");
setDefaultValue(parser, "reference", options.referenceFile); setDefaultValue(parser, "reference", options.referenceFile);
setDefaultValue(parser, "non-ref", options.non_ref_bam);
setDefaultValue(parser, "maxInsertSize", options.maxInsertSize); setDefaultValue(parser, "maxInsertSize", options.maxInsertSize);
setDefaultValue(parser, "delNonRefNew", "false"); setDefaultValue(parser, "delNonRefNew", "false");
...@@ -1578,6 +1584,11 @@ ArgumentParser::ParseResult checkInput(FindLocationsOptions &options){ ...@@ -1578,6 +1584,11 @@ ArgumentParser::ParseResult checkInput(FindLocationsOptions &options){
res = ArgumentParser::PARSE_ERROR; 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; return res;
} }
...@@ -1758,15 +1769,16 @@ void printMultikOptions(const MultikOptions &options){ ...@@ -1758,15 +1769,16 @@ void printMultikOptions(const MultikOptions &options){
void printFindLocationsOptions(const FindLocationsOptions &options){ void printFindLocationsOptions(const FindLocationsOptions &options){
cout << "=========================================================" << endl; cout << "==========================================================" << endl;
cout << "popins version : " << VERSION << endl; cout << "popins version : " << VERSION << endl;
cout << "PARAMETER ======== : VALUE ==============================" << endl; cout << "PARAMETER ========= : VALUE ==============================" << endl;
cout << "prefix : " << options.prefix << endl; cout << "prefix : " << options.prefix << endl;
cout << "sample ID : " << options.sampleID << endl; cout << "sample ID : " << options.sampleID << endl;
cout << "reference file : " << options.referenceFile << endl; cout << "reference file : " << options.referenceFile << endl;
cout << "max insert size : " << options.maxInsertSize << endl; cout << "non-reference reads : " << options.non_ref_bam << endl;
cout << "delete non_ref_new : " << options.deleteNonRefNew << endl; cout << "max insert size : " << options.maxInsertSize << endl;
cout << "=========================================================" << endl; cout << "delete non_ref_new : " << options.deleteNonRefNew << endl;
cout << "==========================================================" << endl;
} }
......
...@@ -141,7 +141,7 @@ int popins_find_locations(int argc, char const ** argv){ ...@@ -141,7 +141,7 @@ int popins_find_locations(int argc, char const ** argv){
//CharString fastqFirst = getFileName(workingDirectory, "paired.1.fastq"); //CharString fastqFirst = getFileName(workingDirectory, "paired.1.fastq");
//CharString fastqSecond = getFileName(workingDirectory, "paired.2.fastq"); //CharString fastqSecond = getFileName(workingDirectory, "paired.2.fastq");
//CharString fastqSingle = getFileName(workingDirectory, "single.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 nonRefNew = getFileName(workingDirectory, "non_ref_new.bam");
CharString locationsFile = getFileName(workingDirectory, "locations.txt"); CharString locationsFile = getFileName(workingDirectory, "locations.txt");
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment