Question: How to change the SM tags of BAM files
0
gravatar for MAPK
23 months ago by
MAPK1.2k
United States
MAPK1.2k wrote:

I have a bam file called contaminated_sample.bam, that was created (for dilution experiment) by mixing proportional amount of reads from two original bam files (Sample_A.bam and Sample_B.bam). I want to create a VCF file using GATK genotyper. This requires me to change the SM tags in contaminated_sample.bam : SM:Sample_A and SM:Sample_B to one unique sample name so that the VCF file will have only one sample (i.e. contaminated_sample). How can I do this using samtools?

bam • 1.6k views
ADD COMMENTlink modified 23 months ago • written 23 months ago by MAPK1.2k
2
gravatar for geek_y
23 months ago by
geek_y8.6k
geek_y8.6k wrote:

AddOrReplaceReadGroups

ADD COMMENTlink written 23 months ago by geek_y8.6k

Thanks. Another question I have is, do I also need to change the tags below or can I only change the SM tag from two different bam files:

RGID=4 \ RGLB=lib1 \ RGPL=illumina \ RGPU=unit1 \

These tags are also different that came from two original bam files. Can I only change the SM tag and not worry about these other tags for creating a vcf file?

ADD REPLYlink modified 23 months ago • written 23 months ago by MAPK1.2k
1

If you run AddOrReplaceReadGroups on your final bam, it will replace all the existing tags. So you will have only 1 read group information and the file is treated as single sample, instead of two, so you will have single VCF.

This tool enables the user to replace all read groups in the INPUT file with a single new read group and assign all reads to this read group in the OUTPUT BAM file

ADD REPLYlink modified 23 months ago • written 23 months ago by geek_y8.6k
Please log in to add an answer.

Help
Access

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