gatk BuildBamIndex --INPUT 05_DeDuplicate/${sample}_dedup.bam && cp
/home/ubuntu/00_NA12878/00_References/chr.list ./ &&
for i in `cat chr.list`; do samtools view -bh
05_DeDuplicate/${sample}_dedup.bam ${i} >
05_DeDuplicate/${sample}_dedup.${i}.bam ; done 23 for i in `cat chr.list`;
do gatk BuildBamIndex --INPUT 05_DeDuplicate/${sample}_dedup.${i}.bam; done
>
NA12878_dedup.00_RawData.bai
NA12878_dedup.00_RawData.bam
NA12878_dedup.00_References.bai
NA12878_dedup.00_References.bam
NA12878_dedup.01_FASTQC.bai
NA12878_dedup.01_FASTQC.bam
NA12878_dedup.02_Trimmomatic.bai
NA12878_dedup.02_Trimmomatic.bam
NA12878_dedup.03_BWA.bai
NA12878_dedup.03_BWA.bam
NA12878_dedup.04_Sort.bai
NA12878_dedup.04_Sort.bam
NA12878_dedup.05_DeDuplicate.bai
NA12878_dedup.05_DeDuplicate.bam
NA12878_dedup.bai
NA12878_dedup.bam
I run the code above and got the .bam and .bai files of all directories existing in my folder including results by chromosomes which is what I would like to get only in the first place.
I made vi file for this and run it as bash ./{file name} {sample name}
One thing I'm doubting is the name of my root directory started with the same name of sample name. But I indicate the location as INPUT 05_DeDuplicate/${sample}_dedup.bam
in the first line of the code. I have no idea why this happened so far.
Do you see something wrong with the code above or is it something about the sample name?
I will really appreciate your help!