~ubuntu-branches/ubuntu/wily/r-bioc-genomicranges/wily-proposed

« back to all changes in this revision

Viewing changes to src/transcript_utils.c

  • Committer: Package Import Robot
  • Author(s): Andreas Tille
  • Date: 2014-06-13 15:04:19 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20140613150419-v49mxnlg42rnuks5
Tags: 1.16.3-1
* New upstream version
* New (Build-)Depends: r-bioc-genomeinfodb
* cme fix dpkg-control
* add autopkgtest

Show diffs side-by-side

added added

removed removed

Lines of Context:
144
144
}
145
145
 
146
146
 
147
 
static int copy_exon(char * out, const cachedCharSeq *in,
 
147
static int copy_exon(char * out, const Chars_holder *in,
148
148
                int start, int end, int on_minus_strand, SEXP lkup)
149
149
{
150
150
        int width;
165
165
        return width;
166
166
}
167
167
 
168
 
static void copy_transcript(char * out, const cachedCharSeq *in,
 
168
static void copy_transcript(char * out, const Chars_holder *in,
169
169
                SEXP starts, SEXP ends,
170
170
                int on_minus_strand, int decreasing_rank_on_minus_strand,
171
171
                SEXP lkup)
258
258
                SEXP exonStarts, SEXP exonEnds, SEXP strand,
259
259
                SEXP decreasing_rank_on_minus_strand, SEXP lkup)
260
260
{
261
 
        cachedCharSeq X, Y;
 
261
        Chars_holder X, Y;
262
262
        SEXP ans_width, ans, starts, ends;
263
 
        cachedXVectorList cached_ans;
 
263
        XVectorList_holder ans_holder;
264
264
        int decreasing_rank_on_minus_strand0, ans_length,
265
265
            i, on_minus_strand;
266
266
 
267
 
        X = cache_XRaw(x);
 
267
        X = hold_XRaw(x);
268
268
        decreasing_rank_on_minus_strand0 =
269
269
                LOGICAL(decreasing_rank_on_minus_strand)[0];
270
270
        PROTECT(ans_width = mk_transcript_widths(exonStarts,
271
271
                                        exonEnds, X.length));
272
272
        PROTECT(ans = alloc_XRawList(CHAR(STRING_ELT(classname, 0)),
273
273
                                        get_classname(x), ans_width));
274
 
        cached_ans = cache_XVectorList(ans);
275
 
        ans_length = get_cachedXVectorList_length(&cached_ans);
 
274
        ans_holder = hold_XVectorList(ans);
 
275
        ans_length = get_length_from_XVectorList_holder(&ans_holder);
276
276
        for (i = 0; i < ans_length; i++) {
277
277
                starts = VECTOR_ELT(exonStarts, i);
278
278
                if (starts == R_NilValue || LENGTH(starts) == 0)
283
283
                        UNPROTECT(2);
284
284
                        error("%s", errmsg_buf);
285
285
                }
286
 
                Y = get_cachedXRawList_elt(&cached_ans, i);
 
286
                Y = get_elt_from_XRawList_holder(&ans_holder, i);
287
287
                /* Y.seq is a const char * so we need to cast it to
288
288
                   char * before we can write to it */
289
289
                copy_transcript((char *) Y.seq, &X,