eccLib 1.3.0
Python library for bioinformatics written in C
Loading...
Searching...
No Matches
FastaBuff.c File Reference

Implementations for the FastaBuff object. More...

#include "FastaBuff.h"
#include <stdbool.h>
#include <stdint.h>
#include <Python.h>
#include "../../formats/fasta.h"
#include "../../modules/eccLib.h"
#include "../GtfDict/GtfDict.h"
#include "FastaBuffViews.h"
#include "boolobject.h"
Include dependency graph for FastaBuff.c:

Functions

static FastaBuff * FastaBuff_new (PyTypeObject *type, PyObject *args, PyObject *kwargs)
 Allocates a new FastaBuff object.
static int FastaBuff_init (FastaBuff *self, PyObject *restrict args, PyObject *restrict kwds)
 Initializes a FastaBuff object. Equivalent to the constructor in Python.
static Py_ssize_t FastaBuff_len (FastaBuff *self)
 Returns the length of the FastaBuff.
static PyObject * FastaBuff_str (FastaBuff *self)
 Converts the FastaBuff to a string.
uint8_t FastaBuff_getItem (FastaBuff *self, Py_ssize_t index)
 Gets an item from the FastaBuff.
static int FastaBuff_setItem (FastaBuff *self, Py_ssize_t index, PyObject *value)
 Sets a part of the sequence.
static int FastaBuff_strindex (FastaBuff *self, size_t offset, size_t end, const char *value, size_t len)
 Returns the index of the first occurrence of the specified sequence in this FastaBuff, or -1 if this FastaBuff does not contain the sequence.
static int FastaBuff_buffindex (FastaBuff *self, size_t offset, size_t end, FastaBuff *restrict other)
 Returns the index of the first occurrence of the specified sequence in this FastaBuff.
static int FastaBuff_viewindex (FastaBuff *self, size_t offset, size_t end, FastaBuff_view *restrict other)
static int FastaBuff_contains (FastaBuff *restrict self, PyObject *restrict value)
 Checks if the FastaBuff contains the specified value.
static PyObject * FastaBuff_index (FastaBuff *restrict self, PyObject *restrict args)
 Returns the index of the first occurrence of the specified value in this FastaBuff.
static PyObject * FastaBuff_count (FastaBuff *restrict self, PyObject *restrict value)
 Counts the number of occurrences of the specified value in this FastaBuff.
static PyObject * FastaBuff_dump (FastaBuff *restrict self)
 Converts the FastaBuff to a bytes object.
static PyObject * FastaBuff_richcompare (FastaBuff *restrict self, PyObject *restrict other, const int op)
 FastaBuff comparison function.
PyObject * FastaBuff_getSubscript (FastaBuff *restrict self, PyObject *restrict key)
 Gets a subsequence of the FastaBuff.
static PyObject * FastaBuff_find (FastaBuff *restrict self, PyObject *restrict firstArg)
 Finds occurrences of the specified sequence in this FastaBuff.
static PyObject * FastaBuff_iter (FastaBuff *self)
static PyObject * FastaBuff_reversed (FastaBuff *self)
static void FastaBuff_dealloc (FastaBuff *self)
 Deallocates the FastaBuff.
FastaBuff * FastaBuff_New (uint8_t *restrict buff, size_t buffSize, size_t buffLen, bool RNA)
 Creates a new FastaBuff object.
static PyObject * FastaBuff_getstate (FastaBuff *self)
static PyObject * FastaBuff_setstate (FastaBuff *self, PyObject *state)
 Sets the state of the FastaBuff from a tuple.
int FastaBuff_getbuffer (FastaBuff *self, Py_buffer *view, int flags)

Variables

static PyMethodDef FastaBuffMethods []
 The FastaBuff methods.
static PyMappingMethods FastaBuffMap
 The FastaBuff mapping methods.
static PySequenceMethods FastaBuffSeq
 The FastaBuff sequence methods.
static PyBufferProcs FastaBuffBuffer
PyTypeObject FastaBuffType
 The Python type definition for the FastaBuff object.

Detailed Description

Implementations for the FastaBuff object.

Function Documentation

◆ FastaBuff_buffindex()

int FastaBuff_buffindex ( FastaBuff * self,
size_t offset,
size_t end,
FastaBuff *restrict other )
static

Returns the index of the first occurrence of the specified sequence in this FastaBuff.

Parameters
selfthe FastaBuff to search in
offsetthe offset to start searching from
endthe end offset to stop searching at
otherthe other FastaBuff to search for
Returns
The index of the first occurrence of the specified sequence, or -1 on error.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FastaBuff_getbuffer()

int FastaBuff_getbuffer ( FastaBuff * self,
Py_buffer * view,
int flags )

◆ FastaBuff_getstate()

PyObject * FastaBuff_getstate ( FastaBuff * self)
static
Here is the call graph for this function:

◆ FastaBuff_iter()

