On Thu, Mar 17, 2016 at 09:16:49PM -0400, Michael Peng wrote:
> samtools depth -b gene.bed a.bam
> 
> It gives the result in a few seconds. The problem is samtools continue to
> run for more than 10 mins.

This is a standard problem with BED vs region queries.  We really
ought to start a samtools FAQ.

Region queries (eg -r chr1:1000-2000) use the indices while bed
queries (-b) stream the entire data set and filter.  If your region in
the bed file is near the start of the file then it will give the
results fast and then appear to hang while it streams past the rest of
the file.

It trips people up, myself included, because it's not guessable that
the behaviour works this way.  Logically speaking bed files could also
be made to use the index, when it exists, in an intelligent manner.
It's simply a matter of someone finding the time and inclination to do
it.

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. 

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Samtools-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/samtools-help

Reply via email to