[Bioc-devel] Exposing some more IRanges mojo to C.

Hervé Pagès hpages at fhcrc.org
Thu Nov 3 01:46:40 CET 2011


This is done in IRanges 1.13.2. The exposed function is
_seqselect_Rle().

Cheers,
H.

On 11-11-02 03:01 PM, Hervé Pagès wrote:
> Hi Steve,
>
> Yes we can expose more stuff if needed. There are already a lot of
> functions that are exposed (130 of the 274 functions currently defined
> in IRanges) and we can expose more.
>
> It's good to keep some level of encapsulation though, by exposing only
> what's stable and potentially useful. This IRanges C-interface is hard
> to maintain at the moment: adding a function to it or changing the type
> of a function argument requires making more or less the same change in
> 3 or 4 different places. I guess this could probably be made easier by
> using some custom script...
>
> Rle_seqselect itself is not a good candidate for exposure because it's
> a .Call entry point. We've tried so far to not expose .Call entry points
> because the type of their arguments (SEXP) make them less re-usable in
> C code than if those types were low-level C-types like int *, char *
> etc... One way to go is to reorganize a little bit our code by adding
> and exposing a lower-level function that does (almost) all the work
> that Rle_seqselect currently does but with args:
>
> (SEXP x, const int *start, const int *width, int length)
>
> instead of
>
> (SEXP x, SEXP start, SEXP width)
>
> and then have Rle_seqselect call it. This lower-level function is more
> reusable because, in the client code, the 'start' and 'with' vectors
> are not always stored in SEXP's. For example they could be in temporary
> int buffers (typically), and there is no reason why the client code
> would need to convert those buffers into SEXP's before it can
> call the C function in IRanges.
>
> I'll make that change and will let you know.
>
> Cheers,
> H.
>
> On 11-10-27 01:31 PM, Steve Lianoglou wrote:
>> Hi,
>>
>> I'm building a package and I want to write some C(++) level code that
>> manipulates Rle's.
>>
>> In particular I'd really like to be able to use the Rle_seqselect
>> function so I can slice and extract data from Rle's that I pass down
>> into my C code.
>>
>> By looking at how Biostrings uses IRanges (at the C level), it seems
>> to me that the only "externally available" IRanges C functions are the
>> ones defined in "IRange_defines.h" and "IRange_interface.h"
>>
>> Is there any chance we can export some more stuff (like Rle_seqselect,
>> for example) for "outside use"? I'd be happy to do things to help
>> facilitate that process.
>>
>> Thanks,
>> -steve
>>
>
>


-- 
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 fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



More information about the Bioc-devel mailing list