[BioC] error in bayespeak function

Jonathan Cairns Jonathan.Cairns at cancer.org.uk
Wed Jul 20 18:49:33 CEST 2011


Andreia,

That's very strange. What happens when you do:

str(space(GIRanges_JKA))
str(space(GIRanges_JKA_I))

Do either of these result in an error?

You could try attaching the package rtracklayer at the start; I find that this sometimes fixes odd IRanges behaviour.

Jonathan
________________________________________
From: Andreia Fonseca [andreia.fonseca at gmail.com]
Sent: 20 July 2011 17:11
To: Jonathan Cairns
Cc: bioconductor
Subject: Re: error in bayespeak function

Dear Jonathan,

Maybe it helps to see that my both sample and input information are now effectively RangedData objects

IRanges_JKA
RangedData with 3850192 rows and 1 value column across 25 spaces
           space         ranges   | strand
        <factor>      <IRanges>   |  <Rle>
1           chr1 [10071, 10120]   |      +
2           chr1 [10074, 10123]   |      +
3           chr1 [10075, 10124]   |      +
4           chr1 [10075, 10124]   |      -
5           chr1 [10106, 10155]   |      -
6           chr1 [10147, 10196]   |      -
7           chr1 [10148, 10197]   |      +
8           chr1 [10149, 10198]   |      +
9           chr1 [10150, 10199]   |      +
...          ...            ... ...    ...
3850184     chrM [16491, 16540]   |      -
3850185     chrM [16496, 16545]   |      -
3850186     chrM [16499, 16548]   |      +
3850187     chrM [16502, 16551]   |      +
3850188     chrM [16506, 16555]   |      -
3850189     chrM [16507, 16556]   |      +
3850190     chrM [16515, 16564]   |      -
3850191     chrM [16516, 16565]   |      -
3850192     chrM [16521, 16570]   |      +

IRanges_JKA_I
RangedData with 6443227 rows and 1 value column across 25 spaces
           space         ranges   | strand
        <factor>      <IRanges>   |  <Rle>
1           chr1 [10073, 10122]   |      -
2           chr1 [10165, 10214]   |      +
3           chr1 [10445, 10494]   |      +
4           chr1 [13064, 13113]   |      +
5           chr1 [16060, 16109]   |      +
6           chr1 [16416, 16465]   |      -
7           chr1 [20103, 20152]   |      +
8           chr1 [20103, 20152]   |      +
9           chr1 [51428, 51477]   |      -
...          ...            ... ...    ...
6443219     chrM [16509, 16558]   |      +
6443220     chrM [16511, 16560]   |      -
6443221     chrM [16512, 16561]   |      +
6443222     chrM [16513, 16562]   |      -
6443223     chrM [16516, 16565]   |      +
6443224     chrM [16516, 16565]   |      -
6443225     chrM [16517, 16566]   |      +
6443226     chrM [16518, 16567]   |      -
6443227     chrM [16520, 16569]   |      -


On Wed, Jul 20, 2011 at 4:00 PM, Andreia Fonseca <andreia.fonseca at gmail.com<mailto:andreia.fonseca at gmail.com>> wrote:
Hi Jonathan,

thanks for the help, I have another error now! I have changed the code as you suggested and I also spotted that in bayespeak I was calling the bam object instead of the IRanges object, still the IRanges object is not proper as you mentioned. I manage to create a RangeData object but :


#call libraries
library(GenomicRanges)
library(BayesPeak)
library(ShortRead)
library(chipseq)
library(ChIPpeakAnno)
library(multicore)
library(GenomicFeatures)

#read sample JKA
JKA<-asBam("110402_SN365_B_s_2_seq_GQG-1.txt_TABLE_filtered.txt_unique_forfastq.fastq_SAM", overwrite=TRUE,destination="110402_SN365_B_s_2_seq_GQG-1.txt_TABLE_filtered.txt_unique_forfastq.fastq_SAM_BAM")
Granges_JKA<-readBamGappedAlignments(JKA)
GIRanges_JKA<-as(Granges_JKA, "GRanges")
IRanges_JKA<-as(GIRanges_JKA, "RangedData")


