| 51 | } |
| 52 | |
| 53 | void 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 | |
| 85 | bool Options::validate() { |
| 86 | if(in1.empty()) { |
no test coverage detected