This commit is contained in:
Zengtudor 2024-09-20 15:47:58 +08:00
parent 0e0febeb5f
commit 0cf1bff509
3 changed files with 11 additions and 9 deletions

View File

@ -1,5 +1,7 @@
# 注意! # 注意!
> 输入的时候麻烦最后一行的空格别删
## 项目前置 ## 项目前置
> 如果你想在没有安装Visual Studio的电脑上使用编译后的代码请前往下面的网址安装VCRuntime > 如果你想在没有安装Visual Studio的电脑上使用编译后的代码请前往下面的网址安装VCRuntime

View File

@ -29,8 +29,8 @@ int main()
//参数列表 <文件分块内存大小单个DNA序列最长大小>("输入文件名","输出文件名",序列处理函数); //参数列表 <文件分块内存大小单个DNA序列最长大小>("输入文件名","输出文件名",序列处理函数);
//这个函数在src/tools/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)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)30, (size_t)5e4 + 5>("test.txt", "test.out.txt", reverseComplement);
}catch(const std::exception &e){ }catch(const std::exception &e){
zt::eprint( zt::eprint(

View File

@ -103,13 +103,15 @@ namespace dna {
if( last_buf_size > 0 ) [[likely]] { if( last_buf_size > 0 ) [[likely]] {
Spent recovery_interrupt_spent(zt::fmt("recovery_interrupt [",chunk_id,"]")); 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]]{ 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);
std::memcpy(tmp_buf.data()+last_buf_size,buf.data(),end_pos+1); //+1加的是空格位置
if(get_lines_add()){ 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; // 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; start_pos=end_pos+1;
recovered_size=end_pos+1; recovered_size=end_pos+1;
}else{ }else{
@ -140,8 +142,6 @@ namespace dna {
start_pos = end_pos + 1; start_pos = end_pos + 1;
} }
// // 等待所有任务完成
// #pragma omp taskwait
} }
@ -156,7 +156,7 @@ namespace dna {
if(start_pos!=buf_len){ if(start_pos!=buf_len){
zt::print("Saving interrupt chunk_id[",chunk_id,"]\n"); 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)); //这里边界处理脑子要炸了
} }
{ {