bedtools error

0

I'm trying to use the bedtools genomecov functionality for a number of bam files currently accessible to me as softlinks in a given directory. I include here below some pseudocode which reflect the current script I'm trying to run.

RUN_PATH=$1
DEST_PATH=$2
for bam in $RUN_PATH/*
do
    file= realpath $bam
    name=$($file | rev | cut -d "https://www.biostars.org/" -f 2 | cut -d "." -f 1 | rev );
    bedtools genomecov -ibam $file -bga > $2/$name.gencov.tsv;
done

When I try to run this code I get an error saying:

Failed to open BAM file -bga

I've attempted moving the arguments around and that doesn't seem to work. I'm guessing its probably because of how I'm resolving the soft links but I can't seem to figure out why. I've tried including echo $file just to check that the file path is correct (which it is as far as I can tell). I've previously been able to run this successfully but by copying the actual files to my desired directory, and I'm trying to use soft links this time around to try and avoid making duplicates of hundreds of BAM files.

I'd appreciate any help on this matter.


bedtools


bash

• 19 views


Login
before adding your answer.

Traffic: 1510 users visited in the last hour



Source link