Skip to content

samtools fasta/fastq problem #2161

Description

@wook2014

Are you using the latest version of samtools and HTSlib? If not, please specify.

I am using the latest samtools 1.21

Please describe your environment.

  • Linux 6.8.0-48-generic Ubuntu 22.04 LTS
  • x86_64 architecture
  • gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  • Ubuntu clang version 14.0.0-1ubuntu1.1

Please specify the steps taken to generate the issue, the command you are running and the relevant output.

I meet up with a problem with samtools fasta/fastq
I am trying to convert a bam file into fasta/fastq and the bam was generated by bowtie2 from pair-end 250 data.
50-F.zip
I used stats to get the info about reads and:

raw total sequences:    1856    # excluding supplementary and secondary reads
filtered sequences:     0
sequences:      1856
is sorted:      1
1st fragments:  928
last fragments: 928
reads mapped:   696
reads mapped and paired:        534     # paired-end technology bit set + both mates mapped
reads unmapped: 1160
reads properly paired:  0       # proper-pair bit set
reads paired:   1856    # paired-end technology bit set

and flagstat


1856 + 0 in total (QC-passed reads + QC-failed reads)
1856 + 0 primary
0 + 0 secondary
0 + 0 supplementary
0 + 0 duplicates
0 + 0 primary duplicates
696 + 0 mapped (37.50% : N/A)
696 + 0 primary mapped (37.50% : N/A)
1856 + 0 paired in sequencing
928 + 0 read1
928 + 0 read2
0 + 0 properly paired (0.00% : N/A)
534 + 0 with itself and mate mapped
162 + 0 singletons (8.73% : N/A)
534 + 0 with mate mapped to a different chr
470 + 0 with mate mapped to a different chr (mapQ>=5)

but when I tried to get fasta/fastq file of the bam by

samtools fasta -1 50-F.fasta -2 50-R.fasta -s 50-single.fasta 50-F.bam

all reads output to single file. It is confused that 50-F.fasta and 50-R.fasta are empty.
And when -s (single) is not set, reads appears in 50-F.fasta and 50-R.fasta.
I also tried sorted and sorted by name bam file but the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions