eccLib 1.1.0
Python library for bioinformatics written in C
|
Functions for parsing files. Core of the library. More...
#include "functions.h"
#include <ctype.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <Python.h>
#include <string.h>
#include "classes/FastaBuff.h"
#include "classes/GtfDict.h"
#include "classes/GtfList.h"
#include "common.h"
#include "formats/fasta.h"
#include "formats/gtf.h"
#include "pyport.h"
Data Structures | |
struct | input_t |
Struct for storing input data for parsing functions. More... | |
Macros | |
#define | input_t_is_NULL(input) (input.str == NULL) |
Checks if the input_t object is NULL. | |
#define | NULL_input_t (input_t) { NULL, 0, NULL } |
NULL input_t object. | |
Functions | |
static void | free_input_t (input_t input) |
Frees the input_t object. | |
static input_t | getFileContentsFromArgs (PyObject *restrict first) |
Gets file contents object for parsing from python function arguments. | |
static int | addFasta (PyObject *list, const char *restrict title, size_t titleLen, PyObject *seq) |
Adds an entry to the FASTA tuple. | |
static void | echoProgress (PyObject *restrict echo, unsigned int lineIndex, unsigned int total) |
Echoes progress to a file. | |
static bool | processTextData (const char *restrict chunk, Py_ssize_t chunk_size, PyObject **out) |
Processes a chunk of FASTA text data. | |
static bool | processBinaryData (const char *restrict chunk, Py_ssize_t chunk_size, PyObject **out) |
Processes a chunk of binary FASTA data. | |
PyObject * | parseFasta (PyObject *self, PyObject *args, PyObject *restrict kwargs) |
Python function that parses provided raw FASTA content. | |
PyObject * | parseGTF (PyObject *restrict self, PyObject *restrict args, PyObject *restrict kwargs) |
Python function for parsing raw GTF file contents. | |
Functions for parsing files. Core of the library.
#define input_t_is_NULL | ( | input | ) | (input.str == NULL) |
#define NULL_input_t (input_t) { NULL, 0, NULL } |
|
inlinestatic |
Adds an entry to the FASTA tuple.
list | the list to add the entry to |
title | the title of the entry |
titleLen | the length of the title |
seq | the sequence of the entry |
|
inlinestatic |
Echoes progress to a file.
Echoes the progress of lineIndex/total to the file
echo | the file to echo to |
lineIndex | the current line index |
total | the total amount of lines |
|
static |
Frees the input_t object.
input | the input_t object to free |
|
static |
Gets file contents object for parsing from python function arguments.
For performance reasons this function will attempt to get the file size using seek() and tell() if the object has those methods and then load the entire file using mmap(). If the object doesn't have seek() then it will just call read(-1).
first | the first argument |
|
static |
Processes a chunk of binary FASTA data.
chunk | the chunk of data to process |
chunk_size | the size of the chunk |
out | the output buffer |
|
static |
Processes a chunk of FASTA text data.
chunk | the chunk of data to process |
chunk_size | the size of the chunk |
out | the output object, may be NULL |