eccLib 1.3.0
Python library for bioinformatics written in C
Loading...
Searching...
No Matches
Functions | Variables
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 "../../formats/gtf.h"
#include "../../modules/eccLib.h"
#include "../GtfDict/GtfDict.h"
#include "FastaBuffViews.h"
Include dependency graph for FastaBuff.c:

Functions

static FastaBuffFastaBuff_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_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_get_annotated (FastaBuff *restrict self, PyObject *restrict first)
 Returns the annotated sequence.
 
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.
 
FastaBuffFastaBuff_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.
 

Variables

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

Detailed Description

Implementations for the FastaBuff object.

Function Documentation

◆ FastaBuff_buffindex()

static 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 caller graph for this function:

◆ FastaBuff_getstate()

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

◆ FastaBuff_iter()

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

◆ FastaBuff_reversed()

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

◆ FastaBuff_setstate()

static 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()

static 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 caller graph for this function:

Variable Documentation

◆ 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:488

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."},
{"get_annotated", (PyCFunction)FastaBuff_get_annotated, METH_O,
"Returns the annotated sequence based on the GtfDict"},
{"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:620
static PyObject * FastaBuff_reversed(FastaBuff *self)
Definition FastaBuff.c:587
static PyObject * FastaBuff_setstate(FastaBuff *self, PyObject *state)
Sets the state of the FastaBuff from a tuple.
Definition FastaBuff.c:659
static PyObject * FastaBuff_dump(FastaBuff *restrict self)
Converts the FastaBuff to a bytes object.
Definition FastaBuff.c:418
static PyObject * FastaBuff_get_annotated(FastaBuff *restrict self, PyObject *restrict first)
Returns the annotated sequence.
Definition FastaBuff.c:435
static PyObject * FastaBuff_find(FastaBuff *restrict self, PyObject *restrict firstArg)
Finds occurrences of the specified sequence in this FastaBuff.
Definition FastaBuff.c:528
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:341
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:384

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:315
static int FastaBuff_setItem(FastaBuff *self, Py_ssize_t index, PyObject *value)
Sets a part of the sequence.
Definition FastaBuff.c:192
static Py_ssize_t FastaBuff_len(FastaBuff *self)
Returns the length of the FastaBuff.
Definition FastaBuff.c:136

The FastaBuff sequence methods.