From 698ab4a2cd504f5697815cd31cc5b97987029866 Mon Sep 17 00:00:00 2001 From: Guoyi Zhang Date: Wed, 3 Jul 2024 18:08:19 +1000 Subject: [PATCH] polish: splitfasta: add more comments --- splitfasta.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/splitfasta.cpp b/splitfasta.cpp index b25c539..09cc64b 100644 --- a/splitfasta.cpp +++ b/splitfasta.cpp @@ -35,17 +35,19 @@ void splitFasta(const std::string& input_fasta) { if (line[0] == '>') { // New sequence header - if (in_sequence) { - outfile.close(); + if (in_sequence) { // if found new sequence, close + outfile.close(); // previous output file } dir_name = line.substr(1); // Remove '>' - // mkdir(dir_name.c_str(), 0777); // Create // directory fs::create_directories(dir_name); - fs::path output_file = fs::path(dir_name) / input_fasta; + fs::path output_file = + fs::path(dir_name) / + input_fasta; // suitable to many os outfile.open(output_file); outfile << ">" << removeExtension(input_fasta) << std::endl; + // will enter sequence in_sequence = true; } else if (in_sequence) { // Inside sequence content