eccLib 1.3.0
Python library for bioinformatics written in C
Loading...
Searching...
No Matches
Data Structures | Functions | Variables
FastaBuff

All methods and objects related to the FastaBuff object. More...

Data Structures

struct  FastaBuff
 A buffer that holds packed uint4 FASTA data. More...
 

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.
 
static int FastaBuff_setItem (FastaBuff *self, Py_ssize_t index, PyObject *value)
 Sets a part of the sequence.
 
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.
 
static PyObject * FastaBuff_find (FastaBuff *restrict self, PyObject *restrict firstArg)
 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.
 
PyObject * FastaBuff_getSubscript (FastaBuff *restrict self, PyObject *restrict key)
 Gets a subsequence of the FastaBuff.
 
uint8_t FastaBuff_getItem (FastaBuff *self, Py_ssize_t index)
 Gets an item from the FastaBuff.
 

Variables

PyTypeObject FastaBuffType
 The Python type definition for the FastaBuff object.
 

Detailed Description

All methods and objects related to the FastaBuff object.

The FastaBuff object is a memory efficient buffer for FASTA data. It stores the data in a packed format, with each byte containing two 4 bit values. This allows for a 50% reduction in memory usage compared to a regular byte array. The object also provides methods for easy manipulation of the data.

Function Documentation

◆ FastaBuff_contains()

static int FastaBuff_contains ( FastaBuff *restrict  self,
PyObject *restrict  value 
)
static

Checks if the FastaBuff contains the specified value.

Parameters
selfthe FastaBuff to search in
valuethe value to search for
Returns
1 if the FastaBuff contains the value, 0 if it does not, -1 on error
Here is the call graph for this function:

◆ FastaBuff_count()

static PyObject * FastaBuff_count ( FastaBuff *restrict  self,
PyObject *restrict  value 
)
static

Counts the number of occurrences of the specified value in this FastaBuff.

Parameters
selfthe FastaBuff to search in
valuethe value to search for
Returns
the number of occurrences of the specified value
Here is the call graph for this function:

◆ FastaBuff_dealloc()

static void FastaBuff_dealloc ( FastaBuff self)
static

Deallocates the FastaBuff.

Parameters
selfthe FastaBuff to deallocate

◆ FastaBuff_dump()

static PyObject * FastaBuff_dump ( FastaBuff *restrict  self)
static

Converts the FastaBuff to a bytes object.

Parameters
selfthe FastaBuff to convert
Returns
the bytes representation of the FastaBuff
Here is the caller graph for this function:

◆ FastaBuff_find()

static PyObject * FastaBuff_find ( FastaBuff *restrict  self,
PyObject *restrict  firstArg 
)
static

Finds occurrences of the specified sequence in this FastaBuff.

Parameters
selfthe FastaBuff to search in
firstArgthe sequence to search for
Returns
a list of the indices of the first occurrence of the specified sequence in this FastaBuff.
Here is the call graph for this function:

◆ FastaBuff_get_annotated()

static PyObject * FastaBuff_get_annotated ( FastaBuff *restrict  self,
PyObject *restrict  first 
)
static

Returns the annotated sequence.

Parameters
selfthe FastaBuff to get the annotated sequence from
firstthe GtfDict or mapping to get the annotated sequence with
Returns
the annotated sequence
Here is the call graph for this function:

◆ FastaBuff_getItem()

uint8_t FastaBuff_getItem ( FastaBuff self,
Py_ssize_t  index 
)

Gets an item from the FastaBuff.

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

◆ FastaBuff_getSubscript()

PyObject * FastaBuff_getSubscript ( FastaBuff *restrict  self,
PyObject *restrict  key 
)

Gets a subsequence of the FastaBuff.

Parameters
selfthe FastaBuff to get the subsequence from
keythe key to get the subsequence with
Returns
the subsequence
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FastaBuff_index()

static PyObject * FastaBuff_index ( FastaBuff *restrict  self,
PyObject *restrict  args 
)
static

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

Parameters
selfthe FastaBuff to search in
argsthe arguments to search for
Returns
the index of the first occurrence of the specified value, or -1 on error
Here is the call graph for this function:

◆ FastaBuff_init()

static int FastaBuff_init ( FastaBuff self,
PyObject *restrict  args,
PyObject *restrict  kwds 
)
static

Initializes a FastaBuff object. Equivalent to the constructor in Python.

Either loads a valid buffer, from a bytes object, or parses a string from the provided string or file, into a buffer.

Parameters
selfthe FastaBuff to initialize
argspositional arguments
kwdsthe keyword arguments
Here is the call graph for this function:

◆ FastaBuff_len()

static Py_ssize_t FastaBuff_len ( FastaBuff self)
static

Returns the length of the FastaBuff.

Parameters
selfthe FastaBuff to get the length of
Returns
the length of the FastaBuff

◆ FastaBuff_new()

static FastaBuff * FastaBuff_new ( PyTypeObject *  type,
PyObject *  args,
PyObject *  kwargs 
)
static

Allocates a new FastaBuff object.

Used as the allocator by Python for FastaBuff, initializes the object, ensuring all the fields are valid, but does not actually initialize the object.

Parameters
typethe type of the object to allocate
argsthe arguments to initialize the FastaBuff with
kwargsthe keyword arguments to initialize the FastaBuff with. Should always be NULL
Returns
a new FastaBuff object, or NULL if allocation fails
Warning
Does not allocate the buffer

◆ 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_richcompare()

static PyObject * FastaBuff_richcompare ( FastaBuff *restrict  self,
PyObject *restrict  other,
const int  op 
)
static

FastaBuff comparison function.

Parameters
selfthe FastaBuff to compare
otherthe other object to compare
opthe operation to perform
Returns
the result of the comparison
Here is the call graph for this function:

◆ FastaBuff_setItem()

static int FastaBuff_setItem ( FastaBuff self,
Py_ssize_t  index,
PyObject *  value 
)
static

Sets a part of the sequence.

Parameters
selfthe FastaBuff to set the part in
indexthe index to set the part at
valuethe value to set
Returns
0 on success, -1 on error

◆ FastaBuff_str()

static PyObject * FastaBuff_str ( FastaBuff self)
static

Converts the FastaBuff to a string.

Parameters
selfthe FastaBuff to convert
Returns
the string representation of the FastaBuff
Here is the call graph for this function:

Variable Documentation

◆ FastaBuffType

PyTypeObject FastaBuffType
extern

The Python type definition for the FastaBuff object.