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

CollectAlignmentSummaryMetrics throws exception upon an empty BAM file (header only) #1847

Closed
nh13 opened this issue Nov 28, 2022 · 2 comments
Labels

Comments

@nh13
Copy link
Collaborator

nh13 commented Nov 28, 2022

CollectAlignmentSummaryMetrics throws an exception when the input has no reads (SAM header only). CollectAlignmentSummaryMetrics is running as part of CollectMutipleMetrics, with the latter always producing a PDF output. Nonetheless, CollectAlignmentSummaryMetrics on an empty BAM file does not produce a histogram in the resulting metrics file, which causes the R script to fail.

ERROR	2022-11-28 13:33:21	ProcessExecutor	Error in read.table(metricsFile, header = T, sep = "\t", skip = secondBlankLine) : 
ERROR	2022-11-28 13:33:21	ProcessExecutor	  no lines available in input
ERROR	2022-11-28 13:33:21	ProcessExecutor	Execution halted
[Mon Nov 28 13:33:21 MST 2022] picard.analysis.CollectAlignmentSummaryMetrics done. Elapsed time: 0.01 minutes.
Runtime.totalMemory()=514850816
To get help, see http://broadinstitute.github.io/picard/index.html#GettingHelp
Exception in thread "main" picard.PicardException: R script picard/analysis/readLengthDistribution.R failed with return code 1
	at picard.analysis.CollectAlignmentSummaryMetrics.finish(CollectAlignmentSummaryMetrics.java:199)
	at picard.analysis.SinglePassSamProgram.makeItSo(SinglePassSamProgram.java:177)
	at picard.analysis.SinglePassSamProgram.doWork(SinglePassSamProgram.java:94)
	at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:308)
	at picard.cmdline.PicardCommandLine.instanceMain(PicardCommandLine.java:103)
	at picard.cmdline.PicardCommandLine.main(PicardCommandLine.java:113)
@nh13
Copy link
Collaborator Author

nh13 commented Nov 28, 2022

For reference, other tools handle this a bit more gracefully:

WARNING	2022-11-28 13:40:01	QualityScoreDistribution	No valid bases found in input file. No plot will be produced.
WARNING	2022-11-28 13:40:01	MeanQualityByCycle	No valid bases found in input file. No plot will be produced.
WARNING	2022-11-28 13:40:01	CollectBaseDistributionByCycle	No valid bases found in input file. No plot will be produced.
INFO	2022-11-28 13:40:01	RExecutor	Executing R script via command: Rscript /var/folders/wh/hhg8fhpn2w52nxcnjjn548_c0000gn/T/script5121851671603744911.R <redacted>.gc_bias.detail_metrics.txt <redacted>.gc_bias.summary_metrics.txt <redacted>.gc_bias.pdf 100
ERROR	2022-11-28 13:40:02	ProcessExecutor	Error in read.table(summaryMetricsFile, header = T, sep = "\t", skip = firstBlankLine2) : 
ERROR	2022-11-28 13:40:02	ProcessExecutor	  no lines available in input
ERROR	2022-11-28 13:40:02	ProcessExecutor	Execution halted
WARNING	2022-11-28 13:40:02	CollectInsertSizeMetrics	All data categories were discarded because they contained < 0.05 of the total aligned paired data.
WARNING	2022-11-28 13:40:02	CollectInsertSizeMetrics	Total mapped pairs in all categories: 0.0

@lbergelson lbergelson added the bug label Jan 19, 2023
@kachulis
Copy link
Contributor

Just noticed, this was fixed in #1859

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants