eccLib 1.1.0
Python library for bioinformatics written in C
Loading...
Searching...
No Matches
Functions | Variables
GtfList.c File Reference

Contains the implementation of the GtfList object. More...

#include "GtfList.h"
#include <stdbool.h>
#include <stdlib.h>
#include <Python.h>
#include "../common.h"
#include "GtfDict.h"
Include dependency graph for GtfList.c:

Functions

static int GtfList_init (GtfList *restrict self, PyObject *args, PyObject *restrict kwds)
 Initializes a new GtfList object.
 
static long hausdorf_distance (GtfDict *restrict a, GtfDict *restrict b)
 Calculates the hausdorf distance between two GtfDicts.
 
static PyObject * GtfList_findHost (GtfList *restrict self, PyObject *restrict args)
 Finds the host gene of the gene in args assuming this object contains the correct host gene.
 
static int GtfList_mp_ass_subscript (GtfList *restrict self, PyObject *restrict key, PyObject *restrict value)
 Wrapper over the default setitem that performs a type check.
 
static PyObject * GtfList_append (GtfList *restrict self, PyObject *restrict args)
 Wrapper over list.append that throws a type error if the provided arg is not a GtfDict.
 
static PyObject * GtfList_inplace_concat (GtfList *restrict self, PyObject *restrict o)
 concatenates o to self
 
static PyObject * GtfList_extend (GtfList *restrict self, PyObject *restrict args)
 Custom list extend that does a type check.
 
static PyObject * GtfList_insert (GtfList *restrict self, PyObject *restrict args)
 A wrapper over the default list insert that does a type check.
 
static PyObject * GtfList_concat (GtfList *restrict self, PyObject *restrict other)
 non discriminatory implementation of add. Does no checks and returns a LIST
 
static PyObject * GtfList_str (GtfList *restrict self)
 Generates a complete GTF file.
 
static PyObject * GtfList_repr (GtfList *restrict self)
 Generates a representation of the GtfList object.
 
static PyObject * GtfList_sq_split (GtfList *restrict self)
 Splits the gene list into a dict of GtfLists with each GtfList having only one seqname.
 
static PyObject * GtfList_column (GtfList *restrict self, PyObject *restrict args, PyObject *restrict kwargs)
 Gets the values of a column in the GtfList.
 
static PyObject * GtfList_find (GtfList *restrict self, PyObject *restrict args, PyObject *restrict kwargs)
 Finds a sequence within the GtfList.
 
PyObject * GtfList_new (Py_ssize_t len)
 Creates a new GtfList object.
 

Variables

static PyMethodDef GtfList_methods []
 The methods of the GtfList object.
 
static PySequenceMethods GtfListSq
 The sequence methods of the GtfList object.
 
static PyMappingMethods GtfListMap
 The mapping methods of the GtfList object.
 
PyTypeObject GtfListType
 The Python type definition for the GtfList object.
 

Detailed Description

Contains the implementation of the GtfList object.

Function Documentation

◆ GtfList_new()

PyObject * GtfList_new ( Py_ssize_t  len)

Creates a new GtfList object.

Parameters
lenthe length of the list
Returns
a new GtfList object
Here is the caller graph for this function:

◆ hausdorf_distance()

static long hausdorf_distance ( GtfDict *restrict  a,
GtfDict *restrict  b 
)
static

Calculates the hausdorf distance between two GtfDicts.

The Hausdorf distance is the maximum distance between two points in two sets. In this case, it is the maximum distance between the start and end of two GtfDicts

Parameters
athe first GtfDict
bthe second GtfDict
Returns
the Hausdorf distance between the two GtfDicts
Here is the caller graph for this function:

Variable Documentation

◆ GtfList_methods

PyMethodDef GtfList_methods[]
static
Initial value:
= {
{"find_closest_bound", (PyCFunction)GtfList_findHost, METH_VARARGS,
"Returns None or the approximate host gene of the provided GtfDict"},
{"append", (PyCFunction)GtfList_append, METH_VARARGS,
"Appends the provided element to the GtfList"},
{"extend", (PyCFunction)GtfList_extend, METH_VARARGS,
"Extends the gene list with the provided iterable"},
{"insert", (PyCFunction)GtfList_insert, METH_VARARGS,
"Inserts the provided object at the provided position"},
{"sq_split", (PyCFunction)GtfList_sq_split, METH_NOARGS,
"Splits this gene list by the seqnames"},
{"find", (PyCFunction)GtfList_find, METH_VARARGS | METH_KEYWORDS,
"Splits this gene list by the seqnames"},
{"column", (PyCFunction)GtfList_column, METH_VARARGS | METH_KEYWORDS,
"Returns a list of the values of the provided key"},
{NULL, NULL, 0, NULL}
}
static PyObject * GtfList_sq_split(GtfList *restrict self)
Splits the gene list into a dict of GtfLists with each GtfList having only one seqname.
Definition GtfList.c:386
static PyObject * GtfList_append(GtfList *restrict self, PyObject *restrict args)
Wrapper over list.append that throws a type error if the provided arg is not a GtfDict.
Definition GtfList.c:215
static PyObject * GtfList_column(GtfList *restrict self, PyObject *restrict args, PyObject *restrict kwargs)
Gets the values of a column in the GtfList.
Definition GtfList.c:416
static PyObject * GtfList_insert(GtfList *restrict self, PyObject *restrict args)
A wrapper over the default list insert that does a type check.
Definition GtfList.c:295
static PyObject * GtfList_find(GtfList *restrict self, PyObject *restrict args, PyObject *restrict kwargs)
Finds a sequence within the GtfList.
Definition GtfList.c:485
static PyObject * GtfList_findHost(GtfList *restrict self, PyObject *restrict args)
Finds the host gene of the gene in args assuming this object contains the correct host gene.
Definition GtfList.c:136
static PyObject * GtfList_extend(GtfList *restrict self, PyObject *restrict args)
Custom list extend that does a type check.
Definition GtfList.c:270

The methods of the GtfList object.

◆ GtfListMap

PyMappingMethods GtfListMap
static
Initial value:
= {
.mp_ass_subscript = (objobjargproc)GtfList_mp_ass_subscript}
static int GtfList_mp_ass_subscript(GtfList *restrict self, PyObject *restrict key, PyObject *restrict value)
Wrapper over the default setitem that performs a type check.
Definition GtfList.c:178

The mapping methods of the GtfList object.

◆ GtfListSq

PySequenceMethods GtfListSq
static
Initial value:
= {.sq_inplace_concat =
.sq_concat = (binaryfunc)GtfList_concat}
static PyObject * GtfList_inplace_concat(GtfList *restrict self, PyObject *restrict o)
concatenates o to self
Definition GtfList.c:238
static PyObject * GtfList_concat(GtfList *restrict self, PyObject *restrict other)
non discriminatory implementation of add. Does no checks and returns a LIST
Definition GtfList.c:323

The sequence methods of the GtfList object.