embnmer.c


Function embNmerNuc2int

Encodes a word of a nucleic sequence into a unsigned ajlong ajint number. For a 4-byte unsigned ajlong ajint this will work if the word size is less than 16, otherwise there aren't enough bits to hold the number.

Synopsis

Prototype
ajulong embNmerNuc2int (
      const char* seq,
      ajint wordsize,
      ajint offset,
      AjBool* otherflag
);

TypeNameRead/WriteDescription
const char*seqInputthe sequence to use
ajintwordsizeInputthe size of word of sequence to convert to int
ajintoffsetInputthe offset into the sequence of the start of the word
AjBool*otherflagOutputset true if the sequence contains anything except A,G,C or T
ajulong RETURNthe encoded word

Input
seq:(Input)the sequence to use
wordsize:(Input)the size of word of sequence to convert to int
offset:(Input)the offset into the sequence of the start of the word
Output
otherflag:(Output)set true if the sequence contains anything except A,G,C or T
Returns
ajulong:the encoded word

Description

Encodes a word of a nucleic sequence into a unsigned ajlong ajint number. For a 4-byte unsigned ajlong ajint this will work if the word size is less than 16, otherwise there aren't enough bits to hold the number.

Usage

See source code

Example

In preparation

Errors

See source code

Dependencies

See source code

See Also

See other functions in this section

Availability

In release 6.4.0

Function embNmerInt2nuc

Decodes a unsigned long int number into a word of a nucleic sequence. The returned nucleic sequence is pre-pended to anything already in the string 'seq'.

Synopsis

Prototype
ajint embNmerInt2nuc (
      AjPStr* seq,
      ajint wordsize,
      ajulong value
);

TypeNameRead/WriteDescription
AjPStr*seqOutputthe returned sequence
ajintwordsizeInputthe size of word to produce
ajulongvalueInputthe number to decode
ajint RETURNnot used

Input
wordsize:(Input)the size of word to produce
value:(Input)the number to decode
Output
seq:(Output)the returned sequence
Returns
ajint:not used

Description

Decodes a unsigned long int number into a word of a nucleic sequence. The returned nucleic sequence is pre-pended to anything already in the string 'seq'.

Usage

See source code

Example

In preparation

Errors

See source code

Dependencies

See source code

See Also

See other functions in this section

Availability

In release 6.4.0

Function embNmerProt2int

Encodes a word of a protein sequence into a unsigned ajlong ajint number. For a 4-byte unsigned ajlong ajint this will work if the word size is less than 8, otherwise there aren't enough bits to hold the number.

Synopsis

Prototype
ajulong embNmerProt2int (
      const char* seq,
      ajint wordsize,
      ajint offset,
      AjBool* otherflag,
      AjBool ignorebz
);

TypeNameRead/WriteDescription
const char*seqInputthe sequence to use
ajintwordsizeInputthe size of word of sequence to convert to int
ajintoffsetInputthe offset into the sequence of the start of the word
AjBool*otherflagOutputset true if the sequence contains anything other than valid amino acid codes
AjBoolignorebzInputtrue if B and Z are to be treated as non-valid residues
ajulong RETURNthe encoded word

Input
seq:(Input)the sequence to use
wordsize:(Input)the size of word of sequence to convert to int
offset:(Input)the offset into the sequence of the start of the word
ignorebz:(Input)true if B and Z are to be treated as non-valid residues
Output
otherflag:(Output)set true if the sequence contains anything other than valid amino acid codes
Returns
ajulong:the encoded word

Description

Encodes a word of a protein sequence into a unsigned ajlong ajint number. For a 4-byte unsigned ajlong ajint this will work if the word size is less than 8, otherwise there aren't enough bits to hold the number.

Usage

See source code

Example

In preparation

Errors

See source code

Dependencies

See source code

See Also

See other functions in this section

Availability

In release 6.4.0

Function embNmerInt2prot

Decodes a unsigned long int number into a word of a protein sequence. The returned protein sequence is pre-pended to anything already in the string 'seq'.

Synopsis

Prototype
ajint embNmerInt2prot (
      AjPStr* seq,
      ajint wordsize,
      ajulong value,
      AjBool ignorebz
);

TypeNameRead/WriteDescription
AjPStr*seqOutputthe returned sequence
ajintwordsizeInputthe size of word to produce
ajulongvalueInputthe number to decode
AjBoolignorebzInputtrue if B and Z are to be treated as non-valid residues
ajint RETURNnot used

Input
wordsize:(Input)the size of word to produce
value:(Input)the number to decode
ignorebz:(Input)true if B and Z are to be treated as non-valid residues
Output
seq:(Output)the returned sequence
Returns
ajint:not used

Description

Decodes a unsigned long int number into a word of a protein sequence. The returned protein sequence is pre-pended to anything already in the string 'seq'.

Usage

See source code

Example

In preparation

Errors

See source code

Dependencies

See source code

See Also

See other functions in this section

Availability

In release 6.4.0

Function embNmerGetNoElements

Calculates the maximum number required to encode a sequence of size 'word'.

Synopsis

Prototype
AjBool embNmerGetNoElements (
      ajulong* no_elements,
      ajint word,
      AjBool seqisnuc,
      AjBool ignorebz
);

TypeNameRead/WriteDescription
ajulong*no_elementsOutputthe returned number
ajintwordInputthe size of word to produce
AjBoolseqisnucInputTrue is the sequence is nucleic, False if protein
AjBoolignorebzInputtrue if B and Z are to be treated as non-valid residues
AjBool RETURNTrue if the word is small enough to be encoded in an ajulong

Input
word:(Input)the size of word to produce
seqisnuc:(Input)True is the sequence is nucleic, False if protein
ignorebz:(Input)true if B and Z are to be treated as non-valid residues
Output
no_elements:(Output)the returned number
Returns
AjBool:True if the word is small enough to be encoded in an ajulong

Description

Calculates the maximum number required to encode a sequence of size 'word'.

Usage

See source code

Example

In preparation

Errors

See source code

Dependencies

See source code

See Also

See other functions in this section

Availability

In release 6.4.0