Biostar Beta. Not for public use.
Error with samtools rmdup
1
Entering edit mode
14 months ago
Bella_p • 50

Hi,

I'm trying to pipe the following commands for ChipSeq analysis:

${bowtie2_source} -x ${ref_genome} -U ${fastq_file} -S - | ${samtools} view -Shub - | ${samtools} sort - | ${samtools} rmdup -S - - ${target_dir}/${sample_name}.bam

Up till the sorting part it works fine, but in the end, no bam file is created and it gives me the message:

[bam_rmdup] input SAM does not have header. Abort!

What is the problem? and How should I fix it?

Thanks!

ADD COMMENTlink
0
Entering edit mode

What have you tried? Have you tried running each step individually and then changed parameters before the step where it goes wrong?

ADD REPLYlink
0
Entering edit mode

Hello Bella_p! Please follow up on your previous thread: https://www.biostars.org/p/306502/#306756 For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with. If you disagree please tell us why in a reply below, we'll be happy to talk about it. Cheers! EDIT: I was mistaken - you are correct, this is a new question that is sufficiently separated from your question in the previous post. Please accept my apologies. Your question has been reopened.

ADD REPLYlink
0
Entering edit mode

How come it doesn't fit this site? This is a proper bioinformatic topic in which I haven't got a good answer in my previous post. What does not fit? It is about ChipSep pipeline that I'm struggling with, and this is the perfect site to get help. Please clarify that to me.

ADD REPLYlink
0
Entering edit mode

Post closing moderator action uses a pre-set text message. I have removed that line from message above (which @Ram forgot to do).

Since this exact question was answered by @Wouter in the other thread you should follow-up on it there.

ADD REPLYlink
0
Entering edit mode

It wasn't the same question. The first question was answered by other user. Then I asked another question, that did not resolved

ADD REPLYlink
1
Entering edit mode

Correct. You asked a new question in the thread you already had open (C: Error in samtools view ) due to a new error that came up as a part of continuation of analysis. It is useful to resolve it there as the original thread contains other relevant information (which would need to be repeated here to provide context).

ADD REPLYlink
1
Entering edit mode

The way this site works best is if new questions are not posted in comments.

Repeating a question originally posted as comment as a new post is the correct course of action.

ADD REPLYlink
0
Entering edit mode

Did you get an error? Or did the suggestion not work?

In general when this kind of error occurs you should remove one set of command from the end of a set of pipes to backtrack and figure out which step is causing the failure.

ADD REPLYlink
0
Entering edit mode

The suggestion didn't worked. The problem is with samtools rmdup, since up to samtools sort, it worked fine. But I don't know how to fix it

ADD REPLYlink
0
Entering edit mode

What about samtools sort -O BAM?

ADD REPLYlink
0
Entering edit mode

Apologies - as genomax stated, that message was part of the template. I closed this post so your other post would be the place to go to for someone facing a similar problem. It helps us keep the discussion coherent, and all people that contribute have all the relevant information on the steps that went into resolving the issue.

Please do not go off of the "not relevant" part - that sentence was left in by mistake, and I apologize for that. Let us continue discussing your question in your other post.

ADD REPLYlink
0
Entering edit mode

No worries! Thank you!

ADD REPLYlink
0
Entering edit mode

I tried, bur samtools rmdup didn't work. So, I decided in the meantime to end it with samtools sort, and the script that worked for me was:

${bowtie2_source} -x ${ref_genome} -U ${fastq_file} -S - | ${samtools} view -Shub - | ${samtools} sort -o ${target_dir}/${sample_name}.bam
ADD REPLYlink
0
Entering edit mode

Has anyone told you that you don't need the samtools view step?

ADD REPLYlink
0
Entering edit mode

@Istvan did. In his answer below :-)

ADD REPLYlink
4
Entering edit mode
3 months ago
University Park, USA

In the last step you seem to specify two - flags, I think that might attempt to open the stream twice, and since the second time it is empty, there is no header information.

${samtools} rmdup -S - - ${target_dir}/${sample_name}.bam

In general, in such cases decompose the command into individual steps, each operating on a differently named file, then investigate the resulting file after each step.

The samtools error says that the SAM file does not have a header - check the file yourself - does it have a header?

BTW the samtools view step is not needed anymore, all samtools actions will auto detect and work seamlessly on SAM or BAM files. I also think that samtools now detects input stream, so specifying the - should not be needed in say sorting. The commands chain together much more elegantly now.

ADD COMMENTlink
0
Entering edit mode

Thanks! I'll try that

ADD REPLYlink
0
Entering edit mode

Since you accepted this answer a suggestion in this must have worked. Can you post what changes you made to the command line here so they would be useful for someone else in future?

ADD REPLYlink
0
Entering edit mode

I tried, but samtools rmdup didn't work with the current piping. So I decided not to use it for now, and to end it with samtolos sort. The script that worked for me was:

${bowtie2_source} -x ${ref_genome} -U ${fastq_file} -S - | ${samtools} view -Shub - | ${samtools} sort -o 
${target_dir}/${sample_name}.bam
ADD REPLYlink

Login before adding your answer.

Similar Posts
Loading Similar Posts
Powered by the version 2.1