Skip to content
Snippets Groups Projects
Commit 1ddac80f authored by Laura Cook's avatar Laura Cook
Browse files

first commit - subsample BAM files to the desired read number

parent 708da2b7
No related branches found
No related tags found
No related merge requests found
TRA=($(for file in *_q30.sorted.dedup.bam; do echo $file |cut -d "_" -f 1-3;done))
echo ${TRA[@]}
for tr in ${TRA[@]};
do
echo ${tr}
frac=$( samtools idxstats ${tr}_q30.sorted.dedup.bam | cut -f3 | awk 'BEGIN {total=0} {total += $1} END {frac=10000000/total; if (frac > 1) {print 1} else {print frac}}' )
samtools view -bs $frac ${tr}_q30.sorted.dedup.bam > ../../results_10M/bwa/${tr}_q30.sorted.dedup.bam
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment