eccLib 1.3.0
Python library for bioinformatics written in C
Loading...
Searching...
No Matches
gtf.h
Go to the documentation of this file.
1
6#ifndef GTF_H
7#define GTF_H
8
9#include <Python.h>
10#include <stdlib.h>
11
12#include "../classes/GtfDict/GtfDict.h"
13#include "../common.h"
14
27#define DEFAULT_ATTR_SIZE \
28 64 // well how often do you see a GTF line with more than 64 attributes?
29
43GtfDict *createGTFdict(const occurrence_t *restrict token, PyObject *attr_tp,
44 hashmap_t *restrict attr_keys,
45 hashmap_t *restrict attr_vals);
46
57bool validGTFLineToParse(const char *line, size_t len);
58
68char *write_owned(char *restrict buf, size_t *restrict len, size_t *alloc,
69 const char *restrict in, size_t inLen);
70
81char *GtfDict_dump(GtfDict *restrict const self, char *restrict in,
82 size_t *restrict len, size_t *restrict alloc);
83
91int GtfDict_as_annotation(PyObject *restrict object, long *restrict start,
92 long *restrict end);
93
104 START = 3,
105 END = 4,
106 SCORE = 5,
108 FRAME = 7,
109 ATTRIBUTES = 8
111
117#define CORE_FIELD_COUNT 8
118
123extern const char *keywords[CORE_FIELD_COUNT];
124
129extern const uint8_t keyword_sizes[CORE_FIELD_COUNT];
130
135extern const PyTypeObject *keyword_types[CORE_FIELD_COUNT];
136
137#define GFF3_FASTA_HEADER "##FASTA"
138
139#endif
const PyTypeObject * keyword_types[CORE_FIELD_COUNT]
Array containing the types of the keywords.
Definition gtf.c:671
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.
const char * keywords[CORE_FIELD_COUNT]
Array containing the keywords of the GTF fields.
Definition gtf.c:665
bool validGTFLineToParse(const char *line, size_t len)
Determines if the provided line is a valid GTF line that can be parsed safely.
Definition gtf.c:23
#define CORE_FIELD_COUNT
The number of core fields in a GTF line.
Definition gtf.h:117
const uint8_t keyword_sizes[CORE_FIELD_COUNT]
Array containing the sizes of the keywords.
Definition gtf.c:669
gtfFields
Enum containing the fields that a GTF line can contain.
Definition gtf.h:100
@ SOURCE
Definition gtf.h:102
@ SEQNAME
Definition gtf.h:101
@ START
Definition gtf.h:104
@ FRAME
Definition gtf.h:108
@ ATTRIBUTES
Definition gtf.h:109
@ REVERSE
Definition gtf.h:107
@ FEATURE
Definition gtf.h:103
@ END
Definition gtf.h:105
@ SCORE
Definition gtf.h:106
int GtfDict_as_annotation(PyObject *restrict object, long *restrict start, long *restrict end)
Converts a GtfDict or mapping object to an annotation.
Definition gtf.c:633
char * write_owned(char *restrict buf, size_t *restrict len, size_t *alloc, const char *restrict in, size_t inLen)
Writes a string to the output buffer, reallocing if necessary.
Definition gtf.c:520
char * GtfDict_dump(GtfDict *restrict const self, char *restrict in, size_t *restrict len, size_t *restrict alloc)
Dumps the contents of a GtfDict to a string.
Definition gtf.c:590
A dict that holds GTF data.
Definition GtfDict.h:30
An occurrence of a token in a string.
Definition common.h:30