eccLib 1.1.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 <stdio.h>
#include <Python.h>
#include "../common.h"
#include "../formats/fasta.h"
#include "GtfDict.h"
Include dependency graph for FastaBuff.c:

Functions

static int FastaBuff_init (FastaBuff *self, PyObject *restrict args, PyObject *restrict kwds)
 Initializes a FastaBuff object.
 
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.
 
static PyObject * FastaBuff_getItem (FastaBuff *self, Py_ssize_t index)
 Gets a part of the sequence.
 
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, 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, 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 args)
 Counts the number of occurrences of the specified value in this FastaBuff.
 
static PyObject * FastaBuff_dump (FastaBuff *restrict self, PyObject *args)
 Converts the FastaBuff to a bytes object.
 
static PyObject * FastaBuff_get_annotated (FastaBuff *restrict self, PyObject *restrict args)
 Returns the annotated sequence.
 
static PyObject * FastaBuff_richcompare (FastaBuff *restrict self, PyObject *restrict other, const int op)
 FastaBuff comparison function.
 
static PyObject * FastaBuff_getSubscript (FastaBuff *restrict self, PyObject *restrict key)
 Gets a subsequence of the FastaBuff.
 
static PyObject * FastaBuff_find (FastaBuff *restrict self, PyObject *restrict args)
 Finds occurrences of the specified sequence in this FastaBuff.
 
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.
 

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,
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
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_getItem()

static PyObject * FastaBuff_getItem ( FastaBuff self,
Py_ssize_t  index 
)
static

Gets a part of the sequence.

Parameters
selfthe FastaBuff to get the part from
indexthe index to get the part from
Returns
the part of the sequence
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FastaBuff_new()

FastaBuff * FastaBuff_new ( uint8_t *restrict  buff,
size_t  buffSize,
size_t  buffLen,
bool  RNA 
)

Creates a new FastaBuff object.

Parameters
buffthe buffer to use, this will be owned by the FastaBuff object
buffSizethe size of the buffer
buffLenthe length of the sequence
RNAif true, T will be converted to U
Here is the caller graph for this function:

◆ FastaBuff_strindex()

static int FastaBuff_strindex ( FastaBuff self,
size_t  offset,
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
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 =
static PyObject * FastaBuff_getSubscript(FastaBuff *restrict self, PyObject *restrict key)
Gets a subsequence of the FastaBuff.
Definition FastaBuff.c:486

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_VARARGS,
"Returns the annotated sequence based on the GtfDict"},
{"count", (PyCFunction)FastaBuff_count, METH_VARARGS,
"Returns the number of occurrences of the specified sequence in this "
"FastaBuff."},
{"find", (PyCFunction)FastaBuff_find, METH_VARARGS,
"Returns the indices of the first occurrence of the specified sequence in "
"this FastaBuff."},
{NULL, NULL, 0, NULL}
}
static PyObject * FastaBuff_get_annotated(FastaBuff *restrict self, PyObject *restrict args)
Returns the annotated sequence.
Definition FastaBuff.c:386
static PyObject * FastaBuff_dump(FastaBuff *restrict self, PyObject *args)
Converts the FastaBuff to a bytes object.
Definition FastaBuff.c:368
static PyObject * FastaBuff_find(FastaBuff *restrict self, PyObject *restrict args)
Finds occurrences of the specified sequence in this FastaBuff.
Definition FastaBuff.c:523
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:293
static PyObject * FastaBuff_count(FastaBuff *restrict self, PyObject *restrict args)
Counts the number of occurrences of the specified value in this FastaBuff.
Definition FastaBuff.c:331

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

The FastaBuff sequence methods.