libuproc  1.2.0
Macros | Typedefs | Enumerations | Functions
Nucleotides and codons

  
More...

Macros

#define UPROC_NT_BITS   4
 Number of bits needed to represent a valid nucleotide. More...
 
#define UPROC_CODON_NTS   3
 Number of nucleotides in a codon. More...
 
#define UPROC_CODON_BITS   (UPROC_CODON_NTS * UPROC_NT_BITS)
 Bits used to represent a codon. More...
 
#define UPROC_CODON_COUNT   (4 * 4 * 4)
 Number of codons consisting of only A, C, G and T/U. More...
 
#define UPROC_BINARY_CODON_COUNT   (1 << UPROC_CODON_BITS)
 Number of all possible binary representations of a codon mask. More...
 

Typedefs

typedef int uproc_nt
 Type for nucleotides. More...
 
typedef unsigned uproc_codon
 Type used to represent a codon (or codon mask) More...
 

Enumerations

enum  {
  UPROC_NT_A = (1 << 0),
  UPROC_NT_C = (1 << 1),
  UPROC_NT_G = (1 << 2),
  UPROC_NT_T = (1 << 3),
  UPROC_NT_U = UPROC_NT_T,
  UPROC_NT_N = (UPROC_NT_A | UPROC_NT_C | UPROC_NT_G | UPROC_NT_T),
  UPROC_NT_NOT_CHAR = -1,
  UPROC_NT_NOT_IUPAC = -2
}
 Nucleotide values. More...
 

Functions

void uproc_codon_append (uproc_codon *codon, uproc_nt nt)
 Append nucleotide to codon. More...
 
void uproc_codon_prepend (uproc_codon *codon, uproc_nt nt)
 Prepend nucleotide to codon. More...
 
uproc_nt uproc_codon_get_nt (uproc_codon codon, unsigned position)
 Retrieve a codon's nucleotide at a certain position. More...
 
bool uproc_codon_match (uproc_codon codon, uproc_codon mask)
 Match a codon against a "codon mask". More...
 

Detailed Description

 

Macro Definition Documentation

#define UPROC_NT_BITS   4

Number of bits needed to represent a valid nucleotide.

#define UPROC_CODON_NTS   3

Number of nucleotides in a codon.

#define UPROC_CODON_BITS   (UPROC_CODON_NTS * UPROC_NT_BITS)

Bits used to represent a codon.

#define UPROC_CODON_COUNT   (4 * 4 * 4)

Number of codons consisting of only A, C, G and T/U.

#define UPROC_BINARY_CODON_COUNT   (1 << UPROC_CODON_BITS)

Number of all possible binary representations of a codon mask.

Typedef Documentation

typedef int uproc_nt

Type for nucleotides.

This type can represent a standard base (A, C, G, T/U) or one of the IUPAC wildcard characters (http://www.bioinformatics.org/sms/iupac.html), except gaps. Each of the standard bases is represented by a distinct bit, matching against a wildcard is then a simple bitwise &.

It is defined as a signed integer, so negative values can be used as return values in case of an error.

typedef unsigned uproc_codon

Type used to represent a codon (or codon mask)

This type needs to be able to store at least UPROC_CODON_BITS bits.

Enumeration Type Documentation

anonymous enum

Nucleotide values.

Enumerator
UPROC_NT_A 

Adenine.

UPROC_NT_C 

Cytosine.

UPROC_NT_G 

Guanine.

UPROC_NT_T 

Thymine.

UPROC_NT_U 

Uracil (same value as T)

UPROC_NT_N 

Wildcard matching any base.

UPROC_NT_NOT_CHAR 

Result of converting a non-alphabetic ([A-Za-z]) character.

UPROC_NT_NOT_IUPAC 

Result of converting a non-IUPAC symbol.

Function Documentation

void uproc_codon_append ( uproc_codon codon,
uproc_nt  nt 
)

Append nucleotide to codon.

Cuts off the first NT and appends another:

1 append(ACG, T) -> CGT
Parameters
codoncodon to append to
ntnucleotide to append
void uproc_codon_prepend ( uproc_codon codon,
uproc_nt  nt 
)

Prepend nucleotide to codon.

Complementary to the append operation:

1 prepend(ACG, T) -> TAC
Parameters
codoncodon to append to
ntnucleotide to append
uproc_nt uproc_codon_get_nt ( uproc_codon  codon,
unsigned  position 
)

Retrieve a codon's nucleotide at a certain position.

Parameters
codoncodon to extract nt from
positionposition of the desired nt
Returns
Nucleotide at the given position or 0 if position is >= UPROC_CODON_NTS
bool uproc_codon_match ( uproc_codon  codon,
uproc_codon  mask 
)

Match a codon against a "codon mask".

Example:

1 match(ATC, NNN) -> true
2 match(ATC, AYY) -> true
3 match(ATC, ARY) -> false
Parameters
codoncodon to match
maskmask to match against
Returns
Whether codon matches mask.