Skip to content
Prev 15474 / 21312 Next

[Bioc-devel] Import BSgenome class without attaching BiocGenerics (and others)?

Thanks Michael, 

The important detail is that I want to plot the relevant chromosomes only

    relevant_chromosomes <- GenomeInfoDb::seqnames(grangeslist)  %>% 
                            S4Vectors::runValue() %>% 
                            Reduce(union, .) %>% 
                            unique()

    genomeranges <- GenomeInfoDb::seqinfo(grangeslist) %>% 
                    as('GRanges') %>% 
                   (function(gr){
                       gr [ as.character(GenomeInfoDb::seqnames(gr)) %in% 
                            relevant_chromosomes ]
                   })

    kp <- karyoploteR::plotKaryotype(genomeranges)
    karyoploteR::kpPlotRegions(kp, grangeslist) # grangeslist contains crispr target sites


And, this process required as("GRanges")

    #' Convert BSgenome into GRanges 
    #' @param from BSgenome, e.g. BSgenome.Mmusculus.UCSC.mm10::Mmusculus
    #' @examples 
    #' require(magrittr)
    #' BSgenome.Mmusculus.UCSC.mm10::BSgenome.Mmusculus.UCSC.mm10 %>%
    #' as('GRanges')
    #' @importClassesFrom BSgenome BSgenome
    #' @export
    methods::setAs( "BSgenome", 
                    "GRanges", 
                    function(from)  from %>% 
                                    GenomeInfoDb::seqinfo() %>% 
                                    as('GRanges'))

Thankyou for feedback,

Aditya

Thread (25 messages)

Bhagwat, Aditya Import BSgenome class without attaching BiocGenerics (and others)? Sep 6 Michael Lawrence Import BSgenome class without attaching BiocGenerics (and others)? Sep 6 Bhagwat, Aditya Import BSgenome class without attaching BiocGenerics (and others)? Sep 6 Bhagwat, Aditya Import BSgenome class without attaching BiocGenerics (and others)? Sep 6 Michael Lawrence Import BSgenome class without attaching BiocGenerics (and others)? Sep 6 Kasper Daniel Hansen Import BSgenome class without attaching BiocGenerics (and others)? Sep 6 Bhagwat, Aditya Import BSgenome class without attaching BiocGenerics (and others)? Sep 6 Michael Lawrence Import BSgenome class without attaching BiocGenerics (and others)? Sep 6 Bhagwat, Aditya Import BSgenome class without attaching BiocGenerics (and others)? Sep 6 Hervé Pagès Import BSgenome class without attaching BiocGenerics (and others)? Sep 10 Bhagwat, Aditya Import BSgenome class without attaching BiocGenerics (and others)? Sep 11 Hervé Pagès Import BSgenome class without attaching BiocGenerics (and others)? Sep 11 Bhagwat, Aditya Import BSgenome class without attaching BiocGenerics (and others)? Sep 11 Michael Lawrence Import BSgenome class without attaching BiocGenerics (and others)? Sep 11 Bhagwat, Aditya Import BSgenome class without attaching BiocGenerics (and others)? Sep 11 Michael Lawrence Import BSgenome class without attaching BiocGenerics (and others)? Sep 11 Hervé Pagès Import BSgenome class without attaching BiocGenerics (and others)? Sep 11 Hervé Pagès Import BSgenome class without attaching BiocGenerics (and others)? Sep 11 Michael Lawrence Import BSgenome class without attaching BiocGenerics (and others)? Sep 11 Bernat Gel Import BSgenome class without attaching BiocGenerics (and others)? Sep 11 Bernat Gel Import BSgenome class without attaching BiocGenerics (and others)? Sep 12 Bhagwat, Aditya Import BSgenome class without attaching BiocGenerics (and others)? Sep 12 Bernat Gel Import BSgenome class without attaching BiocGenerics (and others)? Sep 12 Bhagwat, Aditya Import BSgenome class without attaching BiocGenerics (and others)? Sep 12 Bhagwat, Aditya Import BSgenome class without attaching BiocGenerics (and others)? Sep 12