________________________________________
From: Pages, Herve [hpages at fredhutch.org]
Sent: Wednesday, September 11, 2019 12:24 PM
To: Bhagwat, Aditya; bioc-devel at r-project.org
Subject: Re: [Bioc-devel] Import BSgenome class without attaching BiocGenerics (and others)?
Hi Aditya,
On 9/11/19 01:31, Bhagwat, Aditya wrote:
Hi Herve,
> It feels that a coercion method from BSgenome to GRanges should
rather be defined in the BSgenome package itself.
:-)
> Patch/PR welcome on GitHub.
Owkies. What pull/fork/check/branch protocol to be followed?
> Is this what you have in mind for this coercion?
> as(seqinfo(BSgenome.Celegans.UCSC.ce10), "GRanges")
Yes.
Perhaps also useful to share the wider context, allowing your and others
feedback for improved software design.
I wanted to subset a
<https://urldefense.proofpoint.com/v2/url?u=https-3A__support.bioconductor.org_p_124367&d=DwMFAw&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=FGFwBT0tJu3lfRS_rafeatLzrPxK7PEM0aanQY4M6wY&s=xNa-6ZKTD1MnnfT55tntHjdK51Y1JQGQxTlzX2-OYmI&e=>BSgenome
(without the _random or _unassigned), but Lori explained this is not
possible.
<https://urldefense.proofpoint.com/v2/url?u=https-3A__support.bioconductor.org_p_124367&d=DwMFAw&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=FGFwBT0tJu3lfRS_rafeatLzrPxK7PEM0aanQY4M6wY&s=xNa-6ZKTD1MnnfT55tntHjdK51Y1JQGQxTlzX2-OYmI&e=>
Instead Lori suggested to coerce a BSgenome into a GRanges
<https://urldefense.proofpoint.com/v2/url?u=https-3A__support.bioconductor.org_p_123489&d=DwMFAw&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=FGFwBT0tJu3lfRS_rafeatLzrPxK7PEM0aanQY4M6wY&s=6Eh73QthFfpPsfpRdPWs98pH6GHvv1Z23ORp34OCPxA&e=>,
which is a useful solution, but for which currently no exported S4
method exists
<https://urldefense.proofpoint.com/v2/url?u=https-3A__support.bioconductor.org_p_124416&d=DwMFAw&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=FGFwBT0tJu3lfRS_rafeatLzrPxK7PEM0aanQY4M6wY&s=H8owJlOQrNHwNFHfCxGHe27Jxu6xjxpuAMWK8JlTU4Y&e=>
So I defined an S4 coercer in my multicrispr package, making sure to
properly import the Bsgenome class
<https://urldefense.proofpoint.com/v2/url?u=https-3A__support.bioconductor.org_p_124442&d=DwMFAw&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=FGFwBT0tJu3lfRS_rafeatLzrPxK7PEM0aanQY4M6wY&s=2XNBVcwoJTjlxY_gl4UPzrHPKmKH9LTnM4ih5SQOfps&e=>.
Then, after coercing a BSgenome into a GRanges, I can extract the
chromosomes, after properly importing IRanges::`%in%`
<https://urldefense.proofpoint.com/v2/url?u=https-3A__support.bioconductor.org_p_124367&d=DwMFAw&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=FGFwBT0tJu3lfRS_rafeatLzrPxK7PEM0aanQY4M6wY&s=xNa-6ZKTD1MnnfT55tntHjdK51Y1JQGQxTlzX2-OYmI&e=>
Looks like you don't need to coerce the BSgenome object to GRanges. See
https://support.bioconductor.org/p/123489/#124581
H.
Which I can then on end to karyoploteR
<https://urldefense.proofpoint.com/v2/url?u=https-3A__support.bioconductor.org_p_124328&d=DwMFAw&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=FGFwBT0tJu3lfRS_rafeatLzrPxK7PEM0aanQY4M6wY&s=M90_rBO1oohGnXe2XBpQHQriFNthY_W0hzN6KWlf2S4&e=>,
for genome-wide plots of crispr target sites.
A good moment also to say thank you to all of you who helped me out, it
helps me to make multicrispr fit nicely into the BioC ecosystem.
Speeking of BioC design philosophy, can any of you suggest concise and
to-the-point reading material to deepen my understanding of the core
BioC software design philosophy?
I am trying to understand that better (which was the context for asking
recently why there are three Vector -> data.frame coercers in S4Vectors
<https://urldefense.proofpoint.com/v2/url?u=https-3A__support.bioconductor.org_p_124491&d=DwMFAw&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=FGFwBT0tJu3lfRS_rafeatLzrPxK7PEM0aanQY4M6wY&s=nBHdQoTrd1Mfu4VTMgtkPyUQ0Ju2NLeX-0X1Ny3fSeg&e=>)
Cheers,
Aditya
________________________________________
From: Pages, Herve [hpages at fredhutch.org]
Sent: Tuesday, September 10, 2019 6:45 PM
To: Bhagwat, Aditya; bioc-devel at r-project.org
Subject: Re: [Bioc-devel] Import BSgenome class without attaching
BiocGenerics (and others)?
Hi Aditya,
More generally speaking, coercion methods should be defined in a place
that is "as close as possible" to the "from" or "to" classes rather than
in a package that doesn't own any of the 2 classes involved.
Is this what you have in mind for this coercion?
> as(seqinfo(BSgenome.Celegans.UCSC.ce10), "GRanges")
GRanges object with 7 ranges and 0 metadata columns:
seqnames ranges strand
<Rle> <IRanges> <Rle>
chrI chrI 1-15072423 *
chrII chrII 1-15279345 *
chrIII chrIII 1-13783700 *
chrIV chrIV 1-17493793 *
chrV chrV 1-20924149 *
chrX chrX 1-17718866 *
chrM chrM 1-13794 *
-------
seqinfo: 7 sequences (1 circular) from ce10 genome
Thanks,
H.
On 9/6/19 03:39, Bhagwat, Aditya wrote:
> Dear Bioc devel,
>
> Is it possible to import the BSgenome class without attaching
BiocGenerics (to keep a clean namespace during the development of
multicrispr<https://urldefense.proofpoint.com/v2/url?u=https-3A__gitlab.gwdg.de_loosolab_software_multicrispr&d=DwICAg&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=cXJaaEvfNbOioopXgFWQms1qny1xehFQyb3V3xDy55M&s=MIR-kUeXy9oWokdQxItuG82hrvs0uwP1aBIqNdM-Jrs&e=
>).
>
> BSgenome <- methods::getClassDef('BSgenome', package = 'BSgenome')
>
> (Posted earlier on BioC
support<https://urldefense.proofpoint.com/v2/url?u=https-3A__support.bioconductor.org_p_124442_&d=DwICAg&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=cXJaaEvfNbOioopXgFWQms1qny1xehFQyb3V3xDy55M&s=oBSScH5uD5j0vCAaj4dfWepjiNGtHm9q5gA8eaIudZ4&e=
> and redirected here following Martin's suggestion)
>
> Thankyou :-)
>
> Aditya
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
>
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_bioc-2Ddevel&d=DwICAg&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=cXJaaEvfNbOioopXgFWQms1qny1xehFQyb3V3xDy55M&s=cEojiObibdSuzmh21opvy85DZyRrjtfo1vEMopKWmAg&e=
>
--
Herv? Pag?s
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024
E-mail: hpages at fredhutch.org
Phone: (206) 667-5791
Fax: (206) 667-1319
--
Herv? Pag?s
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024
E-mail: hpages at fredhutch.org
Phone: (206) 667-5791
Fax: (206) 667-1319
_______________________________________________
Bioc-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel