This is a test version of Biostars. For the public version, visit https://www.biostars.org.
adding RG tags to sorted bam file

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

alignment snp

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.

X is given as sample name

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

I can recommend Picard:

java -jar $picard_dir/AddOrReplaceReadGroups.jar

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

Thank you

0 answers

No answers yet.

Log in to answer this question.