MCPcopy Create free account
hub / github.com/OpenGene/fastp / process

Method process

src/seprocessor.cpp:76–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76bool SingleEndProcessor::process(){
77 if(!mOptions->split.enabled)
78 initOutput();
79
80 mInputLists = new SingleProducerSingleConsumerList<ReadPack*>*[mOptions->thread];
81
82 ThreadConfig** configs = new ThreadConfig*[mOptions->thread];
83 for(int t=0; t<mOptions->thread; t++){
84 mInputLists[t] = new SingleProducerSingleConsumerList<ReadPack*>();
85 configs[t] = new ThreadConfig(mOptions, t, false);
86 configs[t]->setInputList(mInputLists[t]);
87 initConfig(configs[t]);
88 }
89
90 std::thread readerThread(std::bind(&SingleEndProcessor::readerTask, this));
91
92 std::thread** threads = new thread*[mOptions->thread];
93 for(int t=0; t<mOptions->thread; t++){
94 threads[t] = new std::thread(std::bind(&SingleEndProcessor::processorTask, this, configs[t]));
95 }
96
97 std::thread* leftWriterThread = NULL;
98 std::thread* failedWriterThread = NULL;
99 if(mLeftWriter)
100 leftWriterThread = new std::thread(std::bind(&SingleEndProcessor::writerTask, this, mLeftWriter));
101 if(mFailedWriter)
102 failedWriterThread = new std::thread(std::bind(&SingleEndProcessor::writerTask, this, mFailedWriter));
103
104 readerThread.join();
105 for(int t=0; t<mOptions->thread; t++){
106 threads[t]->join();
107 }
108
109 if(!mOptions->split.enabled) {
110 if(leftWriterThread)
111 leftWriterThread->join();
112 if(failedWriterThread)
113 failedWriterThread->join();
114 }
115
116 if(mOptions->verbose)
117 loginfo("start to generate reports\n");
118
119 // merge stats and read filter results
120 vector<Stats*> preStats;
121 vector<Stats*> postStats;
122 vector<FilterResult*> filterResults;
123 for(int t=0; t<mOptions->thread; t++){
124 preStats.push_back(configs[t]->getPreStats1());
125 postStats.push_back(configs[t]->getPostStats1());
126 filterResults.push_back(configs[t]->getFilterResult());
127 }
128 Stats* finalPreStats = Stats::merge(preStats);
129 Stats* finalPostStats = Stats::merge(postStats);
130 FilterResult* finalFilterResult = FilterResult::merge(filterResults);
131
132 // read filter results to the first thread's
133 for(int t=1; t<mOptions->thread; t++){

Callers 1

processSingleEndMethod · 0.45

Calls 9

loginfoFunction · 0.85
setInputListMethod · 0.80
getPreStats1Method · 0.80
getPostStats1Method · 0.80
getFilterResultMethod · 0.80
getDupRateMethod · 0.80
printMethod · 0.45
setDupMethod · 0.45
reportMethod · 0.45

Tested by

no test coverage detected