This commit is contained in:
Zengtudor 2024-09-19 10:36:00 +08:00
parent 3680b72195
commit 1c165c40b0
1 changed files with 4 additions and 4 deletions

View File

@ -69,7 +69,7 @@ int main()
std::array<char,MAX_SIZE> buf; std::array<char,MAX_SIZE> buf;
unsigned int lines = 0; bool lines = 0; //使用布尔值加速
std::filesystem::path input_path("filteredReads.txt"),output_path("reversedSequence.txt"); std::filesystem::path input_path("filteredReads.txt"),output_path("reversedSequence.txt");
@ -78,10 +78,10 @@ int main()
while (input_file_stream.getline(buf.data(),MAX_SIZE,'\n')) while (input_file_stream.getline(buf.data(),MAX_SIZE,'\n'))
{ {
lines%=2; //防止溢出 // lines=!lines; //防止溢出
const auto buf_len = strlen(buf.data()); const auto buf_len = strlen(buf.data());
const std::string_view suffix("\n"); //设置一个每个DNA序列结尾的字符这里是以\n换行来结尾 const std::string_view suffix("\n"); //设置一个每个DNA序列结尾的字符这里是以\n换行来结尾
if (lines == 1){ if (lines == true){
// output_file_stream << reverseComplement(buf) << endl; // output_file_stream << reverseComplement(buf) << endl;
reverseComplement(buf,buf_len); reverseComplement(buf,buf_len);
} }
@ -90,7 +90,7 @@ int main()
buf[buf_len+i] = suffix[i]; buf[buf_len+i] = suffix[i];
} }
output_file_stream.write(buf.data(), buf_len+suffix.size()); // 写入文件 output_file_stream.write(buf.data(), buf_len+suffix.size()); // 写入文件
lines++; lines=!lines; //bool取反
} }
return 0; return 0;