Question: Removing the OQ tag from a BAM file
gravatar for mark.fleharty
4.2 years ago by
United States
mark.fleharty30 wrote:


I'd like to remove a tag (not a read) from a BAM file.  I would like to remove the OQ tag that keeps original qualities after running BQSR.  Any suggestions on how I might do this?




samtools picard gatk • 2.1k views
ADD COMMENTlink modified 4.2 years ago by Pierre Lindenbaum121k • written 4.2 years ago by mark.fleharty30
gravatar for Pierre Lindenbaum
4.2 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum121k wrote:
sed 's/\tOQ\:Z\:[^\t]*//' in.sam > out.sam
ADD COMMENTlink written 4.2 years ago by Pierre Lindenbaum121k

Hi Pierre! I found your answer when I was searching for a way to make bam files (~250GB) smaller by removing base qualities and tags and other unwanted information (doing copy number analysis, for me base qualities and tags are somehow unwanted information). Currently, I am using 'bamUtils squeeze' (I don't know yet how good this tool is in making the bam file smaller [This is replacing QNAME to an integer, removing the duplicates, removing the OG tag but not the QUAL field!]) and previously I used 'cgat bam2bam strip-quality' deleting only the QUAL field (which was slow [12 hours for a 160 GB] and didn't gain much: 3GB smaller for a 160GB file). I was wondering if deleting whatever comes after the SEQ will work (i.e QUAL and all other tags)? and if yes, what would be the fastest way to apply that? Thanks in advance for sharing your ideas!   

ADD REPLYlink written 3.5 years ago by Dataman260

ask this as a new question please.

ADD REPLYlink written 3.5 years ago by Pierre Lindenbaum121k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1631 users visited in the last hour