PyObject * FastaBuff_iter ( FastaBuff * self)
static
Here is the call graph for this function:

◆ FastaBuff_reversed()

PyObject * FastaBuff_reversed ( FastaBuff * self)
static
Here is the call graph for this function:

◆ FastaBuff_setstate()

PyObject * FastaBuff_setstate ( FastaBuff * self,
PyObject * state )
static

Sets the state of the FastaBuff from a tuple.

Parameters
selfthe FastaBuff to set the state of
statethe tuple to set the state from
Returns
NULL on error, otherwise the state tuple

◆ FastaBuff_strindex()

int FastaBuff_strindex ( FastaBuff * self,
size_t offset,
size_t end,
const char * value,
size_t len )
static

Returns the index of the first occurrence of the specified sequence in this FastaBuff, or -1 if this FastaBuff does not contain the sequence.

Parameters
selfthe FastaBuff to search in
offsetthe offset to start searching from
endthe end offset to stop searching at
valuesubstring
lenlength of substring
Returns
The index of the first occurrence of the specified sequence, or -1 on error.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FastaBuff_viewindex()

int FastaBuff_viewindex ( FastaBuff * self,
size_t offset,
size_t end,
FastaBuff_view *restrict other )
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ FastaBuffBuffer

PyBufferProcs FastaBuffBuffer
static
Initial value:
= {.bf_getbuffer =
(getbufferproc)FastaBuff_getbuffer,
.bf_releasebuffer = NULL}
int FastaBuff_getbuffer(FastaBuff *self, Py_buffer *view, int flags)
Definition FastaBuff.c:708

◆ FastaBuffMap

PyMappingMethods FastaBuffMap
static
Initial value:
= {.mp_subscript =
PyObject * FastaBuff_getSubscript(FastaBuff *restrict self, PyObject *restrict key)
Gets a subsequence of the FastaBuff.
Definition FastaBuff.c:510

The FastaBuff mapping methods.

◆ FastaBuffMethods

PyMethodDef FastaBuffMethods[]
static
Initial value:
= {
{"dump", (PyCFunction)FastaBuff_dump, METH_NOARGS,
"Dumps the buffer as bytes"},
{"index", (PyCFunction)FastaBuff_index, METH_VARARGS,
"Returns the index of the first occurrence of the specified "
"sequence in this FastaBuff."},
{"count", (PyCFunction)FastaBuff_count, METH_O,
"Returns the number of occurrences of the specified sequence in "
"this "
"FastaBuff."},
{"find", (PyCFunction)FastaBuff_find, METH_O,
"Returns the indices of the first occurrence of the specified "
"sequence in this FastaBuff."},
{"__reversed__", (PyCFunction)FastaBuff_reversed, METH_NOARGS,
"Returns the reverse of the sequence"},
{"__getstate__", (PyCFunction)FastaBuff_getstate, METH_NOARGS, ""},
{"__setstate__", (PyCFunction)FastaBuff_setstate, METH_O, ""},
{NULL, NULL, 0, NULL}
}
static PyObject * FastaBuff_getstate(FastaBuff *self)
Definition FastaBuff.c:642
static PyObject * FastaBuff_reversed(FastaBuff *self)
Definition FastaBuff.c:609
static PyObject * FastaBuff_setstate(FastaBuff *self, PyObject *state)
Sets the state of the FastaBuff from a tuple.
Definition FastaBuff.c:681
static PyObject * FastaBuff_dump(FastaBuff *restrict self)
Converts the FastaBuff to a bytes object.
Definition FastaBuff.c:446
static PyObject * FastaBuff_find(FastaBuff *restrict self, PyObject *restrict firstArg)
Finds occurrences of the specified sequence in this FastaBuff.
Definition FastaBuff.c:550
static PyObject * FastaBuff_index(FastaBuff *restrict self, PyObject *restrict args)
Returns the index of the first occurrence of the specified value in this FastaBuff.
Definition FastaBuff.c:369
static PyObject * FastaBuff_count(FastaBuff *restrict self, PyObject *restrict value)
Counts the number of occurrences of the specified value in this FastaBuff.
Definition FastaBuff.c:412

The FastaBuff methods.

◆ FastaBuffSeq

PySequenceMethods FastaBuffSeq
static
Initial value:
= {
.sq_length = (lenfunc)FastaBuff_len,
.sq_ass_item = (ssizeobjargproc)FastaBuff_setItem,
.sq_contains = (objobjproc)FastaBuff_contains,
}
static int FastaBuff_contains(FastaBuff *restrict self, PyObject *restrict value)
Checks if the FastaBuff contains the specified value.
Definition FastaBuff.c:339
static int FastaBuff_setItem(FastaBuff *self, Py_ssize_t index, PyObject *value)
Sets a part of the sequence.
Definition FastaBuff.c:204
static Py_ssize_t FastaBuff_len(FastaBuff *self)
Returns the length of the FastaBuff.
Definition FastaBuff.c:148

The FastaBuff sequence methods.