Skip to content

Commit

Permalink
excpect tabs in read headers
Browse files Browse the repository at this point in the history
  • Loading branch information
mikolmogorov committed Apr 5, 2019
1 parent f54bd0f commit a5ba370
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions flye/utils/fasta_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def _read_fasta(file_handle):
if header:
yield header, "".join(seq)
seq = []
header = line[1:].split(" ")[0]
header = line[1:].split()[0]
else:
seq.append(line)

Expand All @@ -143,7 +143,7 @@ def _read_fastq(file_handle):
if line[0] != "@":
raise FastaError("Fastq format error: {0} at line {1}"
.format(file_handle.name, no))
header = line[1:].split(" ")[0]
header = line[1:].split()[0]

if state_counter == 1:
seq = line
Expand Down
12 changes: 4 additions & 8 deletions src/sequence/sequence_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,17 +305,13 @@ size_t SequenceContainer::readFastq(std::vector<FastaRecord>& record,

void SequenceContainer::validateHeader(std::string& header)
{
size_t delim = header.find(' ');
if (delim == std::string::npos)
size_t delim = 0;
for (delim = 0; delim < header.length(); ++delim)
{
delim = header.length() - 1;
}
else
{
--delim;
if (std::isspace(header[delim])) break;
}

header = header.substr(1, delim);
header = header.substr(1, delim - 1);
if (header.empty()) throw ParseException("empty header");
}

Expand Down

0 comments on commit a5ba370

Please sign in to comment.