[BioC] Biostrings C interface :: example not compiling
Hervé Pagès
hpages at fhcrc.org
Mon Apr 5 08:39:03 CEST 2010
Hi Erik,
Erik Wright wrote:
> Hello again,
>
> It looks like my problem is that the function listed in the example code, "cache_XRaw()", is deprecated.
cache_XRaw() has been moved to the IRanges package a long time ago
and has since then been part of the IRanges C interface. The example
given in the header of Biostrings_interface.h needs to be updated to
reflect this change. Thanks for catching this and sorry for the
confusion.
For your GoneFISHing package that means that you need to do steps a.,
b. and c. for both, Biostrings and IRanges. For step d., add:
#include "IRanges_interface.h"
just before
#include "Biostrings_interface.h"
Then try to compile again and let me know if that still doesn't work.
> Is there any source of information about how to use the functions listed in Biostrings_interface.h?
There is nothing like that and no plans at the moment to formally
document the C-level interfaces. For now the best way to learn
about these functions is to see how they are used in
IRanges/Biostrings themselves (they are prefixed with an
underscore when they are used from within the package where
they are defined). The authors have made some efforts to use consistent
naming, and, I think, a clean and consistent C coding style across
the 2 packages so hopefully the code is not too hard to understand
(some parts of the code are tricky but most are not). They will be
happy to help you with any specific questions you have.
Cheers,
H.
>
> Thanks again,
> Erik
>
>
>
> On Apr 2, 2010, at 11:00 AM, Erik Wright wrote:
>
>> Hello all,
>>
>> I am trying to interface Biostrings from C for the first time. I followed the example given in the header of Biostrings_interface.h to the letter (quite literally). In step "e" I paste the example function into myFile.c, register it as a .Call entry point and compile with R CMD CHECK. I get the following errors:
>>
>> myFile.c:13: warning: implicit declaration of function Œcache_XRaw‚
>> myFile.c:13: error: incompatible types in assignment
>> myFile.c:14: error: ŒcachedCharSeq‚ has no member named Œelts‚
>> myFile.c:14: error: ŒcachedCharSeq‚ has no member named Œnelt‚
>>
>> Based on the error, it seems like I still don't have access to any of the Biostrings variable definitions. I have tried everything that I can think of, so I am quite stuck. Does anyone know what I am doing incorrectly? I have pasted myFile.c below for reference.
>>
>> Thanks!,
>> Erik
>>
>>
>>
>>
>> //myFile.c
>>
>> #include <Rdefines.h>
>> #include <R_ext/Rdynload.h>
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include "Biostrings_interface.h"
>>
>> SEXP print_XString_bytes(SEXP xstring)
>> {
>> cachedCharSeq x;
>> int i;
>> const char *x_char;
>>
>> x = cache_XRaw(xstring);
>> for (i = 0, x_char = x.elts; i < x.nelt; i++, x_char++)
>> Rprintf("%x ", *x_char);
>> Rprintf("\n");
>> return R_NilValue;
>> }
>>
>> /*
>> * -- REGISTRATION OF THE .Call ENTRY POINTS ---
>> */
>> static const R_CallMethodDef callMethods[] = {
>> {"print_XString_bytes", (DL_FUNC) &print_XString_bytes, 1},
>> {NULL, NULL, 0}
>> };
>>
>> void R_init_GoneFISHing(DllInfo *info)
>> {
>> R_registerRoutines(info, NULL, callMethods, NULL, NULL);
>> }
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
--
Hervé Pagès
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
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 Bioconductor
mailing list