Skip to content

Commit

Permalink
fix a bug in fastareader for FASTA with space in name
Browse files Browse the repository at this point in the history
  • Loading branch information
sfchen committed Apr 9, 2019
1 parent 1bccf90 commit eb3c962
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -162,7 +162,7 @@ AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
```

The adapter sequence in this file should be at least 10bp long. And you can give whatever you want to trim, rather than regular sequencing adapters (i.e. polyA).
The adapter sequence in this file should be at least 6bp long, otherwise it will be skipped. And you can give whatever you want to trim, rather than regular sequencing adapters (i.e. polyA).

`fastp` first trims the auto-detected adapter or the adapter sequences given by `--adapter_sequence | --adapter_sequence_r2`, then trims the adapters given by `--adapter_fasta` one by one.

Expand Down
3 changes: 1 addition & 2 deletions src/fastareader.cpp
Expand Up @@ -85,8 +85,7 @@ void FastaReader::readNext()
mCurrentSequence = ssSeq.str();
string header = ssHeader.str();

int space = header.find(" ");
mCurrentID = header.substr(0, space);
mCurrentID = header;
}

bool FastaReader::hasNext() {
Expand Down
7 changes: 6 additions & 1 deletion src/options.cpp
Expand Up @@ -56,7 +56,12 @@ void Options::loadFastaAdapters() {
map<string, string> contigs = reader.contigs();
map<string, string>::iterator iter;
for(iter = contigs.begin(); iter != contigs.end(); iter++) {
adapter.seqsInFasta.push_back(iter->second);
if(iter->second.length()>=6) {
adapter.seqsInFasta.push_back(iter->second);
}
else {
cerr << "skip too short adapter sequence in " << adapter.fastaFile << " (6bp required): " << iter->second << endl;
}
}

if(adapter.seqsInFasta.size() > 0) {
Expand Down

0 comments on commit eb3c962

Please sign in to comment.