metagene ERROR in plot and other function
2
1
Entering edit mode
arinaldi ▴ 10
@arinaldi-9621
Last seen 7.8 years ago

Hi,

I'm using metagene package to make some plot.

I ve tried different bam file but always new() command is ok while each other give me this error:

Error in intoNbins(gr, bcount) : all 'width(gr)' must be >= 'n'

Why?

Thank All

metagene • 1.6k views
ADD COMMENT
2
Entering edit mode
@charles-joly-beauparlant-4777
Last seen 5.1 years ago
Canada

Hello arinaldi,

The problem you have is because metagene will try to split all the regions into 100 bins by defaults to make sure all the regions have the same size. In your data, some regions are probably smaller than 100 nucleotides, which is why there is the error message you saw.

You have two options to solve this problem:

1. You can resize your regions before starting the metagene analysis. For example, if you want to resize all your original regions to 200 nucleotides:

resized_regions <- resize(original_regions, 200, fix = "center")

2. You can reduce the number of bins. For instance, if you saved the metagene object in a variable named mg:

mg$produce_matrices(bin_count = 50)

mg$plot()

With option 1, each bin will always represent the same number of nucleotides (i.e.: if your regions all have a size of 200 nucleotides and the bin_size is 100, each bin will contain the average coverage of 2 nucleotides). With option 2, if the regions have different sizes, the number of nucleotide of each bin will be different for each region.

Here is a visual representation on how the bins are produced:

https://www.dropbox.com/s/9i7dqd3687hvij5/bin_explanation.pdf?dl=0

Thank you for your interest in metagene!

Charles.

ADD COMMENT
0
Entering edit mode

That link is no longer available.

ADD REPLY
0
Entering edit mode

Here is a new dropbox link:

https://www.dropbox.com/s/ryg9xzcffh0m2vp/bin_explanation.pdf?dl=0

I added a Imgur link in case the dropbox one dies again:

https://imgur.com/wo0UGio

 

ADD REPLY
0
Entering edit mode
arinaldi ▴ 10
@arinaldi-9621
Last seen 7.8 years ago

Thank Charles, very useful.

ADD COMMENT

Login before adding your answer.

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