bedtools error
0
0
Entering edit mode
13 days ago

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 "/" -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 • 134 views
ADD COMMENT
1
Entering edit mode
file= realpath $bam

It should be file=$(realpath $bam) so in paranthesis, as a variable, and without the whitespace. Currently $file is empty, therefore -bga is interpreted as the input for -ibam.

ADD REPLY
0
Entering edit mode

Sorry, there was a typo, I edited it. file outside of the parenthesis and the command and file inside of it.

ADD REPLY

Login before adding your answer.

Traffic: 2201 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6