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

Method loadFastaAdapters

src/options.cpp:53–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53void Options::loadFastaAdapters() {
54 if(adapter.fastaFile.empty()) {
55 adapter.hasFasta = false;
56 return;
57 }
58
59 check_file_valid(adapter.fastaFile);
60
61 FastaReader reader(adapter.fastaFile);
62 reader.readAll();
63
64 map<string, string> contigs = reader.contigs();
65 map<string, string>::iterator iter;
66 for(iter = contigs.begin(); iter != contigs.end(); iter++) {
67 if(iter->second.length()>=6) {
68 // deduplicate adapter sequences in fasta file, for example when the same adapter is listed for multiple samples in a batch processing
69 if(find(adapter.seqsInFasta.begin(), adapter.seqsInFasta.end(), iter->second) != adapter.seqsInFasta.end())
70 continue;
71 adapter.seqsInFasta.push_back(iter->second);
72 }
73 else {
74 cerr << "skip too short adapter sequence in " << adapter.fastaFile << " (6bp required): " << iter->second << endl;
75 }
76 }
77
78 if(adapter.seqsInFasta.size() > 0) {
79 adapter.hasFasta = true;
80 } else {
81 adapter.hasFasta = false;
82 }
83}
84
85bool Options::validate() {
86 if(in1.empty()) {

Callers 1

mainFunction · 0.80

Calls 4

check_file_validFunction · 0.85
readAllMethod · 0.80
lengthMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected