Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recognise FASTA/Q even if the file has a very long header file #1491

Merged
merged 1 commit into from
Aug 10, 2022

Conversation

jmarshall
Copy link
Member

secondline_is_bases() avoids false positives by verifying that the second line contains only base-encoded alphabetic characters, but if the first line is longer than hts_detect_format2()'s peek buffer, we fail to recognise FASTA or FASTQ.

Revise (and rename to is_fastaq()) so the FASTA/Q check is:

  1. Check that the (buffered part of the) first line is entirely textual.
  2. Return true if we have none of the second line in our peek buffer.
  3. Check that the (buffered part of the) second line contains only base-encoding alphabetic characters.

Fixes samtools/samtools#1689.

secondline_is_bases() avoids false positives by verifying that the
second line contains only base-encoded alphabetic characters, but if
the first line is longer than hts_detect_format2()'s peek buffer, we
fail to recognise FASTA or FASTQ.

Revise (and rename to is_fastaq()) so the FASTA/Q check is:
1. Check that the (buffered part of the) first line is entirely textual.
2. Return true if we have none of the second line in our peek buffer.
3. Check that the (buffered part of the) second line contains only
   base-encoding alphabetic characters.

Fixes samtools/samtools#1689.
@jkbonfield
Copy link
Contributor

Thanks

@jmarshall jmarshall deleted the fastaq_longline branch August 10, 2022 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

samtools import fails for fastq with long data in headers
2 participants