User:Lindenb/Notebook/UMR915/20100615
From OpenWetWare
merging all the bam per individuals:
for I in `tr -s " " < ../Iomega_HDD/fastq/*_fastq.txt | cut -d ' ' -f 4 | grep -v sample | sort | uniq` do echo "Individual $I" F=`tr -s " " < ../Iomega_HDD/fastq/*_fastq.txt | cut -d ' ' -f 4,9 | grep -w $I | sed 's%.*/\([0-9]*_[0-9]*\)_[12].fastq%\1%' | sort | uniq | awk '{printf("bwa_%s.sorted.bam ",$1);}'` samtools merge ${I}.bam ${F} samtools index ${I}.bam done
Removing the duplicates from the bams with picard
for F in X1.bam X2.bam ... do java -jar /usr/local/package/picard-tools-1.22/MarkDuplicates.jar \ I=${F}.bam O=bwa_rmdup_${F}.bam \ REMOVE_DUPLICATES=true AS=true VALIDATION_STRINGENCY=SILENT METRICS_FILE=${F}.rmdup.metrics done