I need some help I want to pipe the output from samtools to picard readgrous commands but I am failing:
bowtie2 -x bowtie2_index_hg38 -1 R1.fq.gz -2 R2.fq.gz | samtools view -Shb - | samtools sort - output
What I want to achieve is the following is to also add the read groups the output.bam file from above command and also index the output bam file with reads groups. I am failing with the following command and I dont know how to also index the output bam file that has the read group.
bowtie2 -x bowtie2_index_hg38 -1 mrg_sample_1_R1_val_1.fq -2 mrg_sample_1_R2_val_2.fq | samtools view -Shb - | samtools sort - - | picard AddOrReplaceReadGroups I= output.bam O=rg_output.bam RGID=sample_1 RGLB=sample_1 RGPL=illumina_hi-seq RGPU=sample_1 RGSM=sample_1
Can someone please help me?