Replacing GRanges mcol makes it inaccessible
1
0
Entering edit mode
Shraddha Pai ▴ 80
@shraddha-pai-5861
Last seen 9.6 years ago
Hi all, After I update the metadata on a Granges() object, I can no longer access the object. This happens on a Granges() object generated from the GFF3 file; I don't know if that matters. Here is the code to reproduce the error message. The gff file in question is from miRbase: ftp://mirbase.org/pub/mirbase/CURRENT/genomes/hsa.gff3 Has anyone else experienced this problem? Is there something different about a GRanges object generated by import()? I have also tried first setting mcols() to NULL and then doing mcols(x) <- tmp (putting in my new content), but that results in the same error. Thanks in advance, Shraddha ----- Shraddha Pai, Ph.D. Post-doctoral fellow Krembil Family Epigenetic Research Laboratory (Lab head: Dr. Art Petronis) Centre for Addiction and Mental Health, Toronto ------------------------------------------- > require(rtracklayer) > x <- import("hsa.gff3") > tmp <- mcols(x) > tmp <- cbind(as.data.frame(tmp), new_column="abc") > head(x) GRanges with 6 ranges and 8 metadata columns: seqnames ranges strand | source type <rle> <iranges> <rle> | <factor> <factor> [1] chr1 [ 17369, 17436] - | <na> miRNA_primary_transcript [2] chr1 [ 17409, 17431] - | <na> miRNA [3] chr1 [ 17369, 17391] - | <na> miRNA [4] chr1 [ 30366, 30503] + | <na> miRNA_primary_transcript [5] chr1 [ 30438, 30458] + | <na> miRNA [6] chr1 [567705, 567793] - | <na> miRNA_primary_transcript score phase ID Alias Name <numeric> <integer> <character> <characterlist> <character> [1] <na> <na> MI0022705 MI0022705 hsa-mir-6859-1 [2] <na> <na> MIMAT0027618 MIMAT0027618 hsa-miR-6859-5p [3] <na> <na> MIMAT0027619 MIMAT0027619 hsa-miR-6859-3p [4] <na> <na> MI0006363 MI0006363 hsa-mir-1302-2 [5] <na> <na> MIMAT0005890 MIMAT0005890 hsa-miR-1302 [6] <na> <na> MI0022558 MI0022558 hsa-mir-6723 Derives_from <character> [1] <na> [2] MI0022705 [3] MI0022705 [4] <na> [5] MI0006363 [6] <na> --- seqlengths: chr1 chr10 chr11 chr12 chr13 chr14 ... chr6 chr7 chr8 chr9 chrX chrY NA NA NA NA NA NA ... NA NA NA NA NA NA > mcols(x) <- tmp > head(x) Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'extractROWS' for signature '"AsIs"' > x GRanges with 4665 ranges and 9 metadata columns: Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'extractROWS' for signature '"AsIs"' ---- Here is the output from sessionInfo() > sessionInfo() R version 3.0.1 (2013-05-16) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] C attached base packages: [1] parallel stats graphics grDevices utils datasets methods [8] base other attached packages: [1] rtracklayer_1.22.2 GenomicRanges_1.14.4 XVector_0.2.0 [4] IRanges_1.20.6 BiocGenerics_0.8.0 loaded via a namespace (and not attached): [1] BSgenome_1.30.0 Biostrings_2.30.1 RCurl_1.95-4.1 Rsamtools_1.14.2 [5] XML_3.98-1.1 bitops_1.0-6 stats4_3.0.1 tools_3.0.1 [9] zlibbioc_1.8.0
• 2.6k views
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 2.4 years ago
United States
On Fri, May 30, 2014 at 8:48 AM, Shraddha Pai <shraddha.pai@camh.ca> wrote: > Hi all, > After I update the metadata on a Granges() object, I can no longer access > the object. This happens on a Granges() object generated from the GFF3 > file; I don't know if that matters. > > Here is the code to reproduce the error message. The gff file in question > is from miRbase: ftp://mirbase.org/pub/mirbase/CURRENT/genomes/hsa.gff3 > > Has anyone else experienced this problem? Is there something different > about a GRanges object generated by import()? > I have also tried first setting mcols() to NULL and then doing mcols(x) <- > tmp (putting in my new content), but that results in the same error. > > Thanks in advance, > Shraddha > ----- > Shraddha Pai, Ph.D. > Post-doctoral fellow > Krembil Family Epigenetic Research Laboratory (Lab head: Dr. Art Petronis) > Centre for Addiction and Mental Health, Toronto > > ------------------------------------------- > > > > require(rtracklayer) > > x <- import("hsa.gff3") > > tmp <- mcols(x) > > tmp <- cbind(as.data.frame(tmp), new_column="abc") > I think you want either: mcols(x)$new_column <- "abs" or the shortcut: x$new_column <- "abs" This a bug though; will fix. > head(x) > GRanges with 6 ranges and 8 metadata columns: > seqnames ranges strand | source type > <rle> <iranges> <rle> | <factor> <factor> > [1] chr1 [ 17369, 17436] - | <na> miRNA_primary_transcript > [2] chr1 [ 17409, 17431] - | <na> miRNA > [3] chr1 [ 17369, 17391] - | <na> miRNA > [4] chr1 [ 30366, 30503] + | <na> miRNA_primary_transcript > [5] chr1 [ 30438, 30458] + | <na> miRNA > [6] chr1 [567705, 567793] - | <na> miRNA_primary_transcript > score phase ID Alias Name > <numeric> <integer> <character> <characterlist> <character> > [1] <na> <na> MI0022705 MI0022705 hsa- mir-6859-1 > [2] <na> <na> MIMAT0027618 MIMAT0027618 hsa- miR-6859-5p > [3] <na> <na> MIMAT0027619 MIMAT0027619 hsa- miR-6859-3p > [4] <na> <na> MI0006363 MI0006363 hsa- mir-1302-2 > [5] <na> <na> MIMAT0005890 MIMAT0005890 hsa- miR-1302 > [6] <na> <na> MI0022558 MI0022558 hsa- mir-6723 > Derives_from > <character> > [1] <na> > [2] MI0022705 > [3] MI0022705 > [4] <na> > [5] MI0006363 > [6] <na> > --- > seqlengths: > chr1 chr10 chr11 chr12 chr13 chr14 ... chr6 chr7 chr8 chr9 chrX > chrY > NA NA NA NA NA NA ... NA NA NA NA NA > NA > > mcols(x) <- tmp > > head(x) > Error in (function (classes, fdef, mtable) : > unable to find an inherited method for function 'extractROWS' for > signature '"AsIs"' > > x > GRanges with 4665 ranges and 9 metadata columns: > Error in (function (classes, fdef, mtable) : > unable to find an inherited method for function 'extractROWS' for > signature '"AsIs"' > > ---- > Here is the output from sessionInfo() > > sessionInfo() > R version 3.0.1 (2013-05-16) > Platform: x86_64-pc-linux-gnu (64-bit) > > locale: > [1] C > > attached base packages: > [1] parallel stats graphics grDevices utils datasets methods > [8] base > > other attached packages: > [1] rtracklayer_1.22.2 GenomicRanges_1.14.4 XVector_0.2.0 > [4] IRanges_1.20.6 BiocGenerics_0.8.0 > > loaded via a namespace (and not attached): > [1] BSgenome_1.30.0 Biostrings_2.30.1 RCurl_1.95-4.1 Rsamtools_1.14.2 > [5] XML_3.98-1.1 bitops_1.0-6 stats4_3.0.1 tools_3.0.1 > [9] zlibbioc_1.8.0 > > _______________________________________________ > Bioconductor mailing list > Bioconductor@r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > [[alternative HTML version deleted]]
ADD COMMENT
0
Entering edit mode
Hi Michael, Yes, doing : mcols(x)$new_column <- "abc" got rid of the error. Thanks very much for the prompt response. Shraddha From: Michael Lawrence <lawrence.michael@gene.com<mailto:lawrence.michael@gene.com>> Date: Friday, 30 May, 2014 11:55 AM To: Shraddha Pai <shraddha.pai@camh.ca<mailto:shraddha.pai@camh.ca>> Cc: "bioconductor@r-project.org<mailto:bioconductor@r-project.org>" <bioconductor@r-project.org<mailto:bioconductor@r-project.org>> Subject: Re: [BioC] Replacing GRanges mcol makes it inaccessible On Fri, May 30, 2014 at 8:48 AM, Shraddha Pai <shraddha.pai@camh.ca<mailto:shraddha.pai@camh.ca>> wrote: Hi all, After I update the metadata on a Granges() object, I can no longer access the object. This happens on a Granges() object generated from the GFF3 file; I don't know if that matters. Here is the code to reproduce the error message. The gff file in question is from miRbase: ftp://mirbase.org/pub/mirbase/CURRENT/genomes/hsa.gff3 Has anyone else experienced this problem? Is there something different about a GRanges object generated by import()? I have also tried first setting mcols() to NULL and then doing mcols(x) <- tmp (putting in my new content), but that results in the same error. Thanks in advance, Shraddha ----- Shraddha Pai, Ph.D. Post-doctoral fellow Krembil Family Epigenetic Research Laboratory (Lab head: Dr. Art Petronis) Centre for Addiction and Mental Health, Toronto ------------------------------------------- > require(rtracklayer) > x <- import("hsa.gff3") > tmp <- mcols(x) > tmp <- cbind(as.data.frame(tmp), new_column="abc") I think you want either: mcols(x)$new_column <- "abs" or the shortcut: x$new_column <- "abs" This a bug though; will fix. > head(x) GRanges with 6 ranges and 8 metadata columns: seqnames ranges strand | source type <rle> <iranges> <rle> | <factor> <factor> [1] chr1 [ 17369, 17436] - | <na> miRNA_primary_transcript [2] chr1 [ 17409, 17431] - | <na> miRNA [3] chr1 [ 17369, 17391] - | <na> miRNA [4] chr1 [ 30366, 30503] + | <na> miRNA_primary_transcript [5] chr1 [ 30438, 30458] + | <na> miRNA [6] chr1 [567705, 567793] - | <na> miRNA_primary_transcript score phase ID Alias Name <numeric> <integer> <character> <characterlist> <character> [1] <na> <na> MI0022705 MI0022705 hsa-mir-6859-1 [2] <na> <na> MIMAT0027618 MIMAT0027618 hsa-miR-6859-5p [3] <na> <na> MIMAT0027619 MIMAT0027619 hsa-miR-6859-3p [4] <na> <na> MI0006363 MI0006363 hsa-mir-1302-2 [5] <na> <na> MIMAT0005890 MIMAT0005890 hsa-miR-1302 [6] <na> <na> MI0022558 MI0022558 hsa-mir-6723 Derives_from <character> [1] <na> [2] MI0022705 [3] MI0022705 [4] <na> [5] MI0006363 [6] <na> --- seqlengths: chr1 chr10 chr11 chr12 chr13 chr14 ... chr6 chr7 chr8 chr9 chrX chrY NA NA NA NA NA NA ... NA NA NA NA NA NA > mcols(x) <- tmp > head(x) Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'extractROWS' for signature '"AsIs"' > x GRanges with 4665 ranges and 9 metadata columns: Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'extractROWS' for signature '"AsIs"' ---- Here is the output from sessionInfo() > sessionInfo() R version 3.0.1 (2013-05-16) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] C attached base packages: [1] parallel stats graphics grDevices utils datasets methods [8] base other attached packages: [1] rtracklayer_1.22.2 GenomicRanges_1.14.4 XVector_0.2.0 [4] IRanges_1.20.6 BiocGenerics_0.8.0 loaded via a namespace (and not attached): [1] BSgenome_1.30.0 Biostrings_2.30.1 RCurl_1.95-4.1 Rsamtools_1.14.2 [5] XML_3.98-1.1 bitops_1.0-6 stats4_3.0.1 tools_3.0.1 [9] zlibbioc_1.8.0 _______________________________________________ Bioconductor mailing list Bioconductor@r-project.org<mailto:bioconductor@r-project.org> https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor ______________________________________________________________________ This email has been scanned by the CAMH Email Security System. ______________________________________________________________________ [[alternative HTML version deleted]]
ADD REPLY

Login before adding your answer.

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