On Fri, Aug 14, 2015 at 05:10:59PM +0100, Holly Zheng Bradley wrote: > While I can access the cram file using samtools view, samtools > idxstats doesn't work on cram files. It ran but reported 0 for all > stats apart from chromosome/contig length (a few lines below). This > must be some problem of samtools accessing cram's reference > registry.
It needs better error reporting to explain what is happening, but fundamentally this isn't going to work on CRAM unless we modify the .crai file format. Much like BAI was when initially implemented, there is no place to store such statistics. This later got added on to BAI as an undocumented feature (finally documented only recently), but it isn't in the CRAI. We could consider adding such statistics, or we could consider making samtools idxstats instead read the main CRAM file instead (much slower). It's quite easy to glean the number of records per reference in CRAM, but knowing whether they are aligned or unaligned is slow (comparable to samtools flagstats on CRAM). Note this also implies that building an index would become much much slower too. Right now index on a cram file just reads meta-data (slice headers) without decoding anything, but if we wish to separate out aligned vs unaligned counts then we'd need to start decoding the files again, making cram index the same slow speed as samtools index is now. Probably this just indicates we need a way to build indices on the fly during cram generation. James -- James Bonfield ([email protected]) | Hora aderat briligi. Nunc et Slythia Tova | Plurima gyrabant gymbolitare vabo; A Staden Package developer: | Et Borogovorum mimzebant undique formae, https://sf.net/projects/staden/ | Momiferique omnes exgrabure Rathi. -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE. ------------------------------------------------------------------------------ _______________________________________________ Samtools-help mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/samtools-help
