polish: splitfasta: add more comments
This commit is contained in:
parent
0256f518c5
commit
698ab4a2cd
1 changed files with 6 additions and 4 deletions
|
@ -35,17 +35,19 @@ void splitFasta(const std::string& input_fasta) {
|
||||||
|
|
||||||
if (line[0] == '>') {
|
if (line[0] == '>') {
|
||||||
// New sequence header
|
// New sequence header
|
||||||
if (in_sequence) {
|
if (in_sequence) { // if found new sequence, close
|
||||||
outfile.close();
|
outfile.close(); // previous output file
|
||||||
}
|
}
|
||||||
dir_name = line.substr(1); // Remove '>'
|
dir_name = line.substr(1); // Remove '>'
|
||||||
// mkdir(dir_name.c_str(), 0777); // Create
|
|
||||||
// directory
|
// directory
|
||||||
fs::create_directories(dir_name);
|
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.open(output_file);
|
||||||
outfile << ">" << removeExtension(input_fasta)
|
outfile << ">" << removeExtension(input_fasta)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
// will enter sequence
|
||||||
in_sequence = true;
|
in_sequence = true;
|
||||||
} else if (in_sequence) {
|
} else if (in_sequence) {
|
||||||
// Inside sequence content
|
// Inside sequence content
|
||||||
|
|
Loading…
Reference in a new issue