Commit ceac286e authored by RomainFeron's avatar RomainFeron
Browse files

Merge branch 'master' of github.com:RomainFeron/RadSex

parents 1d03d27b 541d1901
......@@ -26,7 +26,7 @@ void process_reads(Parameters& parameters) {
for (int i=0; i<parameters.get_value_from_name<int>(par); ++i) {
threads.push_back(std::thread(file_processor, std::ref(input_files), std::ref(results), std::ref(results_mutex), std::ref(files_mutex)));
}
for (auto &t : threads) t.join();
par = "output_file_path";
......@@ -36,6 +36,7 @@ void process_reads(Parameters& parameters) {
std::vector<std::string> individuals;
for (auto i: input_files) individuals.push_back(i.individual_name);
// Generate the output file
output_process_reads(output_file_path, individuals, results, min_cov);
......@@ -50,6 +51,7 @@ inline void file_processor(std::vector<InputFile>& input_files, std::unordered_m
* A mutex protects the list of input files and another mutex protects the results structure
*/
bool remaining_files = true;
while (remaining_files) {
......@@ -89,6 +91,7 @@ inline void process_file(InputFile& input_file, std::unordered_map<std::string,
// Read through the file and store the results
while ((line_n = kseq_read(sequence)) >= 0) {
++temp_results[sequence->seq.s];
if (line_n % 1000 == 0) std::cout << line_n / 1000 << std::endl;
}
kseq_destroy(sequence); // Destroy the seq object
......
......@@ -32,7 +32,11 @@ std::vector<InputFile> get_input_files(const std::string& input_dir_path) {
// Careful: this will fail if the file name contains "." ... TODO: solve this problem
if (s > 1) {
for (uint i=1; i<split_name.size(); ++i) extension += "." + split_name[i];
if (split_name[s - 1] == "gz" and s > 2) {
extension = "." + split_name[s - 1] + "." + split_name[s - 2];
} else {
extension = "." + split_name[s - 1];
}
}
if(std::find(extensions.begin(), extensions.end(), extension) != extensions.end()) {
......
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