Hi,

Can you try using -M option, together with -L?

samtools view -ML tmp.bed -X -r 364940 my.bam my.bai

From: Keiran Raine <k...@sanger.ac.uk>
Sent: 24 September 2020 11:11
To: samtools-help@lists.sourceforge.net
Subject: [Samtools-help] samtools view -L vs location args [EXT]

Hi,

Are there any plans to make the -L option perform more efficiently?  Using the 
file based approach for even 1 loci appears to result in a full scan of the BAM:


$ time samtools view -X -r 364940 my.bam my.bam.bai chr1:65419886-65419886 > 
/dev/null

real  0m0.076s

user  0m0.042s

sys   0m0.031s



$ time samtools view -L tmp.bed -X -r 364940 my.bam my.bai > /dev/null

^C # gave up as it's a big file

real  3m42.755s

user  3m41.225s

sys   0m1.392s



$ cat tmp.bed

chr1  65419885    65419886

I understand that it may be beneficial to have the ability to switch between 
"full scan" and random access but it would be useful if this was able to be 
specified by the user.

If I'm missing some option please let me know, otherwise happy to raise an 
issue about this,

Thanks.

Keiran Raine, M.Sc., MBCS
Principal Software Developer
Cancer, Ageing and Somatic Mutation
Wellcome Sanger Institute

k...@sanger.ac.uk<mailto:k...@sanger.ac.uk>
Office: D3-19
Ext: 4983

Please note that due to childcare requirements due to covid restrictions I am 
generally not available after 4pm.
-- The Wellcome 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.



-- 
 The Wellcome 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
Samtools-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/samtools-help

Reply via email to