bamtools split ERROR: could not open mybam.bam for writing.
0
0
Entering edit mode
15 months ago

While splitting my bam files using split command creates 'could not open file' error. my ulimit has been changed to unlimited. Headers in my bam file contain special characters like this '/'. Could headers be a reason for the problem?

PS- I could not edit my bam headers.

bam bamtools • 1.2k views
ADD COMMENT
0
Entering edit mode

What was the commands you run? What errors did you get?

ADD REPLY
0
Entering edit mode

Sorry. This is the command I used:

bamtools split -in ERRXXXXXXXX.bam -reference
bamtools split ERROR: could not open ERRXXXXXXXX_XXX(X/XX/XX)_3_XXXX.bam for writing.
ADD REPLY
0
Entering edit mode

Your command looks incomplete and the error message is referencing something not included in the command here. Is that a copy-paste error?

ADD REPLY
0
Entering edit mode

I am quite sure that the provided command is complete. Initially i thought I am encountering an error similar to these below,

But I could not get this rectified based on the solutions given there. So I suspect, it could be due to special characters in the headers. Could anyone help me edit/replace those special characters in the bam file headers?

ADD REPLY
1
Entering edit mode

You need to grab the header from the current file and then edit it to remove / characters. Then use the edited header to reheader the BAM file. Process is roughly described here: Bam Header Edit

Take a look at samtools reheader in-line help.

ADD REPLY

Login before adding your answer.

Traffic: 2002 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