File: PreprocessedTB_class.c

package info (click to toggle)
r-bioc-biostrings 2.42.1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,652 kB
  • ctags: 721
  • sloc: ansic: 10,262; sh: 11; makefile: 2
file content (130 lines) | stat: -rw-r--r-- 3,019 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/****************************************************************************
 *               Basic manipulation of PreprocessedTB objects               *
 *                            Author: H. Pag\`es                            *
 ****************************************************************************/
#include "Biostrings.h"
#include "XVector_interface.h"
#include "IRanges_interface.h"
#include "S4Vectors_interface.h"


/****************************************************************************
 * C-level slot getters for PreprocessedTB objects.
 *
 * Be careful that these functions do NOT duplicate the returned slot.
 * Thus they cannot be made .Call() entry points!
 */

static SEXP
	tb_symbol = NULL,
	dups_symbol = NULL,
	base_codes_symbol = NULL;

SEXP _get_PreprocessedTB_tb(SEXP x)
{
	INIT_STATIC_SYMBOL(tb)
	return GET_SLOT(x, tb_symbol);
}

SEXP _get_PreprocessedTB_dups(SEXP x)
{
	INIT_STATIC_SYMBOL(dups)
	return GET_SLOT(x, dups_symbol);
}

SEXP _get_PreprocessedTB_base_codes(SEXP x)
{
	INIT_STATIC_SYMBOL(base_codes)
	return GET_SLOT(x, base_codes_symbol);
}

/* Not strict "slot getters" but very much like. */

int _get_PreprocessedTB_length(SEXP x)
{
	return _get_XStringSet_length(_get_PreprocessedTB_tb(x));
}

int _get_PreprocessedTB_width(SEXP x)
{
	SEXP tb;

	tb = _get_PreprocessedTB_tb(x);
	return INTEGER(_get_XStringSet_width(tb))[0];
}

SEXP _get_PreprocessedTB_low2high(SEXP x)
{
	return get_H2LGrouping_low2high(_get_PreprocessedTB_dups(x));
}


/****************************************************************************
 * C-level slot getters for Twobit objects.
 *
 * Be careful that these functions do NOT duplicate the returned slot.
 * Thus they cannot be made .Call() entry points!
 */

static SEXP sign2pos_symbol = NULL;

static SEXP get_Twobit_sign2pos(SEXP x)
{
	INIT_STATIC_SYMBOL(sign2pos)
	return GET_SLOT(x, sign2pos_symbol);
}

/* Not a strict "slot getter" but very much like. */
SEXP _get_Twobit_sign2pos_tag(SEXP x)
{
	return get_XVector_tag(get_Twobit_sign2pos(x));
}


/****************************************************************************
 * C-level slot getters for ACtree2 objects.
 *
 * Be careful that these functions do NOT duplicate the returned slot.
 * Thus they cannot be made .Call() entry points!
 */

static SEXP
	nodebuf_ptr_symbol = NULL,
	nodeextbuf_ptr_symbol = NULL;

SEXP _get_ACtree2_nodebuf_ptr(SEXP x)
{
	INIT_STATIC_SYMBOL(nodebuf_ptr)
	return GET_SLOT(x, nodebuf_ptr_symbol);
}

SEXP _get_ACtree2_nodeextbuf_ptr(SEXP x)
{
	INIT_STATIC_SYMBOL(nodeextbuf_ptr)
	return GET_SLOT(x, nodeextbuf_ptr_symbol);
}


/****************************************************************************
 * Buffer of duplicates.
 */

static IntAE *ppdups_buf;

void _init_ppdups_buf(int length)
{
	ppdups_buf = new_IntAE(length, length, NA_INTEGER);
	return;
}

void _report_ppdup(int poffset, int P_id)
{
	ppdups_buf->elts[poffset] = P_id;
	return;
}

SEXP _get_ppdups_buf_asINTEGER()
{
	return new_INTEGER_from_IntAE(ppdups_buf);
}