From 0cf1bff5096284e0be3f60983ed75896b0c88ed2 Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Fri, 20 Sep 2024 15:47:58 +0800 Subject: [PATCH] update --- README.md | 2 ++ src/main.cpp | 4 ++-- src/tools/dna.hpp | 14 +++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a3da1cb..0ff401b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # 注意! +> 输入的时候麻烦最后一行的空格别删 + ## 项目前置 > 如果你想在没有安装Visual Studio的电脑上使用编译后的代码请前往下面的网址安装VCRuntime diff --git a/src/main.cpp b/src/main.cpp index 93dca75..f3f9ee6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,8 +29,8 @@ int main() //参数列表 <文件分块内存大小,单个DNA序列最长大小>("输入文件名","输出文件名",序列处理函数); //这个函数在src/tools/dna里面 - dna::open_file_and_calculate<(size_t)4*1024 * 1024 *1024 , (size_t)5e4+5>("filteredReads.txt", "reversedSequence.txt",reverseComplement); - // dna::open_file_and_calculate<(size_t)30, (size_t)5e4 + 5>("test.txt", "test.out.txt", reverseComplement); + // dna::open_file_and_calculate<(size_t)4*1024 * 1024 *1024 , (size_t)5e4+5>("filteredReads.txt", "reversedSequence.txt",reverseComplement); + dna::open_file_and_calculate<(size_t)30, (size_t)5e4 + 5>("test.txt", "test.out.txt", reverseComplement); }catch(const std::exception &e){ zt::eprint( diff --git a/src/tools/dna.hpp b/src/tools/dna.hpp index 566c8ab..40bd9fa 100644 --- a/src/tools/dna.hpp +++ b/src/tools/dna.hpp @@ -103,13 +103,15 @@ namespace dna { if( last_buf_size > 0 ) [[likely]] { Spent recovery_interrupt_spent(zt::fmt("recovery_interrupt [",chunk_id,"]")); - if((end_pos=buf_str_v.find('\n',start_pos)) != std::string_view::npos)[[likely]]{ - std::memcpy(tmp_buf.data()+last_buf_size,buf.data(),end_pos+1); + if( (end_pos=buf_str_v.find('\n',start_pos)) != std::string_view::npos ) [[likely]] { + + std::memcpy(tmp_buf.data()+last_buf_size,buf.data(),end_pos+1); //+1加的是空格位置 + if(get_lines_add()){ - reverseComplement(tmp_buf.data(), tmp_buf.data()+last_buf_size+end_pos); + reverseComplement(tmp_buf.data(), tmp_buf.data()+last_buf_size+end_pos); //注意传入函数时不要传入空格 } // lines=!lines; - output_file_stream.write(tmp_buf.data(), last_buf_size+end_pos+1); + output_file_stream.write(tmp_buf.data(), last_buf_size+end_pos+1); //+1加的是空格位置 start_pos=end_pos+1; recovered_size=end_pos+1; }else{ @@ -140,8 +142,6 @@ namespace dna { start_pos = end_pos + 1; } - // // 等待所有任务完成 - // #pragma omp taskwait } @@ -156,7 +156,7 @@ namespace dna { if(start_pos!=buf_len){ zt::print("Saving interrupt chunk_id[",chunk_id,"]\n"); - std::memcpy(tmp_buf.data(),buf.data()+start_pos,(last_buf_size = buf_len-start_pos)); + std::memcpy(tmp_buf.data(),buf.data()+start_pos,(last_buf_size = buf_len-start_pos)); //这里边界处理脑子要炸了 } {