Commit 75df6777 authored by Romain Feron's avatar Romain Feron
Browse files

Finished implementing new output + added parameter to output in old format

parent d19ba5b9
......@@ -91,7 +91,7 @@ void output_sex_distribution(std::string& output_file_path, sd_table& results, u
output_file.open(output_file_path);
// Output file header
output_file << "Males" << "\t" << "Females" << "\t" << "Sequences" << "\t" << "P-value" << "\t" << "Significant" << "\n";
output_file << "Males" << "\t" << "Females" << "\t" << "Sequences" << "\t" << "P-value" << "\n";
// Generate output file
for (uint m=0; m < n_males; ++m) {
......
......@@ -14,7 +14,8 @@ struct Parameters {
// Initialize all possible parameters to be used in the analyses
// Arguments: name, help message, flag, default value, type, internal type, value, required
// Flags : -h, -f, -d, -o, -u, -t, -c, -p, -b, -a, -m, --min-males, --min-females, --max-males, --max-females, --min-individuals
// Flags : -h, -f, -d, -o, -u, -t, -c, -p, -b, -a, -m, --min-males, --min-females, --max-males, --max-females, --min-individuals, --output-matrix
// Parameter constructor: Parameter(name, description, flag, default_value, type, internal_type, value, required)
std::vector<Parameter> list {Parameter("help", "Prints this message", "-h", "0", "bool", "bool", "", false),
Parameter("input_file_path", "Path to an input file", "-f", "", "string", "ifile", "", true),
Parameter("input_dir_path", "Path to an input directory", "-d", "", "string", "dir", "", true),
......@@ -32,6 +33,7 @@ struct Parameters {
Parameter("max_females", "Maximum number of females in the subset", "--max-females", "n.females", "int", "int", "", false),
Parameter("min_individuals", "Minimum number of individuals in the subset (overrides sex parameters)", "--min-individuals", "0", "int", "int", "", false),
Parameter("max_individuals", "Maxmimum number of individuals in the subset (overrides sex parameters)", "--max-individuals", "n.individual", "int", "int", "", false),
Parameter("output_matrix", "Output the sex distribution table as a matrix", "--output-matrix", "0", "bool", "bool", "", false)
};
......
......@@ -24,6 +24,7 @@ class RadSex {
Parameters parameters;
// Define all analyses
// Analysis constructor: Analysis(name, description, parameters, function ref)
std::map<std::string, Analysis> analyses { {"sex_distribution",
Analysis("sex_distribution",
"Compute a matrix of sequences distribution between sexes",
......
......@@ -114,7 +114,14 @@ void sex_distribution(Parameters& parameters) {
par = "output_file_path";
std::string output_file_path = parameters.get_value_from_name<std::string>(par);
par = "output_matrix";
bool output_matrix = parameters.get_value_from_name<bool>(par);
// Generate the output file
output_sex_distribution(output_file_path, results, n_males, n_females);
if (!output_matrix) {
output_sex_distribution(output_file_path, results, n_males, n_females);
} else {
output_sex_distribution_matrix(output_file_path, results, n_males, n_females);
}
}
}
Supports Markdown
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