Skip to content

alignmentSieve returns a truncated bam #1180

@sebastian-gregoricchio

Description

@sebastian-gregoricchio
Python 3.9.12
deeptools 3.5.1
alignmentSieve 3.5.1

Dear all,
when I run alignmentSieve with ATACshift option, but not for all my samples, I get as output a truncated bam file.

For instance this is the flagstat of my original bam:

31138979 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 secondary
0 + 0 supplementary
0 + 0 duplicates
31138979 + 0 mapped (100.00% : N/A)
31138979 + 0 paired in sequencing
15587662 + 0 read1
15551317 + 0 read2
31138979 + 0 properly paired (100.00% : N/A)
31138979 + 0 with itself and mate mapped
0 + 0 singletons (0.00% : N/A)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)

Then I run the following shifting:

alignmentSieve \
        --bam input.bam \
        --outFile shifted.bam \
        --minMappingQuality 20 \
        --minFragmentLength 0 \
        --maxFragmentLength 0 \
        --ATACshift \
        -p max

Then, a first thing is that the size of the file 2.4GB compared to the 5.4GB that I get without the shifting.
(I do not get any error message from alignmentSieve)

Secondly when I try to sort the file I get the following error:

user$   samtools sort -@ 30 -o shifted_sorted.bam shifted.bam

[E::bgzf_read] Read block operation failed with error -1 after 0 of 4 bytes
samtools sort: truncated file. Aborting

Furthermore if I try to run the flagstat on the resulting file I get that the file is indeed truncated with less than half of the read:

[E::bgzf_read] Read block operation failed with error -1 after 0 of 4 bytes
[bam_flagstat_core] Truncated file? Continue anyway.
1707936 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 secondary
0 + 0 supplementary
0 + 0 duplicates
1707936 + 0 mapped (100.00% : N/A)
1707936 + 0 paired in sequencing
854824 + 0 read1
853112 + 0 read2
1707936 + 0 properly paired (100.00% : N/A)
1707936 + 0 with itself and mate mapped
0 + 0 singletons (0.00% : N/A)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)

Thank you in advance for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions