eccLib 1.1.0
Python library for bioinformatics written in C
Loading...
Searching...
No Matches
Macros | Enumerations | Functions | Variables
Gtf

Module providing functions for handling GTF data. More...

Macros

#define DEFAULT_ATTR_SIZE    64
 How many attributes should be allocated by default.
 
#define CORE_FIELD_COUNT   8
 The number of core fields in a GTF line.
 

Enumerations

enum  gtfFields {
  SEQNAME = 0 , SOURCE = 1 , FEATURE = 2 , START = 3 ,
  END = 4 , SCORE = 5 , REVERSE = 6 , FRAME = 7 ,
  ATTRIBUTES = 8
}
 Enum containing the fields that a GTF line can contain. More...
 

Functions

GtfDictcreateGTFdict (const occurrence_t *restrict token, PyObject *attr_tp, hashmap_t *restrict attr_keys, hashmap_t *restrict attr_vals)
 Parses a singular GTF line into a Python dict.
 
bool validGTFLineToParse (const char *line, size_t len)
 Determines if the provided line is a valid GTF line that can be parsed safely.
 

Variables

const char * keywords [CORE_FIELD_COUNT]
 Array containing the keywords of the GTF fields.
 
const uint8_t keyword_sizes [CORE_FIELD_COUNT]
 Array containing the sizes of the keywords.
 

Detailed Description

Module providing functions for handling GTF data.

See also
https://github.com/The-Sequence-Ontology/Specifications/blob/master/gff3.md

Macro Definition Documentation

◆ CORE_FIELD_COUNT

#define CORE_FIELD_COUNT   8

The number of core fields in a GTF line.

This is better than using ATTRIBUTES, as it's more descriptive

◆ DEFAULT_ATTR_SIZE

#define DEFAULT_ATTR_SIZE    64

How many attributes should be allocated by default.

See also
GtfDict

Enumeration Type Documentation

◆ gtfFields

enum gtfFields

Enum containing the fields that a GTF line can contain.

See also
GtfDict
keywords
Enumerator
SEQNAME 
SOURCE 
FEATURE 
START 
END 
SCORE 
REVERSE 
FRAME 
ATTRIBUTES 

Function Documentation

◆ createGTFdict()

GtfDict * createGTFdict ( const occurrence_t *restrict  token,
PyObject *  attr_tp,
hashmap_t *restrict  attr_keys,
hashmap_t *restrict  attr_vals 
)

Parses a singular GTF line into a Python dict.

Parameters
tokenthe GTF line to parse. It should contain a minimum of 7 \t, else it will throw an error
attr_tpa mapping containing the callable to use to convert the attribute values to the correct type, or None
attr_keysa hashmap containing the keys of the attributes
attr_valsa hashmap containing the values of the attributes
Returns
a PyObject* pointing to an object of type dict, or NULL on error
See also
occurrence_t
GtfDict

◆ validGTFLineToParse()

bool validGTFLineToParse ( const char *  line,
size_t  len 
)

Determines if the provided line is a valid GTF line that can be parsed safely.

A line is considered valid if it doesn't start with a # and contains at least one \t

Parameters
linethe line to check
lenthe length of the line
Returns
true or false depending on line validity
Here is the caller graph for this function:

Variable Documentation

◆ keyword_sizes

const uint8_t keyword_sizes[CORE_FIELD_COUNT]
extern

Array containing the sizes of the keywords.

◆ keywords

const char* keywords[CORE_FIELD_COUNT]
extern

Array containing the keywords of the GTF fields.