<p>Usually it doesn't actually matter, but if you want it to be very correct:</p>

<pre><code>RGID=SomeLibraryID \
RGLB=SomeLibraryID \
RGPL=illumina \
RGPU=Some_Sequencer_ID \
RGSM=SomeSampleID
</code></pre>

<p>That assumes you have one library per sample and aren't splitting the output BAM files by lane.</p>

CC BY-SA 4.0
2019-02-18T13:16:43.677Z
Is it possible to get it automatically determine by reading the FASTQ header or filename?
user977828
CC BY-SA 4.0
2019-02-18T13:18:12.357Z
If you have control of how the data is produced then yes, you can set all of that automatically. Otherwise you can't be certain the file/read names are meaningful.
Devon Ryan
CC BY-SA 4.0
2019-02-18T11:33:19.420Z
2019-02-18T11:33:19.420Z
Devon Ryan
<p>Which Read Groups are correct:</p>

<pre><code>java -Xmx4G -jar picard.jar AddOrReplaceReadGroups \
I=$SNIC_TMP/WCRO84_S23_L005.bam \
O=WCRO84_S23_L005.bam \
RGID=WCRO84_S23_L005 \
RGLB=WCRO84 \
RGPL=illumina \
RGPU=WCRO84_S23_L005 \
RGSM=WCRO84
</code></pre>

<p>or</p>

<pre><code>java -Xmx4G -jar picard.jar AddOrReplaceReadGroups \
I=$SNIC_TMP/WCRO84_S23_L005.bam \
O=WCRO84_S23_L005.bam \
RGID=WCRO84_S23_L005 \
RGLB=WCRO84_S23_L005 \
RGPL=illumina \
RGPU=WCRO84_S23_L005 \
RGSM=WCRO84_S23_L005
</code></pre>

<p>Or is a better way to determine read groups?</p>

<p>Thank you in advance,</p>

<phylogenetics><sam><bwa><picard>
Determining Read Groups
# Determining Read Groups

(Asked by: username_0 on 2019-02-18)

Which Read Groups are correct:
java -Xmx4G -jar picard.jar AddOrReplaceReadGroups \
I=$SNIC_TMP/WCRO84_S23_L005.bam \
O=WCRO84_S23_L005.bam \
RGID=WCRO84_S23_L005 \
RGLB=WCRO84 \
RGPL=illumina \
RGPU=WCRO84_S23_L005 \
RGSM=WCRO84

or
java -Xmx4G -jar picard.jar AddOrReplaceReadGroups \
I=$SNIC_TMP/WCRO84_S23_L005.bam \
O=WCRO84_S23_L005.bam \
RGID=WCRO84_S23_L005 \
RGLB=WCRO84_S23_L005 \
RGPL=illumina \
RGPU=WCRO84_S23_L005 \
RGSM=WCRO84_S23_L005

Or is a better way to determine read groups?
Thank you in advance,

**Tags:** phylogenetics, sam, bwa, picard

---

## 1 answers

### Answer by username_1 on 2019-02-18. Score: 4

Usually it doesn't actually matter, but if you want it to be very correct:
RGID=SomeLibraryID \
RGLB=SomeLibraryID \
RGPL=illumina \
RGPU=Some_Sequencer_ID \
RGSM=SomeSampleID

That assumes you have one library per sample and aren't splitting the output BAM files by lane.

> **Comments:**
> **username_0**: Is it possible to get it automatically determine by reading the FASTQ header or filename?  
> **username_1**: If you have control of how the data is produced then yes, you can set all of that automatically. Otherwise you can't be certain the file/read names are meaningful.  

---

