for file in *.bam; do
base_name=$(basename $file .grch37.bam);
samtools addreplacerg -r "SM:${base_name}" -o ${base_name}.bam $file;
done
Already using this but I get The supplied RG line lacks an ID ta error
I have a group of bam files but some of them do not have sample name SM in @RG,
example: sample1.gh37.bam
@RG ID:13048 CN:BCCAGSC LB:NA PL:illumina PU:NA SM:N/A
I want to add the file name (but without "gh37.bam" suffix) to SM , to get something like this
@RG ID:13048 CN:BCCAGSC LB:NA PL:illumina PU:NA SM:sample1
Any help how I can do it
picard AddOrReplaceReadGroups https://broadinstitute.github.io/picard/command-line-overview.html#AddOrReplaceReadGroups or samtools addreplacerg
for file in *.bam; do
base_name=$(basename $file .grch37.bam);
samtools addreplacerg -r "SM:${base_name}" -o ${base_name}.bam $file;
done
Already using this but I get The supplied RG line lacks an ID ta error
option -r "ID:xxxx" is required.
I do not want to change the ID, its the same. How can I adjust it?
http://www.htslib.org/doc/samtools-addreplacerg.html
-R STRING Allows you to specify the read group ID of an existing @RG line and applies it to the reads specified.
Log in to answer this question.