samtools mpileup's options -b (more than one bam file) and -r cannot be used together
1
0
Entering edit mode
6.0 years ago

Hi, I would like to generate a mpileup file from 2 bam files in some regions instead of the whole chromosomes:

samtools -b bam_list_file -r regions_to_be_parsed.bed > mpileup_from_two_bam_files.pileup

The content in the bam_list_file is

~/1.bam

~/2.bam

but an error was given:

[E::mpileup] fail to parse region 'regions_to_be_parsed.bed' with 1.bam.

I do not think there is something wrong with the bam files or the bed file, because it works when I ran with the following command:

samtools -r regions_to_be_parsed.bed ~/1.bam > mpile1.pileup

samtools -r regions_to_be_parsed.bed ~/2.bam > mpile2.pileup

samtools -b bam_list_file > mpileup_from_two_bam_files.pileup

Is there some way to generate a mpileup file from two bam files with regions in bed file? Thanks for your time!

software error sequence • 2.8k views
ADD COMMENT
0
Entering edit mode

Hello jing.mengrabbit,

Please use the formatting bar (especially the code option) to present your post better.

Formatting bar

For example:

samtools -b bam_list_file -r regions_to_be_parsed.bed > mpileup_from_two_bam_files.pileup

Besides, I believe your command is:

samtools mpileup -b bam_list_file -r regions_to_be_parsed.bed > mpileup_from_two_bam_files.pileup
ADD REPLY
0
Entering edit mode

Thanks for your advice.

ADD REPLY
2
Entering edit mode
6.0 years ago
h.mon 35k

Are you sure about -r regions_to_be_parsed.bed? The help says:

-r, --region REG region in which pileup is generated

I think -r should be used as -r chr1:200-210. For using bed files as intervals, you should use -l:

-l, --positions FILE skip unlisted positions (chr pos) or regions (BED)

ADD COMMENT
0
Entering edit mode

Thanks for your reply. I misunderstood the helper documentation. It should be -l instead of -r as you said.

ADD REPLY

Login before adding your answer.

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