libuproc  1.2.0
Typedefs | Functions
object uproc_worditer

Typedefs

typedef struct uproc_worditer_s uproc_worditer
 Iterator over all words in an amino acid sequence. More...
 

Functions

uproc_worditeruproc_worditer_create (const char *seq, const uproc_alphabet *alpha)
 Create worditer object. More...
 
int uproc_worditer_next (uproc_worditer *iter, size_t *index, struct uproc_word *fwd, struct uproc_word *rev)
 Obtain the next word(s) from a word iterator. More...
 
void uproc_worditer_destroy (uproc_worditer *iter)
 Destroy worditer object. More...
 

Detailed Description

Typedef Documentation

typedef struct uproc_worditer_s uproc_worditer

Iterator over all words in an amino acid sequence.

Produces all consecutive amino acid words of length UPROC_WORD_LEN found in a sequence. If a character is encountered that is not an amino acid, the next word will start after that character.

Example:

For a word length of 5, the sequence

1 ANERDSP!FQQRAR

contains the (forward) words:

1 ADERD
2 NERDS
3 ERDSP
4 FQQRA
5 QQRAR

Function Documentation

uproc_worditer* uproc_worditer_create ( const char *  seq,
const uproc_alphabet alpha 
)

Create worditer object.

The iterator may not be used after the lifetime of the objects pointed to by seq and alpha has ended (only the pointer value is stored).

Parameters
seqsequence to iterate
alphatranslation alphabet
int uproc_worditer_next ( uproc_worditer iter,
size_t *  index,
struct uproc_word fwd,
struct uproc_word rev 
)

Obtain the next word(s) from a word iterator.

Invalid characters are not simply skipped, instead the first complete word after such character is returned next.

Parameters
iteriterator
indexOUT: starting index of the current "forward" word
fwdOUT: read word in order as it appeared
revOUT: read word in reversed order
void uproc_worditer_destroy ( uproc_worditer iter)

Destroy worditer object.