Thank you for your very clear answer, it was great help.

... I'm ashamed to ask... what is the dash ( "-" )before redirecting the output?
i.e.: flagstat - > myfile.stats. If I don't use the dash, it gives me a broken 
pipe error. I did some googling, still not sure of its meaning.

Kind Regards,
Max

________________________________________
From: James Bonfield <j...@sanger.ac.uk>
Sent: Thursday, April 28, 2016 4:34 AM
To: Tagliamonte,Massimiliano S
Cc: samtools-help@lists.sourceforge.net
Subject: Re: [Samtools-help] number of mapped reads with flagstat

On Wed, Apr 27, 2016 at 09:07:36PM +0000, Tagliamonte,Massimiliano S wrote:
> My two questions:
>
> 1) Is this strategy correct?

Yes, but you can pipe the two together instead of using a temporary
file.  This is useful if you don't need to store the version with
duplicates removed.  Use -u (uncompressed) for this as it's faster.

> 2) if in step 1) I want to get rid of flag 0x100 and 0x400 (duplicates which 
> I marked with Picard), how can I combine the two flags?

They are single-bit values so you can simply add (bitwise OR) them together.

E.g.

samtools view -F 0x500 myfile.sorted.bam | samtools flagstat - > myfile.stats

Each -F does an "OR" op anyway so you can do -F 0x100 -F 0x400 if you
prefer.

--
James Bonfield (j...@sanger.ac.uk) | 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.

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Samtools-help mailing list
Samtools-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/samtools-help

Reply via email to