Entering edit mode
10 weeks ago
brandnewatthis
•
0
I am trying to use the following code to add read groups to a set of six files, however, I keep getting error messages. I am horrible at writing bash scripts since I've only really started doing this about a month ago, so any help is much appreciated!
bams=/data/Bamfiles
for file in $bams/*_md.bam
do
java -jar $picard AddOrReplaceReadGroups INPUT=$bams OUTPUT=${bams%_md.bam}_RG.bam RGPU=AB6723 RGID=${file%_md.bam} RGPL=Illumina RGLB=PAIRED RGSM=${file%_md.bam}
samtools index ${mdbam%_md.bam}_RG.bam
done
Errors: [E::hts_open_format] fail to open file '/data/Bamfiles/PF203_RG.bam'
samtools index: failed to open "/data/Bamfiles/PF203_RG.bam": No such file or directory