#read Input JKA
JKA_I<-asBam("110402_SN365_B_s_2_seq_GQG-2.txt_TABLE_filtered.txt_unique_forfastq.fastq_SAM", overwrite=TRUE,destination="110402_SN365_B_s_2_seq_GQG-1.txt_TABLE_filtered.txt_unique_forfastq.fastq_SAM_BAM")
Granges_JKA_I<-readBamGappedAlignments(JKA_I)
GIRanges_JKA_I<-as(Granges_JKA_I, "GRanges")
IRanges_JKA_I<-as(GIRanges_JKA_I, "RangedData")


#Peak Calling with BayesPeak
raw.output <- bayespeak(treatment=IRanges_JKA, control=IRanges_JKA_I,use.multicore = TRUE, mc.cores = 4)

error message

Error in `[.default`(space(bed), sel) : invalid subscript type 'S4'

any idea?
thanks




On Wed, Jul 20, 2011 at 3:38 PM, Jonathan Cairns <Jonathan.Cairns at cancer.org.uk<mailto:Jonathan.Cairns at cancer.org.uk>> wrote:
Hi Andreia,

On the line "IRanges_JKA<-ranges(Granges_JKA)", you are converting a genomicRanges object to an IRanges object. BayesPeak accepts a RangedData object, as opposed to an IRanges object (in order to retain chromosome information). Replace

IRanges_JKA<-ranges(Granges_JKA)

with

IRanges_JKA<-as(Granges_JKA, "RangedData")

and it should run properly.

Hope this helps,

Jonathan


P.S. additionally, the line Library(BayesPeak) should be library(BayesPeak) - you obviously know this, else you wouldn't be getting the correct sessionInfo(), but I point this out in case anybody else tries to run the code...

________________________________________
From: Andreia Fonseca [andreia.fonseca at gmail.com<mailto:andreia.fonseca at gmail.com>]
Sent: 20 July 2011 15:24
To: Jonathan Cairns; bioconductor
Subject: error in bayespeak function

Dear all,

I am analyzing chipseq data and I am trying to use bayespeak package for peak detection.
The code that I am using is

#call libraries
library(GenomicRanges)
Library(BayesPeak)
library(ShortRead)
library(chipseq)
library(ChIPpeakAnno)
library(multicore)
library(GenomicFeatures)

#read sample JKA
JKA<-asBam("110402_SN365_B_s_2_seq_GQG-1.txt_TABLE_filtered.txt_unique_forfastq.fastq_SAM", overwrite=TRUE,destination="110402_SN365_B_s_2_seq_GQG-1.txt_TABLE_filtered.txt_unique_forfastq.fastq_SAM_BAM")
Granges_JKA<-readBamGappedAlignments(JKA)
IRanges_JKA<-ranges(Granges_JKA)

#read Input JKA
JKA_I<-asBam("110402_SN365_B_s_2_seq_GQG-2.txt_TABLE_filtered.txt_unique_forfastq.fastq_SAM", overwrite=TRUE,destination="110402_SN365_B_s_2_seq_GQG-1.txt_TABLE_filtered.txt_unique_forfastq.fastq_SAM_BAM")
Granges_JKA_I<-readBamGappedAlignments(JKA_I)
IRanges_JKA_I<-ranges(Granges_JKA_I)

#Peak Calling with BayesPeak
raw.output <- bayespeak(treatment=JKA, control=JKA_I,use.multicore = TRUE, mc.cores = 4)

after the last command I am getting the forllowing error:
Error in substring(temp[1], 1, 5) : invalid multibyte string at '<ed>'

I also tried to remove the use of parallelization but the error remains the same, can someone tell me what I am doing wrong ?
thanks for the help,
Andreia

bellow is the information concerning sessionInfo

sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
 [1] BayesPeak_1.4.0                     GenomicFeatures_1.4.3
 [3] multicore_0.1-5                     ChIPpeakAnno_1.8.0
 [5] limma_3.8.2                         org.Hs.eg.db_2.5.0
 [7] GO.db_2.4.1                         RSQLite_0.9-1
 [9] DBI_0.2-5                           AnnotationDbi_1.14.1
[11] BSgenome.Ecoli.NCBI.20080805_1.3.17 multtest_2.8.0
[13] Biobase_2.12.2                      biomaRt_2.8.1
[15] chipseq_1.2.0                       BSgenome_1.20.0
[17] ShortRead_1.10.4                    Rsamtools_1.4.2
[19] lattice_0.19-30                     Biostrings_2.20.1
[21] GenomicRanges_1.4.6                 IRanges_1.10.4

loaded via a namespace (and not attached):
[1] grid_2.13.1        hwriter_1.2        MASS_7.3-13        RCurl_1.4-2
[5] rtracklayer_1.12.4 splines_2.13.1     survival_2.36-9    tools_2.13.1
[9] XML_3.1-0


--
---------------------------------------------------------------------------------------------
Andreia J. Amaral, PhD
BioFIG - Center for Biodiversity, Functional and Integrative Genomics
Instituto de Medicina Molecular
University of Lisbon
Tel: +352 217500000 (ext. office: 28253)
email:andreiaamaral at fm.ul.pt<mailto:email%3Aandreiaamaral at fm.ul.pt><mailto:email%3Aandreiaamaral at fm.ul.pt<mailto:email%253Aandreiaamaral at fm.ul.pt>> ; andreiaamaral at fc.ul.pt<mailto:andreiaamaral at fc.ul.pt><mailto:andreiaamaral at fc.ul.pt<mailto:andreiaamaral at fc.ul.pt>>


NOTICE AND DISCLAIMER
This e-mail (including any attachments) is intended for the above-named person(s). If you are not the intended recipient, notify the sender immediately, delete this email from your system and do not disclose or use for any purpose.

We may monitor all incoming and outgoing emails in line with current legislation. We have taken steps to ensure that this email and attachments are free from any virus, but it remains your responsibility to ensure that viruses do not adversely affect you.
Cancer Research UK
Registered in England and Wales
Company Registered Number: 4325234.
Registered Charity Number: 1089464 and Scotland SC041666
Registered Office Address: Angel Building, 407 St John Street, London EC1V 4AD.



--
---------------------------------------------------------------------------------------------
Andreia J. Amaral, PhD
BioFIG - Center for Biodiversity, Functional and Integrative Genomics
Instituto de Medicina Molecular
University of Lisbon
Tel: +352 217500000 (ext. office: 28253)
email:andreiaamaral at fm.ul.pt<mailto:email%3Aandreiaamaral at fm.ul.pt> ; andreiaamaral at fc.ul.pt<mailto:andreiaamaral at fc.ul.pt>




--
---------------------------------------------------------------------------------------------
Andreia J. Amaral, PhD
BioFIG - Center for Biodiversity, Functional and Integrative Genomics
Instituto de Medicina Molecular
University of Lisbon
Tel: +352 217500000 (ext. office: 28253)
email:andreiaamaral at fm.ul.pt<mailto:email%3Aandreiaamaral at fm.ul.pt> ; andreiaamaral at fc.ul.pt<mailto:andreiaamaral at fc.ul.pt>


NOTICE AND DISCLAIMER
This e-mail (including any attachments) is intended for the above-named person(s). If you are not the intended recipient, notify the sender immediately, delete this email from your system and do not disclose or use for any purpose. 

We may monitor all incoming and outgoing emails in line with current legislation. We have taken steps to ensure that this email and attachments are free from any virus, but it remains your responsibility to ensure that viruses do not adversely affect you. 
Cancer Research UK
Registered in England and Wales
Company Registered Number: 4325234.
Registered Charity Number: 1089464 and Scotland SC041666
Registered Office Address: Angel Building, 407 St John Street, London EC1V 4AD.



More information about the Bioconductor mailing list