Samtools depth error in bash script

Samtools depth error in bash script

0

Hi!

I wrote a bash script to run Samtools depth, but it gives the following error:

/storage1/kaman/onceta/cover/brca12_uniq.bed
/storage1/kaman/onceta/cover/ENIGMA_uniq.bed
/storage1/kaman/onceta/cover/bam/26m_s67_l001_r1_001_alignment
[bed_read] Parse error reading "26m_s67_l001_r1_001_alignment.bam" at line 1
samtools depth: Could not read file "26m_s67_l001_r1_001_alignment.bam"

The script looks like this

brca12_bed= realpath brca12_uniq.bed
enigma_bed= realpath ENIGMA_uniq.bed

cd bam
for file in *.bam
do
    dir="${file%.bam}"
    mkdir -- "$dir"
    mv -- "$file" "$dir"
    cd "$dir"
    pwd
    samtools depth -a -b $brca12_bed $file > test.depth
done

At first I thought that the reason was in the wrong directory, but in this case, the script gives a different error

/storage1/kaman/onceta/cover/brca12_uniq.bed
/storage1/kaman/onceta/cover/ENIGMA_uniq.bed
samtools depth: Could not read file "26m_s67_l001_r1_001_alignment.bam": No such file or directory

Please help me find the error


samtools


depth

• 33 views

Read more here: Source link