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

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

Macros

#define firstEl(b)   (b & 0x0F)
 Gets the first 4 bits of a byte.
 
#define secondEl(b)   (b & 0xF0) >> 4
 Gets the second 4 bits of a byte.
 
#define toByte(a, b)   (uint8_t)a | (b << 4)
 Combines two 4 bit numbers into a byte.
 
#define i_Index   0xFF
 Invalid FASTA index.
 

Functions

static void pack (uint8_t values[PACKING_WIDTH], packing_t *packed)
 Packs an array of 4-bit values into an integer.
 
bool is_valid_title (const char *title, size_t len)
 Checks if a FASTA title is valid.
 
char getIUPACchar (uint8_t index, bool rna)
 Returns IUPAC FASTA character.
 
void initialize_fasta_binary_mapping ()
 Initializes the FASTA binary mapping.
 

Variables

uint8_t fasta_binary_mapping [CHAR_MAX+1]
 A lookup table mapping FASTA characters to binary values.
 

Detailed Description

Module providing functions for handling FASTA data.

Macro Definition Documentation

◆ firstEl

#define firstEl (   b)    (b & 0x0F)

Gets the first 4 bits of a byte.

Parameters
bthe byte to get the first 4 bits from

◆ i_Index

#define i_Index   0xFF

Invalid FASTA index.

◆ secondEl

#define secondEl (   b)    (b & 0xF0) >> 4

Gets the second 4 bits of a byte.

Parameters
bthe byte to get the second 4 bits from

◆ toByte

#define toByte (   a,
 
)    (uint8_t)a | (b << 4)

Combines two 4 bit numbers into a byte.

Parameters
athe first 4 bit number
bthe second 4 bit number

Function Documentation

◆ getIUPACchar()

char getIUPACchar ( uint8_t  index,
bool  rna 
)

Returns IUPAC FASTA character.

Parameters
indexthe code to convert to a character
rnaif true, T will be converted to U
Returns
the IUPAC character
Warning
index must be less than 16, else the function will go out of bounds
Here is the caller graph for this function:

◆ initialize_fasta_binary_mapping()

void initialize_fasta_binary_mapping ( )

Initializes the FASTA binary mapping.

◆ is_valid_title()

bool is_valid_title ( const char *  title,
size_t  len 
)

Checks if a FASTA title is valid.

Parameters
titlethe title to check
lenthe length of the title
Returns
true if the title is valid, false otherwise
Here is the caller graph for this function:

◆ pack()

static void pack ( uint8_t  values[PACKING_WIDTH],
packing_t packed 
)
inlinestatic

Packs an array of 4-bit values into an integer.

Parameters
valuesthe array of 4-bit values to pack
packedthe packed value
Here is the caller graph for this function:

Variable Documentation

◆ fasta_binary_mapping

uint8_t fasta_binary_mapping[CHAR_MAX+1]
extern

A lookup table mapping FASTA characters to binary values.

Warning
This table is initialized in the initialize_fasta_binary_mapping