Question: adding RG tags to sorted bam file
0
gravatar for krp0001
3.8 years ago by
krp000120
Sweden
krp000120 wrote:

Hello, 

 

Could anyone help me with adding read groups to the sorted bam files, i have tired with samtools merge but failed and i have found a one line script 

perl -e 'print "\@RG\tID:Disc1\tSM:'$x'\tPL:Illumina\n"' >rg.txt
samtools merge -rh rg.txt - index10.aln.sort.bam

adds the read group but later calling for SNP with freebayes causes an error in the vcf file.

Thank you all

 

 

snp alignment • 2.3k views
ADD COMMENTlink written 3.8 years ago by krp000120
1

samtools merge adds the RG from the filename, not from the header you're adding, so I would assume that you're adding one thing in the header and something else on the end of the individual alignment lines.  Also make sure you have an intact bam header, not just that @RG line.

ADD REPLYlink modified 3.8 years ago • written 3.8 years ago by george.ry1.1k

is x defined ?

ADD REPLYlink written 3.8 years ago by Pierre Lindenbaum115k

X  is given as sample name

ADD REPLYlink written 3.8 years ago by krp000120

Have you tried Picard tools? It has a convenient function for this.

ADD REPLYlink written 3.8 years ago by Devon Ryan86k

I can recommend Picard:  java -jar $picard_dir/AddOrReplaceReadGroups.jar

 

ADD REPLYlink modified 3.8 years ago • written 3.8 years ago by pristanna500

I'm trying Picard, hope it works .., 

thank you

ADD REPLYlink written 3.8 years ago by krp000120
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: 1151 users visited in the last hour