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

Dedup does not work from std/in #55

Open
slazicoicr opened this issue Apr 4, 2019 · 2 comments
Open

Dedup does not work from std/in #55

slazicoicr opened this issue Apr 4, 2019 · 2 comments

Comments

@slazicoicr
Copy link

I have a small MiSeq bam file (in.bam) that passes the bamutil validate --in in.bam --so_coord check:

Number of records read = 44491
Number of valid records = 44491

TotalReads	44491.00
MappedReads	44251.00
PairedReads	44491.00
ProperPair	43249.00
DuplicateReads	0.00
QCFailureReads	0.00

MappingRate(%)	99.46
PairedReads(%)	100.00
ProperPair(%)	97.21
DupRate(%)	0.00
QCFailRate(%)	0.00

TotalBases	6645701.00
BasesInMappedReads	6609701.00
Returning: 0 (SUCCESS)

When I run with direct file input bamutil dedup --in in.bam --out del.bam --verbose it works as expected

Writing del.bam
Successfully marked 9 unpaired and 46 paired duplicate reads

When I try piping the SAM, it detects no duplicates samtools view -h in.bam | bamutil dedup --in - --out del.bam --verbose:

Writing del.bam
Successfully marked 0 unpaired and 0 paired duplicate reads

It throws an error when I try to pipe uncompressed bam file samtools view -hub in.bam | bamutil dedup --in -.ubam --out del.bam --verbose:

Sorting the indices of 101 duplicated records
Exiting due to ERROR:
	FAIL_ORDER: Cannot read header since the file pointer is null

My bamutil version:

Set of tools for operating on SAM/BAM files.
Version: 1.0.14; Built: Thu Apr  4 10:14:43 EDT 2019 by slazic
@mktrost
Copy link
Contributor

mktrost commented Apr 8, 2019

BamUtil Dedup requires 2 passes through the bam file, so as you discovered, does not work when reading from stdin. However there is definitely a bug in the implementation that it does not return an error when stdin is specified. I will update the code later this week to fail and print an error message when stdin is specified instead of just proceeding with incorrect output like it currently does.

I will also update the documentation to clearly state that stdin is not supported for dedup due to 2 passes being made through the file.

Note: BamUtil Dedup can output to stdout.

@mktrost
Copy link
Contributor

mktrost commented Apr 20, 2019

I have updated the code and documentation for Dedup to specify that stdin is not supported. The code now produces an error message to let the user know. Let me know if you have any additional questions.

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

No branches or pull requests

2 participants