# Wise2 API (version 2.1.19b)

### Ewan Birney
Sanger Centre
Wellcome Trust Genome Campus
Hinxton, Cambridge CB10 1SA,
England.
Email: birney@sanger.ac.uk

### 18/6/2001

## Contents

## 1 Overview

This document describes the API of the Wise2 system. The API (application programming interface) allows other programmers use the functionality in the Wise2 package directly, rather than treating the executables as a black box through which you get ASCII output.

If you want to learn more about the Wise2 package itself, the algorithms in it or what it is used for, look for the Wise2 documentation (available as postscript), probably in the same place that you found this documentation!

The API is accessible in 3 different ways: As a C function calls made inside the Wise2 package namespace - this is the way the current executables (eg, genewise) access the API, as C function calls made from outside the Wise2 package namespace - this is for people writing C programs with their own set of functions who do not want name clashes of things like “Sequence” (in this API the name is exported as “Wise2_Sequence”), and finally as a Perl API, using the XS extension code where C function calls which are dynamic loaded into the Perl interpretter can be executed as if they were standard Perl commands.

Probably the most usable is the Perl API. Perl is a very forgiving language, and it is easier to learn for novice programmers - in particular memory management is handled for you. For people who want to use the Wise2 api from inside their own C program, I would use the external api. For people who want to extend wise2 programs to do other things, the internal api.

## 2 WARNING - still in alpha

After playing around with the API for a while, I have realised that a number of things are not clean enough in the interface. I am not currently considering the API to the 2.1.x series stable. An aim for the 2.2 series is to make a stable and useful API, that is well documented.

However, this API does work, and there is this documentation for it, so it maybe worth people who like this sort of thing to play around with it. Anyone who uses the API gets huge guru points from me...

## 3 API generation

The API is not manually generated but rather is generated by the Dynamite compiler. Dynamite is a language which I wrote specifically for the Wise2 project: it is a cranky but useful language based heavily on C (it converts its source code to C), with a portion dedicated to dynamic programming code (a common algorithm in bioinformatics). It also has a lightweight object model that supports scalars and lists of types. Because the API is generated through Dynamite, you can expect consistent documentation and memory handling of all the functions and objects.

## 4 Getting Started for the impatient

Here is 3 different ways of using the Wise2 API to reverse complement a sequence. Once in perl, once using the name space protected API, and once using the internal API.

These three programs all make the same output, using the same code. It is only how the programming is presented to the user (once in perl, twice in C) which changes.

### 4.1 Perl reverse complement

    #!/usr/local/bin/perl

    use Wise2; # loads in Wise2 api

    $file = shift; # first argument

    if( !defined $file ) {
        print "You must give a file to revcom for a reverse to work!";
        exit(1);
    }

    $seq = &Wise2::Sequence::read_fasta_file_Sequence($file);
    $rev = $seq->revcomp();

    print "Original sequence\n\n";
    $seq->write_fasta(STDOUT);
    print "Reversed sequence\n\n";
    $rev->write_fasta(STDOUT);

### 4.2 Wise2 external API calls

    #include "dyna_api.h"

    int main(int argc,char ** argv)
    {
      Wise2_Sequence * seq;
      Wise2_Sequence * rev;

      if( argc != 2 ) {
        fprintf(stderr,"have to give an argument for a file");
        exit(1);
      }

      seq = Wise2_read_fasta_file_Sequence(argv[1]);

      if( seq == NULL ) {
        fprintf(stderr,"Unable to read fasta file in %s\n",argv[1]);
        exit(1);
      }

      rev = Wise2_reverse_complement_Sequence(seq);

      printf("Original sequence\n\n");
      Wise2_write_fasta_Sequence(seq,stdout);
      printf("Revcomp sequence\n\n");
      Wise2_write_fasta_Sequence(rev,stdout);

      Wise2_free_Sequence(seq);
      Wise2_free_Sequence(rev);
    }

### 4.3 Wise2 internal API calls

    #include "dyna.h"

    int main(int argc,char ** argv)
    {
      Sequence * seq;
      Sequence * rev;

      if( argc != 2 ) {
        fprintf(stderr,"have to give an argument for a file");
        exit(1);
      }

      seq = read_fasta_file_Sequence(argv[1]);

      if( seq == NULL ) {
        fprintf(stderr,"Unable to read fasta file in %s\n",argv[1]);
        exit(1);
      }

      rev = reverse_complement_Sequence(seq);

      printf("Original sequence\n\n");
      write_fasta_Sequence(seq,stdout);
      printf("Revcomp sequence\n\n");
      write_fasta_Sequence(rev,stdout);

      free_Sequence(seq);
      free_Sequence(rev);
    }

## 5 Navigating the source code

The Wise2 api has a bewildering number of objects and functions, and the biggest problem in using the API is knowing which objects can be made from what. This next section walks you through at an object level how to do some common tasks. This list is in no way complete, but it is better than just browsing around the index.

A very good place to start is to read the scripts in the perl/scripts area (halfwise.pl does not use the Wise2 API but all the others do).

### 5.1 Making a translation of a DNA sequence

- Build a codon table object from a file (15.2subsection.15.2)
- Build a sequence object, from a file or strings (33.2subsection.33.2)
- Use the translate function on the Sequence object

### 5.2 Comparing two sequences using smith waterman

- Build a Comparison matrix object from a file (18.1subsection.18.1)
- Build two Sequence objects, from a file or strings (33.2subsection.33.2)
- Optionally convert the Sequence objects into Protein objects (29.1subsection.29.1). This ensures you have proteins
- Read in the comparison matrix using CompMat (18.1subsection.18.1)
- Use one of the algorithm calls in sw_wrap module (48section.48)
- Show the alignment using a call in the seqaligndisaply module (46section.46)

### 5.3 Running a smith waterman search of single protein sequence vs a db

- Read in a sequence object and convert it to a protein object (29.1subsection.29.1,33.2subsection.33.2)
- Make a protein database from the single protein object (30.2subsection.30.2)
- Make a protein database from a single fasta file (30.2subsection.30.2)
- Using one of the calls to the sw_wrap module, make a Hscore object (48section.48)
- Show the Hscore object using a show function (26.2subsection.26.2)
- Retrieve individual protein objects from the database by taking out the DataEntry objects (26.4subsection.26.4) and passing them into the ProteinDB object (30.2subsection.30.2), giving you a protein object
- optionally align them as in the above section

### 5.4 Running a genewise on a single protein vs a single DNA sequence

See the script genewise.pl in the distribution

- Make a Sequence object from a strings or a file (33.2subsection.33.2)
- Make that a protein object (29.1subsection.29.1)
- Make a Sequence object from a string or a file (33.2subsection.33.2)
- Make that a Genomic object (22.2subsection.22.2)
- Add any additional repeat areas from external information to the genomic object
- Read in a gene frequency counts (??)
- Read in a codon table (15.2subsection.15.2)
- Make a random DNA model (32.2subsection.32.2)
- Make an algorithm type (??)
- Build an entire parameter set for genewise using Wise2::GeneParameter21_wrap (??)
- Run the actual algorithm (??)
- show the alignment using genedisplay (??)

## 6 Concepts and overview of the API

The API is organised in the following way. There are 4 main areas of source code in the wise2 package

- wisebase - base memory, string and error handling libraries
- dynlibsrc - generic bioinformatics objects
- models - specific Wise2 objects
- HMMer2 - HMMER 2 (Sean Eddy’s HMM package)

The API is mainly derived from the dynlibsrc and models directories. There is no distinction in the API of one directory from another

## 7 The reference section

The reference section is built automatically from the Dynamite source. This means that the function names, argument lists and in nearly all cases the documentation should be completely up to date with whatever version you got this documentation from.

The code is divided up into modules: each module having potentially a number of objects in it and a number of free standing functions (factory functions). The documentation lists each object and the fields in the object which are accessible by the Perl API and the external API (more fields maybe accessible by the internal API, but generally these are not fields that you are expected to use). Fields can either be scalar or list types. In either case the scalar or list can either be a basic type or another object type. The following access methods are available for scalar types

### 7.1 Accessing fields in objects

In both the external API and the Perl API you can access all the fields via function calls. In Perl these function calls have the correct names space system to be called using the OOP syntax of Perl.

#### 7.1.1 Perl scalar accessors

- $obj>fieldname() gets the value of this field
- $obj>set_fieldname(new value) sets the value of this field

For example

       $name = $seq->name();       # get the name of a sequence
       $seq->set_name('NewName');  # set the name of a sequence

#### 7.1.2 External C scalar accessors

- Wise2_access_fieldname_ObjectName(obj) gets the value of this field
- Wise2_replace_fieldname_ObjectName(obj,new value) sets the value of this field

For example

       char * name;
       Wise2_Sequence * seq;

       /* ... get a sequence object somehow ... */

       name = Wise2_access_name_Sequence(seq);

       Wise2_replace_name_Sequence(seq,"NewName");

#### 7.1.3 Perl List accessors

- $obj>each_fieldname() Gives a Perl array of all the items in a list
- $obj>length_fieldname Length of the list
- $obj>fieldname($i) The ith member of the list
- $obj>add_fieldname($another_obj) Adds another object to the list
- $obj>flush_fieldname() Destroys all the items in a list, sets list size to zero

#### 7.1.4 External API List accessors

- Wise2_access_fieldname_ObjectName(obj,i) access the ith position in the list
- Wise2_flush_fieldname_ObjectName(obj) Flushes the list
- Wise2_add_fieldname_ObjectName(obj,added_object) Adds an object onto the end of the list

### 7.2 Object Construction and handling

The good news is that in the Perl API all the memory handling is managed between the Perl memory handling method and the Wise2 handling method. Bascially you can completely forget about these things and code normally in Perl and all the memory is handled for you.

In the C external API, as in any C program, the programmer is responsible for the memory, and you need to read the documentation as to whether the objects you recieve from function calls need explict frees or not.

#### 7.2.1 Low level Object Constructing

In both Perl and in C you have the possibility of making a new object from scratch.

- In Perl it is $obj = new Wise2::ObjectName;
- in C it is obj = ObjectName_alloc for objects with no lists, and obj = ObjectName_alloc_std for objects with lists (this is a mistake in the API I know).

However I would read carefully the documentation for an object first, as in some cases the objects have to made through specific functions. These are likely to be things like new_ObjectName or such like. They are likely to be “factory” functions, that is functions not attached to any object.

#### 7.2.2 Object deconstructors

In Perl you don’t have to worry about this (heaven).

In the C API you have two functions to handle the memory of objects. The objects have a reference counted memory: when the free function is called it decrements the object reference count and if this count hits 0 then the object itself is free’d. To up the reference count you call the hard_link_ObjectName function.

- free_ObjectName(obj) Releases this pointer on this object
- obj = hard_link_ObjectName() Adds this pointer to object, increasing the reference count

## 8 Wise2 Specific Modules

There are a number of modules which are specific to Wise2 algorithms. These should be the starting point for how to use Wise2 algorithms: try to find a function in these modules which provide the functionality that you want. Then figure out how to make the appropiate objects to use this functionality.

gwrap
  ?? The gwrap module has the main entry points for the genewise algorithm and how to build parameters for it
estwrap
  40section.40 The estwrap module has the main entry points for the estwise algorithm
sw_wrap
  48section.48 The sw_wrap has the main entry points for the smith waterman algorithm
genedisplay
  41section.41 The pretty ascii output used for genewise and estwise output
seqaligndisplay
  46section.46 The pretty ascii output used for smith waterman alignments
threestatemodel
  50section.50 profile-HMM support
threestatedb
  49section.49 profile-HMM database support
genefrequency
  42section.42 Raw counts for the genewise model
geneparameter
  43section.43 probabilities for the genewise model
cdparser
  38section.38 probabilities for the estwise model

## 9 Dynamite library modules

### 9.1 Sequence modules

sequence
  33section.33 Basic sequences
sequencedb
  35section.35 Basic sequence database
protein
  29section.29 Protein specific type
proteindb
  30section.30 Protein database
genomic
  22section.22 Genomic specific type
genomicdb
  23section.23 Genomic database
cdna
  13section.13 Cdna specific type
cdnadb
  14section.14 Cdna database

### 9.2 Generic probabilistic modelling support

probability
  28section.28 Probability to log space conversions
codon
  15section.15 Codon Table support
compmat
  18section.18 Protein Comparison matrix support
codonmat
  ?? Codon Matrix comparison matrix
codonmapper
  16section.16 Codon bias/substitution errors support

### 9.3 Generic Database Searching

hscore
  26section.26 High Score list
histogram
  25section.25 Extreme Value distribution fitting
dbimpl
  ?? Database Implementation

### 9.4 Generic Dynamite algorithm support

aln
  10section.10 Label alignments
packaln
  27section.27 Raw (low level) alignments
basematrix
  12section.12 Memory management for DP implementations

## 10 aln

This module contains the following objects

- 10.1subsection.10.1 AlnBlock
- 10.2subsection.10.2 AlnColumn
- 10.3subsection.10.3 AlnUnit
- 10.4subsection.10.4 AlnSequence

### 10.1 Object AlnBlock

The AlnBlock object has the following fields. To see how to access them refer to 7.1subsection.7.1

  start Type [AlnColumn * : Scalar] the first AlnColumn in the alignment
  seq Type [AlnSequence ** : List] a list of AlnSequences in the alignment
  length Type [int : Scalar] not used
  score Type [int : Scalar] not used

AlnBlock is the main representation of alignments from Dynamite. Each AlnBlock represents any number of śequences, of any type, which share things in common. The alignment is represented by a series of /AlnColumns (linked list) in which each AlnColumn has a series of AlnUnits, each Unit being a start/end/text_label triple. Alternatively, one can see each sequence in isolation, and not ask what it is aligned to, but rather what labels it has on it.

Member functions of AlnBlock

#### 10.1.1 dump_ascii_AlnBlock

External C
  Wise2_dump_ascii_AlnBlock (alb,ofp)
Perl
  &Wise2::AlnBlock::dump_ascii_AlnBlock (alb,ofp)
Perl-OOP call
  $obj->dump_ascii_AlnBlock(ofp)

Arguments

alb
  [UNKN ] AlnBlock to dump [AlnBlock *]
ofp
  [UNKN ] File stream to dump to [FILE *]
returns
  Nothing - no return value

Dumps the alignment in rereadable ascii form.

Not really for human consumption

### 10.2 Object AlnColumn

The AlnColumn object has the following fields. To see how to access them refer to 7.1subsection.7.1

  alu Type [AlnUnit ** : List] list of the AlnUnits in this column
  next Type [AlnColumn * : Scalar] the next AlnColumn in this block

This is a coupling of AlnUnits from different sequences. Each AlnUnit is meant to represent *the equivalent* piece of biological information in some sense (ie, they are alignmed), even though quite possibly they are very different types of information

Member functions of AlnColumn

#### 10.2.1 at_end_AlnColumn

External C
  Wise2_at_end_AlnColumn (alc)
Perl
  &Wise2::AlnColumn::at_end (alc)
Perl-OOP call
  $obj->at_end()

Arguments

alc
  [READ ] AlnColumn [AlnColumn *]
returns
  [UNKN ] Undocumented return value [boolean]

This tells you whether the AlnColumn is at the end without passing NULLś around

### 10.3 Object AlnUnit

The AlnUnit object has the following fields. To see how to access them refer to 7.1subsection.7.1

  start Type [int : Scalar] start position in the sequence
  end Type [int : Scalar] end position in the sequence
  label Type [int : Scalar] not used
  text_label Type [char * : Scalar] text label of this position
  next Type [AlnUnit * : Scalar] next AlnUnit in this sequence
  score[AlnUnitSCORENUMBER] Type [int : Scalar] a series of scores for this position.
  in_column Type [boolean : Scalar] not used
  seq Type [AlnSequence * : Scalar] No documentation

This is the basic unit of the label alignment. It describes a single mark-up over one sequence: being a start, an end and a text_label.

Member functions of AlnUnit

#### 10.3.1 bio_start_AlnUnit

External C
  Wise2_bio_start_AlnUnit (alu)
Perl
  &Wise2::AlnUnit::bio_start (alu)
Perl-OOP call
  $obj->bio_start()

Arguments

alu
  [UNKN ] Undocumented argument [AlnUnit *]
returns
  [UNKN ] Undocumented return value [int]

Tells the bio-coordinate of the start point of this alnunit

#### 10.3.2 bio_end_AlnUnit

External C
  Wise2_bio_end_AlnUnit (alu)
Perl
  &Wise2::AlnUnit::bio_end (alu)
Perl-OOP call
  $obj->bio_end()

Arguments

alu
  [UNKN ] Undocumented argument [AlnUnit *]
returns
  [UNKN ] Undocumented return value [int]

Tells the bio-coordinate of the end point of this alnunit

### 10.4 Object AlnSequence

The AlnSequence object has the following fields. To see how to access them refer to 7.1subsection.7.1

  start Type [AlnUnit * : Scalar] the first AlnUnit of this sequence
  data_type Type [int : Scalar] not used
  data Type [void * : Scalar] not used - dont́ use!
  bio_start Type [int : Scalar] start of this sequence in its b́ioćoordinates
  bio_end Type [int : Scalar] end of this sequence in its b́ioćoordinates

Each Sequence in an AlnBlock is represented by one of these, and in many ways this is an orthogonal way of looking at the alignment than the AlnColumns. If you look at the alignment from one AlnSequence you will just see the individual labels on this sequence

Member functions of AlnSequence

## 11 alnrange

This module contains the following objects

- 11.1subsection.11.1 AlnRange
- 11.2subsection.11.2 AlnRangeSet

### 11.1 Object AlnRange

The AlnRange object has the following fields. To see how to access them refer to 7.1subsection.7.1

  starti Type [int : Scalar] No documentation
  startj Type [int : Scalar] No documentation
  startstate Type [int : Scalar] No documentation
  stopi Type [int : Scalar] No documentation
  stopj Type [int : Scalar] No documentation
  stopstate Type [int : Scalar] No documentation
  startscore Type [int : Scalar] No documentation
  stopscore Type [int : Scalar] No documentation

No documentation for AlnRange

Member functions of AlnRange

### 11.2 Object AlnRangeSet

The AlnRangeSet object has the following fields. To see how to access them refer to 7.1subsection.7.1

  score Type [int : Scalar] over complete alignment
  alr Type [AlnRange ** : List] No documentation

No documentation for AlnRangeSet

Member functions of AlnRangeSet

## 12 basematrix

This module only contains factory methods

### 12.1 basematrix factory methods

#### 12.1.1 change_max_BaseMatrix_kbytes

External C
  Wise2_change_max_BaseMatrix_kbytes (new_kilo_number)
Perl
  &Wise2::change_max_BaseMatrix_kbytes (new_kilo_number)

Arguments

new_kilo_number
  [UNKN ] max kilobytes allowed [int]
returns
  Nothing - no return value

This is to change, at run-time the maximum level of bytes basematrix *thinks* it can use. This number is *not* used for any actual calls to basematrix allocation: it is only used with /get_max_BaseMatrix_kbytes

#### 12.1.2 get_max_BaseMatrix_kbytes

External C
  Wise2_get_max_BaseMatrix_kbytes (void)
Perl
  &Wise2::get_max_BaseMatrix_kbytes ()

Arguments

returns
  [UNKN ] Undocumented return value [int]

returns the max. number of kilobytes suggested as a limited to BaseMatrix.

## 13 cdna

This module contains the following objects

- 13.1subsection.13.1 cDNA

### 13.1 Object cDNA

The cDNA object has the following fields. To see how to access them refer to 7.1subsection.7.1

  baseseq Type [Sequence * : Scalar] No documentation

No documentation for cDNA

Member functions of cDNA

#### 13.1.1 truncate_cDNA

External C
  Wise2_truncate_cDNA (cdna,start,stop)
Perl
  &Wise2::cDNA::truncate_cDNA (cdna,start,stop)
Perl-OOP call
  $obj->truncate_cDNA(start,stop)

Arguments

cdna
  [READ ] cDNA that is truncated [cDNA *]
start
  [UNKN ] Undocumented argument [int]
stop
  [UNKN ] Undocumented argument [int]
returns
  [UNKN ] Undocumented return value [cDNA *]

Truncates a cDNA sequence. Basically uses the /magic_trunc_Sequence function (of course!)

It does not alter cdna, rather it returns a new sequence with that truncation

#### 13.1.2 read_fasta_file_cDNA

External C
  Wise2_read_fasta_file_cDNA (filename)
Perl
  &Wise2::cDNA::read_fasta_file_cDNA (filename)
Perl-OOP call
  $obj->read_fasta_file_cDNA()

Arguments

filename
  [UNKN ] filename to be opened and read [char *]
returns
  [UNKN ] Undocumented return value [cDNA *]

Reads a fasta file assuming that it is cDNA. Will complain if it is not, and return NULL.

#### 13.1.3 cDNA_name

External C
  Wise2_cDNA_name (cdna)
Perl
  &Wise2::cDNA::cDNA_name (cdna)
Perl-OOP call
  $obj->cDNA_name()

Arguments

cdna
  [UNKN ] Undocumented argument [cDNA *]
returns
  [UNKN ] Undocumented return value [char *]

Returns the name of the cDNA

#### 13.1.4 cDNA_length

External C
  Wise2_cDNA_length (cdna)
Perl
  &Wise2::cDNA::cDNA_length (cdna)
Perl-OOP call
  $obj->cDNA_length()

Arguments

cdna
  [UNKN ] Undocumented argument [cDNA *]
returns
  [UNKN ] Undocumented return value [int]

Returns the length of the cDNA

#### 13.1.5 cDNA_seqchar

External C
  Wise2_cDNA_seqchar (cdna,pos)
Perl
  &Wise2::cDNA::cDNA_seqchar (cdna,pos)
Perl-OOP call
  $obj->cDNA_seqchar(pos)

Arguments

cdna
  [UNKN ] cDNA [cDNA *]
pos
  [UNKN ] position in cDNA to get char [int]
returns
  [UNKN ] Undocumented return value [char]

Returns sequence character at this position.

#### 13.1.6 cDNA_from_Sequence

External C
  Wise2_cDNA_from_Sequence (seq)
Perl
  &Wise2::cDNA::cDNA_from_Sequence (seq)
Perl-OOP call
  $obj->cDNA_from_Sequence()

Arguments

seq
  [OWNER] Sequence to make cDNA from [Sequence *]
returns
  [UNKN ] Undocumented return value [cDNA *]

makes a new cDNA from a Sequence. It owns the Sequence memory, ie will attempt a /free_Sequence on the structure when /free_cDNA is called

If you want to give this cDNA this Sequence and forget about it, then just hand it this sequence and set seq to NULL (no need to free it). If you intend to use the sequence object elsewhere outside of the cDNA datastructure then use cDNA_from_Sequence(/hard_link_Sequence(seq))

## 14 cdnadb

This module contains the following objects

- 14.2subsection.14.2 cDNADB
- This module also contains some factory methods

### 14.1 cdnadb factory methods

#### 14.1.1 new_cDNADB_from_single_seq

External C
  Wise2_new_cDNADB_from_single_seq (seq)
Perl
  &Wise2::new_cDNADB_from_single_seq (seq)

Arguments

seq
  [UNKN ] sequence which as placed into cDNADB structure. [cDNA *]
returns
  [UNKN ] Undocumented return value [cDNADB *]

To make a new cDNA database from a single cDNA Sequence with a eval system

#### 14.1.2 new_cDNADB

External C
  Wise2_new_cDNADB (seqdb)
Perl
  &Wise2::new_cDNADB (seqdb)

Arguments

seqdb
  [READ ] sequence database [SequenceDB *]
returns
  [UNKN ] Undocumented return value [cDNADB *]

To make a new cDNA database

### 14.2 Object cDNADB

The cDNADB object has the following fields. To see how to access them refer to 7.1subsection.7.1

  is_single_seq Type [boolean : Scalar] No documentation
  done_forward Type [boolean : Scalar] No documentation
  forward_only Type [boolean : Scalar] No documentation
  forw Type [ComplexSequence * : Scalar] No documentation
  rev Type [ComplexSequence * : Scalar] No documentation
  sdb Type [SequenceDB * : Scalar] No documentation
  current Type [Sequence * : Scalar] No documentation
  cses Type [ComplexSequenceEvalSet * : Scalar] No documentation
  error_handling Type [CdnaDBErrorType : Scalar] No documentation
  error_tol Type [double : Scalar] No documentation

This object hold a database of cDNA sequences.

You will probably use it in one of two ways

1 A sequence formatted database, which is provided by a /SequenceDB object is used to provide the raw sequences

2 A single cDNA sequence is used.

In each case this database provides both the forward and reverse strands into the system.

Notice that what is exported are /ComplexSequence objects, not cDNA dna, as this is what is generally needed. These are things with splice sites calculated etc. This is why for initialisation this needs a /ComplexSequenceEvalSet of the correct type.

Member functions of cDNADB

#### 14.2.1 get_cDNA_from_cDNADB

External C
  Wise2_get_cDNA_from_cDNADB (cdnadb,de)
Perl
  &Wise2::cDNADB::get_entry (cdnadb,de)
Perl-OOP call
  $obj->get_entry(de)

Arguments

cdnadb
  [READ ] cDNA database [cDNADB *]
de
  [READ ] DataEntry information [DataEntry *]
returns
  [UNKN ] Undocumented return value [cDNA *]

Gets cDNA sequence out from the cDNADB using the information stored in dataentry

## 15 codon

This module contains the following objects

- 15.2subsection.15.2 CodonTable
- This module also contains some factory methods

### 15.1 codon factory methods

#### 15.1.1 is_non_ambiguous_codon_seq

External C
  Wise2_is_non_ambiguous_codon_seq (seq)
Perl
  &Wise2::is_non_ambiguous_codon_seq (seq)

Arguments

seq
  [READ ] pointer to DNA sequence [char *]
returns
  [UNKN ] TRUE if real codon, FALSE if contains Nś [boolean]

Tells you if this codon is a real codon

#### 15.1.2 codon_from_base4_codon

External C
  Wise2_codon_from_base4_codon (c)
Perl
  &Wise2::codon_from_base4_codon (c)

Arguments

c
  [UNKN ] Undocumented argument [int]
returns
  [UNKN ] Undocumented return value [codon]

maps a 0-63 codon to a 0-123 codon. Suprisingly useful.

#### 15.1.3 base4_codon_from_codon

External C
  Wise2_base4_codon_from_codon (c)
Perl
  &Wise2::base4_codon_from_codon (c)

Arguments

c
  [READ ] codon 0-125 [codon]
returns
  [UNKN ] base 4 codon (0-63) [int]

maps a 0-125 codon to a 0-63 codon.

If ambiguous then returns 64 having issued a warning.

#### 15.1.4 has_random_bases

External C
  Wise2_has_random_bases (c)
Perl
  &Wise2::has_random_bases (c)

Arguments

c
  [READ ] codon number 0-124 [codon]
returns
  [UNKN ] TRUE if has Nś , FALSE otherwise [boolean]

Tests to see if this codon number has any Nś in it

#### 15.1.5 permute_possible_random_bases

External C
  Wise2_permute_possible_random_bases (c,one,two,three)
Perl
  &Wise2::permute_possible_random_bases (c,one,two,three)

Arguments

c
  [READ ] codon number [codon]
one
  [READ ] base to replace first position if N [base]
two
  [READ ] base to replace second position if N [base]
three
  [READ ] base to replace third position if N [base]
returns
  [UNKN ] codon number [codon]

Bizarely useful function for calculating ambiguity scores.

This takes the codon c, and for each possible base, if it is N, replaces it with one, two or three.

If the base is not N, it remains the same

#### 15.1.6 base_from_codon

External C
  Wise2_base_from_codon (c,pos)
Perl
  &Wise2::base_from_codon (c,pos)

Arguments

c
  [UNKN ] Undocumented argument [codon]
pos
  [UNKN ] Undocumented argument [int]
returns
  [UNKN ] Undocumented return value [base]

Probably not the best function to use for this, but useful. Takes a codon and with pos being 1,2,3 gives you the firt,second of third base

#### 15.1.7 codon_from_seq

External C
  Wise2_codon_from_seq (seq)
Perl
  &Wise2::codon_from_seq (seq)

Arguments

seq
  [UNKN ] pointer to sequence of at least 3 chrs long. [char *]
returns
  [UNKN ] Undocumented return value [codon]

takes an ASCII coded pointer to a 3 base pair sequence (it could be the part of a sequence: it only assumes that the seq points with 3 chars at pos 0,1,2 in C coordinates from seq. No NULL is required). It ives back the codon as made from standard mapping, ie, 25*base_1+5*base_2 + base3 being a number from 0-124 inc.

#### 15.1.8 base4_codon_from_seq

External C
  Wise2_base4_codon_from_seq (seq)
Perl
  &Wise2::base4_codon_from_seq (seq)

Arguments

seq
  [UNKN ] pointer to sequence of at least 3 chrs long [char *]
returns
  [UNKN ] Undocumented return value [int]

Sometimes it is more useful to work in base64, ie, non N. this functions does the same thing as /codon_from_seq but produces a seq being 16*base1 + 4 *base2 + base3

#### 15.1.9 char_from_base

External C
  Wise2_char_from_base (b)
Perl
  &Wise2::char_from_base (b)

Arguments

b
  [UNKN ] Undocumented argument [base]
returns
  [UNKN ] Undocumented return value [char]

maps a base number (-04 inc) to A,T,G,C,N

#### 15.1.10 base_from_char

External C
  Wise2_base_from_char (c)
Perl
  &Wise2::base_from_char (c)

Arguments

c
  [UNKN ] Undocumented argument [char]
returns
  [UNKN ] Undocumented return value [base]

maps a char (atcgn) to number, case insensitive, returns BASE_N if not atcgn

#### 15.1.11 char_complement_base

External C
  Wise2_char_complement_base (c)
Perl
  &Wise2::char_complement_base (c)

Arguments

c
  [UNKN ] Undocumented argument [char]
returns
  [UNKN ] Undocumented return value [char]

the char equivalent of /complement_base. this gives the complement in char of a base in char. Does not check for non ATGCN

#### 15.1.12 complement_base

External C
  Wise2_complement_base (b)
Perl
  &Wise2::complement_base (b)

Arguments

b
  [UNKN ] Undocumented argument [base]
returns
  [UNKN ] Undocumented return value [base]

gives back the complement as a number ofthe base (given as a number)

### 15.2 Object CodonTable

The CodonTable object has the following fields. To see how to access them refer to 7.1subsection.7.1

  codon_str[125] Type [aa : Scalar] No documentation
  name Type [char * : Scalar] No documentation

The codon table provides a mapping from the 64 codons to the 20 amino acids. The rest of the modules provides assorted codon<->base<->amino acid mappings.

Probably the trickiest thing is that there are two different types of representations of codons. One in base 5 (N being the 5th base), providing 0-124 inclusive codon numbers. These numbers are the ones going to be principly used in most calculations.

However, it is often very useful to use 0-63 numbers, for example in the precise definition of the codon table.

Member functions of CodonTable

#### 15.2.1 read_CodonTable_file

External C
  Wise2_read_CodonTable_file (file)
Perl
  &Wise2::CodonTable::read_CodonTable_file (file)
Perl-OOP call
  $obj->read_CodonTable_file()

Arguments

file
  [READ ] filename to open [char *]
returns
  [OWNER] A codon-table, NULL if error [CodonTable *]

Opens filename, reads it as if a Ewan style codon table and closes.

#### 15.2.2 read_CodonTable

External C
  Wise2_read_CodonTable (ifp)
Perl
  &Wise2::CodonTable::read_CodonTable (ifp)
Perl-OOP call
  $obj->read_CodonTable()

Arguments

ifp
  [READ ] file input [FILE *]
returns
  [UNKN ] Undocumented return value [CodonTable *]

reads a codon table from a filestream in Ewan format.

As Ewan format is really bad and has no start/stop this will effectively read to the end of the file. Ooops.

#### 15.2.3 aminoacid_from_seq

External C
  Wise2_aminoacid_from_seq (ct,seq)
Perl
  &Wise2::CodonTable::aminoacid_from_seq (ct,seq)
Perl-OOP call
  $obj->aminoacid_from_seq(seq)

Arguments

ct
  [READ ] codon table [CodonTable *]
seq
  [READ ] pointer to DNA chars [char *]
returns
  [UNKN ] an amino acid char (A-Z) [aa]

Returns the amino acid for this position in the DNA sequence Takes the pointer +1 and +2 points.

No error checks implemented. Probably a mistake ;)

#### 15.2.4 aminoacid_from_codon

External C
  Wise2_aminoacid_from_codon (ct,c)
Perl
  &Wise2::CodonTable::aminoacid_from_codon (ct,c)
Perl-OOP call
  $obj->aminoacid_from_codon(c)

Arguments

ct
  [READ ] codon table [CodonTable *]
c
  [READ ] codon number [codon]
returns
  [READ ] aminoacid that is this codon (X for ambiguous, * for stop) [aa]

returns amino acid for this codon number (NB codon numbers 0-125)

#### 15.2.5 is_stop_codon

External C
  Wise2_is_stop_codon (c,ct)
Perl
  &Wise2::CodonTable::is_stop_codon (c,ct)
Perl-OOP call
  $obj->is_stop_codon(ct)

Arguments

c
  [READ ] codon number [codon]
ct
  [READ ] codon table [CodonTable *]
returns
  [UNKN ] TRUE if is stop, FALSE otherwise [boolean]

tells you whether this codon number is really a stop in this translation table

#### 15.2.6 is_valid_aminoacid

External C
  Wise2_is_valid_aminoacid (ct,c)
Perl
  &Wise2::CodonTable::is_valid_aminoacid (ct,c)
Perl-OOP call
  $obj->is_valid_aminoacid(c)

Arguments

ct
  [READ ] Codon Table [CodonTable *]
c
  [UNKN ] aminoacid [char]
returns
  [UNKN ] TRUE if valid, FALSE if not. [boolean]

Tells you if this letter (c) is recognised as a valid amino acid in this codon table

## 16 codonmapper

This module contains the following objects

- 16.2subsection.16.2 CodonMapper
- This module also contains some factory methods

### 16.1 codonmapper factory methods

#### 16.1.1 flat_CodonMapper

External C
  Wise2_flat_CodonMapper (ct)
Perl
  &Wise2::flat_CodonMapper (ct)

Arguments

ct
  [UNKN ] Codon Table giving codon->aa info [CodonTable *]
returns
  [UNKN ] Undocumented return value [CodonMapper *]

Makes a CodonMapper with no codon bias or error possiblities from codon table

### 16.2 Object CodonMapper

The CodonMapper object has the following fields. To see how to access them refer to 7.1subsection.7.1

  ct Type [CodonTable * : Scalar] hard-linked!
  codon_map[125][26] Type [double : Scalar] No documentation

CodonMapper holds a matrix of 125 by 26 to provide a mapping between a probabilities calculated on amino acids to triplet codon probabilities. This mapping takes into account 3 things

      1) The CodonTable
      2) The distribution of synonmous codons (codon bias)
      3) substitution errors

Member functions of CodonMapper

#### 16.2.1 sprinkle_errors_over_CodonMapper

External C
  Wise2_sprinkle_errors_over_CodonMapper (cm,error)
Perl
  &Wise2::CodonMapper::sprinkle_errors_over_CodonMapper (cm,error)
Perl-OOP call
  $obj->sprinkle_errors_over_CodonMapper(error)

Arguments

cm
  [READ ] CodonMapper to be sprinkled [CodonMapper *]
error
  [UNKN ] substitution error rate [double]
returns
  Nothing - no return value

Takes a codon mapper and assumes that the majority of errors are due to a single base change in the codon at probability error. Therefore, for each codon it adds error * prob(codon) * 0.25 to each other codon one base away, taking away therefore the result.

## 17 complexsequence

This module contains the following objects

- 17.1subsection.17.1 ComplexSequence
- 17.2subsection.17.2 ComplexSequenceEvalSet

### 17.1 Object ComplexSequence

The ComplexSequence object has the following fields. To see how to access them refer to 7.1subsection.7.1

  type Type [int : Scalar] No documentation
  seq Type [Sequence * : Scalar] No documentation
  data Type [int * : Scalar] No documentation
  datastore Type [int * : Scalar] No documentation
  depth Type [int : Scalar] No documentation
  length Type [int : Scalar] No documentation
  creator Type [ComplexSequenceEvalSet * : Scalar] what made it

A ComplexSequence is an abstraction of a Sequence which can be handily made using ComplexSequenceEval functions and is efficiently laid out in memory.

Member functions of ComplexSequence

### 17.2 Object ComplexSequenceEvalSet

The ComplexSequenceEvalSet object has the following fields. To see how to access them refer to 7.1subsection.7.1

  type Type [int : Scalar] No documentation
  has_been_prepared Type [boolean : Scalar] No documentation
  left_window Type [int : Scalar] overall sequence eval
  right_window Type [int : Scalar] overall sequence eval
  left_lookback Type [int : Scalar] overall sequence eval
  cse Type [ComplexSequenceEval ** : List] No documentation

This object holds a collection of ComplexSequenceEvals. Its role is to define the sequence specific parts of a dynamic programming algorithm as computable functions.

Ideally you should use pre-made ComplexSequenceEvalSets as it will save you alot of grief

Member functions of ComplexSequenceEvalSet

## 18 compmat

This module contains the following objects

- 18.1subsection.18.1 CompMat

### 18.1 Object CompMat

The CompMat object has the following fields. To see how to access them refer to 7.1subsection.7.1

  comp[26][26] Type [Score : Scalar] No documentation
  name Type [char * : Scalar] if any, could be NULL

This object stores BLOSUM and PAM comparison matrices. It stores them as scores: NB - this means probabilistically we are talking about some arbitary base of log which is really annoying.

Member functions of CompMat

#### 18.1.1 fail_safe_CompMat_access

External C
  Wise2_fail_safe_CompMat_access (cm,aa1,aa2)
Perl
  &Wise2::CompMat::fail_safe_CompMat_access (cm,aa1,aa2)
Perl-OOP call
  $obj->fail_safe_CompMat_access(aa1,aa2)

Arguments

cm
  [UNKN ] compmat object [CompMat *]
aa1
  [UNKN ] first amino acid [int]
aa2
  [UNKN ] second amino acid [int]
returns
  [UNKN ] Undocumented return value [Score]

gives the fail form of the macro CompMat_AAMATCH which checks that aa1 and a2 are sensible and that cm is not NULL.

#### 18.1.2 write_Blast_CompMat

External C
  Wise2_write_Blast_CompMat (cm,ofp)
Perl
  &Wise2::CompMat::write_Blast_CompMat (cm,ofp)
Perl-OOP call
  $obj->write_Blast_CompMat(ofp)

Arguments

cm
  [UNKN ] CompMat object [CompMat *]
ofp
  [UNKN ] file to output [FILE *]
returns
  [UNKN ] Undocumented return value [boolean]

writes a protien CompMat with a standard alphabet.

#### 18.1.3 read_Blast_file_CompMat

External C
  Wise2_read_Blast_file_CompMat (filename)
Perl
  &Wise2::CompMat::read_Blast_file_CompMat (filename)
Perl-OOP call
  $obj->read_Blast_file_CompMat()

Arguments

filename
  [UNKN ] Undocumented argument [char *]
returns
  [UNKN ] Undocumented return value [CompMat *]

Opens file, reads matrix, closes file. calls /read_Blast_CompMat for the actual format reading. Uses /openfile to open the file, so will open from config files.

#### 18.1.4 read_Blast_CompMat

External C
  Wise2_read_Blast_CompMat (ifp)
Perl
  &Wise2::CompMat::read_Blast_CompMat (ifp)
Perl-OOP call
  $obj->read_Blast_CompMat()

Arguments

ifp
  [UNKN ] Undocumented argument [FILE *]
returns
  [UNKN ] Undocumented return value [CompMat *]

reads a BLAST format matrix and allocates a new ComMat structure.

## 19 dbsearchimpl

This module contains the following objects

- 19.2subsection.19.2 DBSearchImpl
- This module also contains some factory methods

### 19.1 dbsearchimpl factory methods

#### 19.1.1 new_pthread_DBSearchImpl

External C
  Wise2_new_pthread_DBSearchImpl (void)
Perl
  &Wise2::new_pthread_DBSearchImpl ()

Arguments

returns
  [UNKN ] Undocumented return value [DBSearchImpl *]

Makes a new pthreaded DBSearchImpl

For use mainly for apiś who dont́ want to initalize the object from the command line

#### 19.1.2 new_serial_DBSearchImpl

External C
  Wise2_new_serial_DBSearchImpl (void)
Perl
  &Wise2::new_serial_DBSearchImpl ()

Arguments

returns
  [UNKN ] Undocumented return value [DBSearchImpl *]

Makes a new serial DBSearchImpl

For use mainly for apiś who dont́ want to initalize the object from the command line

### 19.2 Object DBSearchImpl

The DBSearchImpl object has the following fields. To see how to access them refer to 7.1subsection.7.1

  type Type [int : Scalar] No documentation
  trace_level Type [int : Scalar] how much debugging information to print
  trace_file Type [FILE * : Scalar] for writing out trace of db stuff
  suggest_thread_no Type [int : Scalar] default, -1, means the use a call to _SC_NPROC
  search_routine Type [int : Scalar] routine used for the calculation, exact/kbest

DBSearchImpl contains the information about the database search implementation used in a dynamite call. This is the only object which needs to specify say threads vs serial code

The construction of this object is from its own stripping of the command line. This way programs which do database searching need not know anything about the implementation that is being used by the dynamite compiler

From the API you should be looking to make it from one of the handy constructors.

For the threads code, if you leave the suggest_thread_no at (-1) - what it usually comes as for the constructors. The system then figures out the number of processors available on the machine and sets it to that.

Member functions of DBSearchImpl

#### 19.2.1 impl_string_DBSearchImpl

External C
  Wise2_impl_string_DBSearchImpl (dbsi)
Perl
  &Wise2::DBSearchImpl::string (dbsi)
Perl-OOP call
  $obj->string()

Arguments

dbsi
  [UNKN ] Undocumented argument [DBSearchImpl *]
returns
  [SOFT ] string of the search implementation [char *]

Gets a static text string out of the search implementation

## 20 dnamatrix

This module contains the following objects

- 20.2subsection.20.2 DnaMatrix
- 20.3subsection.20.3 DnaProbMatrix
- This module also contains some factory methods

### 20.1 dnamatrix factory methods

#### 20.1.1 identity_DnaMatrix

External C
  Wise2_identity_DnaMatrix (id_score,mismatch)
Perl
  &Wise2::identity_DnaMatrix (id_score,mismatch)

Arguments

id_score
  [UNKN ] score of idenities [Score]
mismatch
  [UNKN ] score of mistmatches [Score]
returns
  [UNKN ] Undocumented return value [DnaMatrix *]

makes an idenity matrix wth id_score on the leading diagonal and mismatch elsewhere.

#### 20.1.2 DnaProbMatrix_from_match

External C
  Wise2_DnaProbMatrix_from_match (match,nmask_type)
Perl
  &Wise2::DnaProbMatrix_from_match (match,nmask_type)

Arguments

match
  [UNKN ] Undocumented argument [Probability]
nmask_type
  [UNKN ] Undocumented argument [int]
returns
  [UNKN ] Undocumented return value [DnaProbMatrix *]

Makes a probability matrix from simple match/mismatch probabilities.

#### 20.1.3 DnaMatrix_from_DnaProbMatrix

External C
  Wise2_DnaMatrix_from_DnaProbMatrix (dpm)
Perl
  &Wise2::DnaMatrix_from_DnaProbMatrix (dpm)

Arguments

dpm
  [UNKN ] Undocumented argument [DnaProbMatrix *]
returns
  [UNKN ] Undocumented return value [DnaMatrix *]

Maps probabilities to scores

### 20.2 Object DnaMatrix

The DnaMatrix object has the following fields. To see how to access them refer to 7.1subsection.7.1

  score[5][5] Type [Score : Scalar] No documentation

No documentation for DnaMatrix

Member functions of DnaMatrix

### 20.3 Object DnaProbMatrix

The DnaProbMatrix object has the following fields. To see how to access them refer to 7.1subsection.7.1

  prob[5][5] Type [Probability : Scalar] No documentation

No documentation for DnaProbMatrix

Member functions of DnaProbMatrix

#### 20.3.1 flat_null_DnaProbMatrix

External C
  Wise2_flat_null_DnaProbMatrix (dpm)
Perl
  &Wise2::DnaProbMatrix::flat_null_DnaProbMatrix (dpm)
Perl-OOP call
  $obj->flat_null_DnaProbMatrix()

Arguments

dpm
  [UNKN ] Undocumented argument [DnaProbMatrix *]
returns
  Nothing - no return value

makes a odds of dpm via a 0.25 factor into each base.

## 21 gene

This module contains the following objects

- 21.1subsection.21.1 Gene

### 21.1 Object Gene

The Gene object has the following fields. To see how to access them refer to 7.1subsection.7.1

  start Type [int : Scalar] No documentation
  end Type [int : Scalar] No documentation
  parent Type [GenomicRegion * : Scalar] may not be here
  genomic Type [Genomic * : Scalar] may not be here!
  transcript Type [Transcript ** : List] No documentation
  name Type [char * : Scalar] ugly . Need a better system
  bits Type [double : Scalar] ditto...
  seqname Type [char * : Scalar] very bad! this is for keeping track of what sequence was used to make the gene
  ispseudo Type [boolean : Scalar] is a pseudogene or not

Gene is the datastructure which represents a single gene. At the moment this is considered to be a series of transcripts (the first transcript being "canonical") which are made from a certain start/stop region in genomic DNA.

The gene datastructure does not necessarily contain any DNA sequence. When someone askes for the gene sequence, via get_Genomic_from_Gene(), it first sees if there is anything in the Genomic * ćache. If this is null, it then looks at parent (the genomic region), and if that is null, complains and returns null. Otherwise it truncates its parentś dna in the correct way, places the data structure into the genomic * cache, and returns it.

The name, bits and seqname have put into this datastructure for convience of carrying around this information into some of the gene prediction output formats. Probabaly

      o they should be in transcript, not gene
      o they shouldn\'t be here at all.

<sigh>

Member functions of Gene

#### 21.1.1 get_Genomic_from_Gene

External C
  Wise2_get_Genomic_from_Gene (gene)
Perl
  &Wise2::Gene::get_Genomic_from_Gene (gene)
Perl-OOP call
  $obj->get_Genomic_from_Gene()

Arguments

gene
  [READ ] gene to get Genomic from [Gene *]
returns
  [SOFT ] Genomic DNA data structure [Genomic *]

Gives back a Genomic sequence type from a gene.

#### 21.1.2 show_pretty_Gene

External C
  Wise2_show_pretty_Gene (ge,show_supporting,ofp)
Perl
  &Wise2::Gene::show_pretty_Gene (ge,show_supporting,ofp)
Perl-OOP call
  $obj->show_pretty_Gene(show_supporting,ofp)

Arguments

ge
  [UNKN ] Undocumented argument [Gene *]
show_supporting
  [UNKN ] Undocumented argument [boolean]
ofp
  [UNKN ] Undocumented argument [FILE *]
returns
  Nothing - no return value

Shows a gene in the biologically accepted form

## 22 genomic

This module contains the following objects

- 22.2subsection.22.2 Genomic
- 22.3subsection.22.3 GenomicRepeat
- This module also contains some factory methods

### 22.1 genomic factory methods

#### 22.1.1 read_fasta_file_Genomic

External C
  Wise2_read_fasta_file_Genomic (filename,length_of_N)
Perl
  &Wise2::read_fasta_file_Genomic (filename,length_of_N)

Arguments

filename
  [UNKN ] filename to be opened and read [char *]
length_of_N
  [UNKN ] length of N to be considered repeat. -1 means none [int]
returns
  [UNKN ] Undocumented return value [Genomic *]

Reads a fasta file assuming that it is Genomic. Will complain if it is not, and return NULL.

#### 22.1.2 read_fasta_Genomic

External C
  Wise2_read_fasta_Genomic (ifp,length_of_N)
Perl
  &Wise2::read_fasta_Genomic (ifp,length_of_N)

Arguments

ifp
  [UNKN ] file point to be read from [FILE *]
length_of_N
  [UNKN ] length of N to be considered repeat. -1 means none [int]
returns
  [UNKN ] Undocumented return value [Genomic *]

Reads a fasta file assuming that it is Genomic. Will complain if it is not, and return NULL.

#### 22.1.3 Genomic_from_Sequence_Nheuristic

External C
  Wise2_Genomic_from_Sequence_Nheuristic (seq,length_of_N)
Perl
  &Wise2::Genomic_from_Sequence_Nheuristic (seq,length_of_N)

Arguments

seq
  [UNKN ] Undocumented argument [Sequence *]
length_of_N
  [UNKN ] Undocumented argument [int]
returns
  [UNKN ] Undocumented return value [Genomic *]

makes a new genomic from a Sequence, but assumes that all the N runs greater than a certain level are actually repeats.

#### 22.1.4 Genomic_from_Sequence

External C
  Wise2_Genomic_from_Sequence (seq)
Perl
  &Wise2::Genomic_from_Sequence (seq)

Arguments

seq
  [OWNER] Sequence to make genomic from [Sequence *]
returns
  [UNKN ] Undocumented return value [Genomic *]

makes a new genomic from a Sequence. It owns the Sequence memory, ie will attempt a /free_Sequence on the structure when /free_Genomic is called

If you want to give this genomic this Sequence and forget about it, then just hand it this sequence and set seq to NULL (no need to free it). If you intend to use the sequence object elsewhere outside of the Genomic datastructure then use Genomic_from_Sequence(/hard_link_Sequence(seq))

This is part of a strict typing system, and therefore is going to convert all non ATGCNs to Ns. You will lose information here.

### 22.2 Object Genomic

The Genomic object has the following fields. To see how to access them refer to 7.1subsection.7.1

  baseseq Type [Sequence * : Scalar] No documentation
  repeat Type [GenomicRepeat ** : List] No documentation

No documentation for Genomic

Member functions of Genomic

#### 22.2.1 truncate_Genomic

External C
  Wise2_truncate_Genomic (gen,start,stop)
Perl
  &Wise2::Genomic::truncate_Genomic (gen,start,stop)
Perl-OOP call
  $obj->truncate_Genomic(start,stop)

Arguments

gen
  [READ ] Genomic that is truncated [Genomic *]
start
  [UNKN ] Undocumented argument [int]
stop
  [UNKN ] Undocumented argument [int]
returns
  [UNKN ] Undocumented return value [Genomic *]

Truncates a Genomic sequence. Basically uses the /magic_trunc_Sequence function (of course!)

It does not alter gen, rather it returns a new sequence with that truncation

Handles repeat information correctly.

#### 22.2.2 Genomic_name

External C
  Wise2_Genomic_name (gen)
Perl
  &Wise2::Genomic::Genomic_name (gen)
Perl-OOP call
  $obj->Genomic_name()

Arguments

gen
  [UNKN ] Undocumented argument [Genomic *]
returns
  [UNKN ] Undocumented return value [char *]

Returns the name of the Genomic

#### 22.2.3 Genomic_length

External C
  Wise2_Genomic_length (gen)
Perl
  &Wise2::Genomic::Genomic_length (gen)
Perl-OOP call
  $obj->Genomic_length()

Arguments

gen
  [UNKN ] Undocumented argument [Genomic *]
returns
  [UNKN ] Undocumented return value [int]

Returns the length of the Genomic

#### 22.2.4 Genomic_seqchar

External C
  Wise2_Genomic_seqchar (gen,pos)
Perl
  &Wise2::Genomic::Genomic_seqchar (gen,pos)
Perl-OOP call
  $obj->Genomic_seqchar(pos)

Arguments

gen
  [UNKN ] Genomic [Genomic *]
pos
  [UNKN ] position in Genomic to get char [int]
returns
  [UNKN ] Undocumented return value [char]

Returns sequence character at this position.

#### 22.2.5 show_Genomic

External C
  Wise2_show_Genomic (gen,ofp)
Perl
  &Wise2::Genomic::show (gen,ofp)
Perl-OOP call
  $obj->show(ofp)

Arguments

gen
  [UNKN ] Undocumented argument [Genomic *]
ofp
  [UNKN ] Undocumented argument [FILE *]
returns
  Nothing - no return value

For debugging

### 22.3 Object GenomicRepeat

The GenomicRepeat object has the following fields. To see how to access them refer to 7.1subsection.7.1

  start Type [int : Scalar] No documentation
  end Type [int : Scalar] No documentation
  type Type [char * : Scalar] No documentation

No documentation for GenomicRepeat

Member functions of GenomicRepeat

## 23 genomicdb

This module contains the following objects

- 23.2subsection.23.2 GenomicDB
- This module also contains some factory methods

### 23.1 genomicdb factory methods

#### 23.1.1 new_GenomicDB_from_single_seq

External C
  Wise2_new_GenomicDB_from_single_seq (gen,cses,score_in_repeat_coding)
Perl
  &Wise2::new_GenomicDB_from_single_seq (gen,cses,score_in_repeat_coding)

Arguments

gen
  [UNKN ] sequence which as placed into GenomicDB structure. [Genomic *]
cses
  [UNKN ] Undocumented argument [ComplexSequenceEvalSet *]
score_in_repeat_coding
  [UNKN ] Undocumented argument [int]
returns
  [UNKN ] Undocumented return value [GenomicDB *]

To make a new genomic database from a single Genomic Sequence with a eval system

#### 23.1.2 new_GenomicDB

External C
  Wise2_new_GenomicDB (seqdb,cses,length_of_N,repeat_in_cds_score)
Perl
  &Wise2::new_GenomicDB (seqdb,cses,length_of_N,repeat_in_cds_score)

Arguments

seqdb
  [UNKN ] sequence database [SequenceDB *]
cses
  [UNKN ] protein evaluation set [ComplexSequenceEvalSet *]
length_of_N
  [UNKN ] Undocumented argument [int]
repeat_in_cds_score
  [UNKN ] Undocumented argument [int]
returns
  [UNKN ] Undocumented return value [GenomicDB *]

To make a new genomic database

### 23.2 Object GenomicDB

The GenomicDB object has the following fields. To see how to access them refer to 7.1subsection.7.1

  is_single_seq Type [boolean : Scalar] No documentation
  done_forward Type [boolean : Scalar] No documentation
  forw Type [ComplexSequence * : Scalar] No documentation
  rev Type [ComplexSequence * : Scalar] No documentation
  sdb Type [SequenceDB * : Scalar] No documentation
  current Type [Genomic * : Scalar] No documentation
  cses Type [ComplexSequenceEvalSet * : Scalar] No documentation
  error_handling Type [GenDBErrorType : Scalar] No documentation
  single Type [Genomic * : Scalar] for single sequence cases, so we can índexón it
  revsingle Type [Genomic * : Scalar] No documentation
  length_of_N Type [int : Scalar] No documentation
  repeat_in_cds_score Type [int : Scalar] No documentation

This object hold a database of genomic sequences.

You will probably use it in one of two ways

1 A sequence formatted database, which is provided by a /SequenceDB object is used to provide the raw sequences

2 A single Genomic sequence is used.

In each case this database provides both the forward and reverse strands into the system.

Notice that what is exported are /ComplexSequence objects, not genomic dna, as this is what is generally needed. These are things with splice sites calculated etc. This is why for initialisation this needs a /ComplexSequenceEvalSet of the correct type.

Member functions of GenomicDB

#### 23.2.1 get_Genomic_from_GenomicDB

External C
  Wise2_get_Genomic_from_GenomicDB (gendb,de)
Perl
  &Wise2::GenomicDB::get_Genomic_from_GenomicDB (gendb,de)
Perl-OOP call
  $obj->get_Genomic_from_GenomicDB(de)

Arguments

gendb
  [UNKN ] Undocumented argument [GenomicDB *]
de
  [UNKN ] Undocumented argument [DataEntry *]
returns
  [UNKN ] Undocumented return value [Genomic *]

Gets Genomic sequence out from the GenomicDB using the information stored in dataentry

## 24 genomicregion

This module contains the following objects

- 24.1subsection.24.1 GenomicRegion

### 24.1 Object GenomicRegion

The GenomicRegion object has the following fields. To see how to access them refer to 7.1subsection.7.1

  gene Type [Gene ** : List] No documentation
  genomic Type [Genomic * : Scalar] NB, may not be here. Be careful!

GenomicRegion is structure which represents information on a region of genomic DNA. It *may not* have the actual DNA sequence in there, and it is important to realise that.

The numbering scheme of many other things (eg, genes) are going to be represented in this guys coordinates

Member functions of GenomicRegion

#### 24.1.1 new_GenomicRegion

External C
  Wise2_new_GenomicRegion (gen)
Perl
  &Wise2::GenomicRegion::new_GenomicRegion (gen)
Perl-OOP call
  $obj->new_GenomicRegion()

Arguments

gen
  [UNKN ] Undocumented argument [Genomic *]
returns
  [UNKN ] Undocumented return value [GenomicRegion *]

makes a genomicregion from a genomic sequence

#### 24.1.2 read_EMBL_GenomicRegion_file

External C
  Wise2_read_EMBL_GenomicRegion_file (filename)
Perl
  &Wise2::GenomicRegion::read_EMBL_GenomicRegion_file (filename)
Perl-OOP call
  $obj->read_EMBL_GenomicRegion_file()

Arguments

filename
  [UNKN ] Undocumented argument [char *]
returns
  [UNKN ] Undocumented return value [GenomicRegion *]

Reads in both EMBL sequence and features

#### 24.1.3 read_EMBL_GenomicRegion

External C
  Wise2_read_EMBL_GenomicRegion (ifp)
Perl
  &Wise2::GenomicRegion::read_EMBL_GenomicRegion (ifp)
Perl-OOP call
  $obj->read_EMBL_GenomicRegion()

Arguments

ifp
  [UNKN ] Undocumented argument [FILE *]
returns
  [UNKN ] Undocumented return value [GenomicRegion *]

Reads in both EMBL sequence and features

#### 24.1.4 add_Gene_to_GenomicRegion

External C
  Wise2_add_Gene_to_GenomicRegion (gr,gene)
Perl
  &Wise2::GenomicRegion::add_Gene_to_GenomicRegion (gr,gene)
Perl-OOP call
  $obj->add_Gene_to_GenomicRegion(gene)

Arguments

gr
  [UNKN ] GenomicRegion to be added to [GenomicRegion *]
gene
  [UNKN ] Gene to be added [Gene *]
returns
  [UNKN ] Undocumented return value [boolean]

adds a Gene to this GenomicRegion, making sure that it parent/son relationship is ok

#### 24.1.5 show_ace_GenomicRegion

External C
  Wise2_show_ace_GenomicRegion (gr,seq_name,ofp)
Perl
  &Wise2::GenomicRegion::show_ace_GenomicRegion (gr,seq_name,ofp)
Perl-OOP call
  $obj->show_ace_GenomicRegion(seq_name,ofp)

Arguments

gr
  [UNKN ] Undocumented argument [GenomicRegion *]
seq_name
  [UNKN ] Undocumented argument [char *]
ofp
  [UNKN ] Undocumented argument [FILE *]
returns
  Nothing - no return value

shows ACeDB subsequence source.

Assummes

      a only one transcript per gene
      b only cds exons are used

#### 24.1.6 show_pretty_GenomicRegion

External C
  Wise2_show_pretty_GenomicRegion (gr,show_supporting,ofp)
Perl
  &Wise2::GenomicRegion::show_pretty_GenomicRegion (gr,show_supporting,ofp)
Perl-OOP call
  $obj->show_pretty_GenomicRegion(show_supporting,ofp)

Arguments

gr
  [UNKN ] Undocumented argument [GenomicRegion *]
show_supporting
  [UNKN ] Undocumented argument [boolean]
ofp
  [UNKN ] Undocumented argument [FILE *]
returns
  Nothing - no return value

shows ṕrettyb́io type gene

#### 24.1.7 write_Diana_FT_GenomicRegion

External C
  Wise2_write_Diana_FT_GenomicRegion (gr,ofp)
Perl
  &Wise2::GenomicRegion::write_Diana_FT_GenomicRegion (gr,ofp)
Perl-OOP call
  $obj->write_Diana_FT_GenomicRegion(ofp)

Arguments

gr
  [UNKN ] Undocumented argument [GenomicRegion *]
ofp
  [UNKN ] Undocumented argument [FILE *]
returns
  Nothing - no return value

Writes Embl feature table for diana use. Does assume that there is only one transcript per gene and only cds exons are used

Output like

       FT   misc\_feature       join(100..200)

#### 24.1.8 write_Embl_FT_GenomicRegion

External C
  Wise2_write_Embl_FT_GenomicRegion (gr,ofp)
Perl
  &Wise2::GenomicRegion::write_Embl_FT_GenomicRegion (gr,ofp)
Perl-OOP call
  $obj->write_Embl_FT_GenomicRegion(ofp)

Arguments

gr
  [UNKN ] Undocumented argument [GenomicRegion *]
ofp
  [UNKN ] Undocumented argument [FILE *]
returns
  Nothing - no return value

Writes Embl feature table. Does assume that there is only one transcript per gene and only cds exons are used

Output like

       FT   CDS          join(100..200)

## 25 histogram

This module contains the following objects

- 25.2subsection.25.2 Histogram
- This module also contains some factory methods

### 25.1 histogram factory methods

#### 25.1.1 new_Histogram

External C
  Wise2_new_Histogram (min,max,lumpsize)
Perl
  &Wise2::new_Histogram (min,max,lumpsize)

Arguments

min
  [UNKN ] minimum score (integer) [int]
max
  [UNKN ] maximum score (integer) [int]
lumpsize
  [UNKN ] when reallocating histogram, the reallocation amount [int]
returns
  [UNKN ] Undocumented return value [Histogram *]

This function was written by Sean Eddy as part of his HMMer2 histogram.c module

Converted by Ewan Birney to Dynamite source June 98. Copyright is LGPL. For more info read READMEs

Documentation:

Allocate and return a histogram structure. min and max are your best guess. They need not be absolutely correct; the histogram will expand dynamically to accomodate scores that exceed these suggested bounds. The amount that the histogram grows by is set by "lumpsize"

Was called AllocHistorgram new_Historgram is more wise2-ish

### 25.2 Object Histogram

The Histogram object has the following fields. To see how to access them refer to 7.1subsection.7.1

  histogram Type [int* : Scalar] counts of hits
  min Type [int : Scalar] elem 0 of histogram == min
  max Type [int : Scalar] last elem of histogram == max
  highscore Type [int : Scalar] highest active elem has this score
  lowscore Type [int : Scalar] lowest active elem has this score
  lumpsize Type [int : Scalar] when resizing, overalloc by this
  total Type [int : Scalar] total # of hits counted
  expect Type [float* : Scalar] expected counts of hits
  fit_type Type [int : Scalar] flag indicating distribution type
  param[3] Type [float : Scalar] parameters used for fits
  chisq Type [float : Scalar] chi-squared val for goodness of fit
  chip Type [float : Scalar] P value for chisquared

This Object came from Sean Eddy excellent histogram package. He donated it free of all restrictions to allow it to be used in the Wise2 package without complicated licensing terms. He is a *very* nice man.

It was made into a dynamite object so that

       a) External ports to scripting languages would be trivial
       b) cooperation with future versions of histogram.c would be possible.

Here is the rest of the documentation from sean.

Keep a score histogram.

The main implementation issue here is that the range of scores is unknown, and will go negative. histogram is a 0..max-min array that represents the range min..max. A given score is indexed in histogram array as score-min. The AddToHistogram function deals with dynamically resizing the histogram array when necessary.

Member functions of Histogram

#### 25.2.1 UnfitHistogram

External C
  Wise2_UnfitHistogram (h)
Perl
  &Wise2::Histogram::UnfitHistogram (h)
Perl-OOP call
  $obj->UnfitHistogram()

Arguments

h
  [UNKN ] Undocumented argument [Histogram *]
returns
  Nothing - no return value

This function was written by Sean Eddy as part of his HMMer2 histogram.c module

Converted by Ewan Birney to Dynamite source June 98. Copyright is LGPL. For more info read READMEs

Documentation:

Free only the theoretical fit part of a histogram.

#### 25.2.2 AddToHistogram

External C
  Wise2_AddToHistogram (h,sc)
Perl
  &Wise2::Histogram::add (h,sc)
Perl-OOP call
  $obj->add(sc)

Arguments

h
  [UNKN ] Undocumented argument [Histogram *]
sc
  [UNKN ] Undocumented argument [float]
returns
  Nothing - no return value

This function was written by Sean Eddy as part of his HMMer2 histogram.c module

Converted by Ewan Birney to Dynamite source June 98. Copyright is LGPL. For more info read READMEs

Documentation:

Bump the appropriate counter in a histogram structure, given a score. The score is rounded off from float precision to the next lower integer.

#### 25.2.3 PrintASCIIHistogram

External C
  Wise2_PrintASCIIHistogram (h,fp)
Perl
  &Wise2::Histogram::show (h,fp)
Perl-OOP call
  $obj->show(fp)

Arguments

h
  [UNKN ] histogram to print [Histogram *]
fp
  [UNKN ] open file to print to (stdout works) [FILE *]
returns
  Nothing - no return value

This function was written by Sean Eddy as part of his HMMer2 histogram.c module

Converted by Ewan Birney to Dynamite source June 98. Copyright is LGPL. For more info read READMEs

Documentation:

Print a "prettified" histogram to a file pointer. Deliberately a look-and-feel clone of Bill Pearsonś excellent FASTA output.

#### 25.2.4 EVDBasicFit

External C
  Wise2_EVDBasicFit (h)
Perl
  &Wise2::Histogram::EVDBasicFit (h)
Perl-OOP call
  $obj->EVDBasicFit()

Arguments

h
  [UNKN ] histogram to fit [Histogram *]
returns
  Nothing - no return value

This function was written by Sean Eddy as part of his HMMer2 histogram.c module

Converted by Ewan Birney to Dynamite source June 98. Copyright is LGPL. For more info read READMEs

Documentation:

Fit a score histogram to the extreme value distribution. Set the parameters lambda and mu in the histogram structure. Fill in the expected values in the histogram. Calculate a chi-square test as a measure of goodness of fit.

This is the basic version of ExtremeValueFitHistogram(), in a nonrobust form: simple linear regression with no outlier pruning.

Methods: Uses a linear regression fitting method [Collins88,Lawless82]

#### 25.2.5 ExtremeValueFitHistogram

External C
  Wise2_ExtremeValueFitHistogram (h,censor,high_hint)
Perl
  &Wise2::Histogram::fit_EVD (h,censor,high_hint)
Perl-OOP call
  $obj->fit_EVD(censor,high_hint)

Arguments

h
  [UNKN ] histogram to fit [Histogram *]
censor
  [UNKN ] TRUE to censor data left of the peak [int]
high_hint
  [UNKN ] score cutoff; above this are real hits that arent fit [float]
returns
  [UNKN ] if fit is judged to be valid else 0 if fit is invalid (too few seqs.) [int]

This function was written by Sean Eddy as part of his HMMer2 histogram.c module

Converted by Ewan Birney to Dynamite source June 98. Copyright is LGPL. For more info read READMEs

Documentation:

Purpose: Fit a score histogram to the extreme value distribution. Set the parameters lambda and mu in the histogram structure. Calculate a chi-square test as a measure of goodness of fit.

Methods: Uses a maximum likelihood method [Lawless82]. Lower outliers are removed by censoring the data below the peak. Upper outliers are removed iteratively using method described by [Mott92].

#### 25.2.6 ExtremeValueSetHistogram

External C
  Wise2_ExtremeValueSetHistogram (h,mu,lambda,lowbound,highbound,wonka,ndegrees)
Perl
  &Wise2::Histogram::set_EVD (h,mu,lambda,lowbound,highbound,wonka,ndegrees)
Perl-OOP call
  $obj->set_EVD(mu,lambda,lowbound,highbound,wonka,ndegrees)

Arguments

h
  [UNKN ] the histogram to set [Histogram *]
mu
  [UNKN ] mu location parameter [float]
lambda
  [UNKN ] lambda scale parameter [float]
lowbound
  [UNKN ] low bound of the histogram that was fit [float]
highbound
  [UNKN ] high bound of histogram that was fit [float]
wonka
  [UNKN ] fudge factor; fraction of hits estimated to be "EVD-like" [float]
ndegrees
  [UNKN ] extra degrees of freedom to subtract in chi2 test: [int]
returns
  Nothing - no return value

This function was written by Sean Eddy as part of his HMMer2 histogram.c module

Converted by Ewan Birney to Dynamite source June 98. Copyright is LGPL. For more info read READMEs

Documentation:

Instead of fitting the histogram to an EVD, simply set the EVD parameters from an external source.

Note that the fudge factor "wonka" is used /only/ for prettification of expected/theoretical curves in PrintASCIIHistogram displays.

#### 25.2.7 GaussianFitHistogram

External C
  Wise2_GaussianFitHistogram (h,high_hint)
Perl
  &Wise2::Histogram::fit_Gaussian (h,high_hint)
Perl-OOP call
  $obj->fit_Gaussian(high_hint)

Arguments

h
  [UNKN ] histogram to fit [Histogram *]
high_hint
  [UNKN ] score cutoff; above this are ‘realh́its that arent́ fit [float]
returns
  [UNKN ] if fit is judged to be valid else 0 if fit is invalid (too few seqs.) [int]

This function was written by Sean Eddy as part of his HMMer2 histogram.c module

Converted by Ewan Birney to Dynamite source June 98. Copyright is LGPL. For more info read READMEs

Documentation:

Fit a score histogram to a Gaussian distribution. Set the parameters mean and sd in the histogram structure, as well as a chi-squared test for goodness of fit.

#### 25.2.8 GaussianSetHistogram

External C
  Wise2_GaussianSetHistogram (h,mean,sd)
Perl
  &Wise2::Histogram::set_Gaussian (h,mean,sd)
Perl-OOP call
  $obj->set_Gaussian(mean,sd)

Arguments

h
  [UNKN ] Undocumented argument [Histogram *]
mean
  [UNKN ] Undocumented argument [float]
sd
  [UNKN ] Undocumented argument [float]
returns
  Nothing - no return value

This function was written by Sean Eddy as part of his HMMer2 histogram.c module

Converted by Ewan Birney to Dynamite source June 98. Copyright is LGPL. For more info read READMEs

Documentation:

Instead of fitting the histogram to a Gaussian, simply set the Gaussian parameters from an external source.

#### 25.2.9 Evalue_from_Histogram

External C
  Wise2_Evalue_from_Histogram (his,score)
Perl
  &Wise2::Histogram::evalue (his,score)
Perl-OOP call
  $obj->evalue(score)

Arguments

his
  [UNKN ] Histogram object [Histogram *]
score
  [UNKN ] score you want the evalue for [double]
returns
  [UNKN ] Undocumented return value [double]

This is a convient short cut for calculating expected values from the histogram of results

## 26 hscore

This module contains the following objects

- 26.2subsection.26.2 Hscore
- 26.3subsection.26.3 DataScore
- 26.4subsection.26.4 DataEntry
- This module also contains some factory methods

### 26.1 hscore factory methods

#### 26.1.1 std_score_Hscore

External C
  Wise2_std_score_Hscore (cut_off,report_stagger)
Perl
  &Wise2::std_score_Hscore (cut_off,report_stagger)

Arguments

cut_off
  [UNKN ] Undocumented argument [int]
report_stagger
  [UNKN ] Undocumented argument [int]
returns
  [UNKN ] Undocumented return value [Hscore *]

This gives you a standard Hscore module with a cutoff in score

### 26.2 Object Hscore

The Hscore object has the following fields. To see how to access them refer to 7.1subsection.7.1

  ds Type [DataScore ** : List] No documentation
  store Type [DataScoreStorage ** : List] No documentation
  his Type [Histogram * : Scalar] No documentation
  score_level Type [double : Scalar] passed into should_store function
  should_store Type [boolean (*should_store)(int given_score,double internal_score_level) : Scalar] No documentation
  score_to_his Type [float (*score_to_his)(int given_score) : Scalar] No documentation
  report_level Type [int : Scalar] number of sequences to report on
  total Type [long : Scalar] total number of scores (duplicated info in histogram)

Holds the information about a db search. Meant to be very lightweight

The histogram is carried for on-the-fly histogram storage outside of the database. The idea is that the function should_store will tell whether the datascore structure should be stored (if it is NULL, it is always stored). The score_to_his function maps the score in datascore to the float in Histogram, allowing the scoring system of the search method to be on a different basis to the scoring system of the histogram. For most times, this is going to be Score2Bits

To prevent too much dependency, the śtandardẃay of making a histogram that has a bits cut off level is done using functions in the dynlibcross module (cross code), as it needs both Hscore and Probability. You should read dynlibcross module for the constructors for Hscore

Member functions of Hscore

#### 26.2.1 minimum_score_Hscore

External C
  Wise2_minimum_score_Hscore (hs)
Perl
  &Wise2::Hscore::minimum_score_Hscore (hs)
Perl-OOP call
  $obj->minimum_score_Hscore()

Arguments

hs
  [UNKN ] Undocumented argument [Hscore *]
returns
  [UNKN ] Undocumented return value [int]

gets the minimum score from Hscore

#### 26.2.2 maximum_score_Hscore

External C
  Wise2_maximum_score_Hscore (hs)
Perl
  &Wise2::Hscore::maximum_score_Hscore (hs)
Perl-OOP call
  $obj->maximum_score_Hscore()

Arguments

hs
  [UNKN ] Undocumented argument [Hscore *]
returns
  [UNKN ] Undocumented return value [int]

gets the maximum score from Hscore

#### 26.2.3 sort_Hscore_by_score

External C
  Wise2_sort_Hscore_by_score (hs)
Perl
  &Wise2::Hscore::sort_Hscore_by_score (hs)
Perl-OOP call
  $obj->sort_Hscore_by_score()

Arguments

hs
  [UNKN ] Hscore to be sorted [Hscore *]
returns
  Nothing - no return value

As it says, sorts the high score by its score

#### 26.2.4 length_datascore_Hscore

External C
  Wise2_length_datascore_Hscore (obj)
Perl
  &Wise2::Hscore::length (obj)
Perl-OOP call
  $obj->length()

Arguments

obj
  [READ ] Hscore object [Hscore *]
returns
  [UNKN ] Undocumented return value [int]

Returns the number of datascores in the hscore structure

#### 26.2.5 get_datascore_Hscore

External C
  Wise2_get_datascore_Hscore (hs,i)
Perl
  &Wise2::Hscore::datascore (hs,i)
Perl-OOP call
  $obj->datascore(i)

Arguments

hs
  [READ ] Hscore object [Hscore *]
i
  [UNKN ] position to be read [int]
returns
  [OWNER] New datascore object [DataScore *]

Returns the specific datascore held at this position.

This requires a considerable amount of memory duplication, so please dont process all your results by looping through this.

#### 26.2.6 get_score_Hscore

External C
  Wise2_get_score_Hscore (hs,i)
Perl
  &Wise2::Hscore::score (hs,i)
Perl-OOP call
  $obj->score(i)

Arguments

hs
  [READ ] Hscore object [Hscore *]
i
  [UNKN ] position to be read [int]
returns
  [UNKN ] score [int]

Returns the score of the specific datascore held at this position.

#### 26.2.7 get_evalue_Hscore

External C
  Wise2_get_evalue_Hscore (hs,i)
Perl
  &Wise2::Hscore::evalue (hs,i)
Perl-OOP call
  $obj->evalue(i)

Arguments

hs
  [READ ] Hscore object [Hscore *]
i
  [UNKN ] position to be read [int]
returns
  [UNKN ] evalue [double]

Returns the evalue of the specific datascore held at this position.

#### 26.2.8 basic_show_Hscore

External C
  Wise2_basic_show_Hscore (hs,ofp)
Perl
  &Wise2::Hscore::show (hs,ofp)
Perl-OOP call
  $obj->show(ofp)

Arguments

hs
  [UNKN ] Undocumented argument [Hscore *]
ofp
  [UNKN ] Undocumented argument [FILE *]
returns
  Nothing - no return value

The most baby-talk showing of Hscore

### 26.3 Object DataScore

The DataScore object has the following fields. To see how to access them refer to 7.1subsection.7.1

  query Type [DataEntry * : Scalar] No documentation
  target Type [DataEntry * : Scalar] No documentation
  score Type [int : Scalar] No documentation
  evalue Type [double : Scalar] No documentation
  is_stored Type [int : Scalar] No documentation

The basic one entry vs one entry structure. Each of the DataEntry datastructures actually store the information about the indexing etc.

Member functions of DataScore

### 26.4 Object DataEntry

The DataEntry object has the following fields. To see how to access them refer to 7.1subsection.7.1

  name Type [char * : Scalar] name of the entry
  data[DATAENTRYSTDPOINTS] Type [int : Scalar] space for algorithms to use
  is_reversed Type [boolean : Scalar] for sequences. handy
  byte_position Type [BytePosition : Scalar] useful for indexers - hopefully long enough!
  filename Type [char * : Scalar] useful for indexers etc.

A lightweight structure to represent the information a db search algorithm will want to store and *nothing* more about a single entry

This object will be stored twice (once for the target and once for the query) for each comparison: they probably will be on different databases and different objects.

The data field is just a number (8 at the moment) of intś available for databases to store useful information (eg, length) of the object.

A number of extra fields are provided for convience sake for indexers, including byte_position and filename.

Member functions of DataEntry

## 27 packaln

This module contains the following objects

- 27.1subsection.27.1 PackAln
- 27.2subsection.27.2 PackAlnUnit

### 27.1 Object PackAln

The PackAln object has the following fields. To see how to access them refer to 7.1subsection.7.1

  pau Type [PackAlnUnit ** : List] list of PackAlnUnits from start to end
  score Type [int : Scalar] score over the entire alignment

This is the lowest-level of representation of a DP alignment, being the list of (i,j,state) triples taken through the DP matrix. The score for the transition to this point is held as well.

This object is very low level and often a much better choice for representation is in /AlnBlock objects

Member functions of PackAln

#### 27.1.1 show_simple_PackAln

External C
  Wise2_show_simple_PackAln (pal,ofp)
Perl
  &Wise2::PackAln::show_simple_PackAln (pal,ofp)
Perl-OOP call
  $obj->show_simple_PackAln(ofp)

Arguments

pal
  [UNKN ] Undocumented argument [PackAln *]
ofp
  [UNKN ] Undocumented argument [FILE *]
returns
  Nothing - no return value

shows packaln with a pretty verbose debugging format

#### 27.1.2 show_bits_and_cumlative_PackAln

External C
  Wise2_show_bits_and_cumlative_PackAln (pal,ofp)
Perl
  &Wise2::PackAln::show_bits_and_cumlative_PackAln (pal,ofp)
Perl-OOP call
  $obj->show_bits_and_cumlative_PackAln(ofp)

Arguments

pal
  [UNKN ] Undocumented argument [PackAln *]
ofp
  [UNKN ] Undocumented argument [FILE *]
returns
  Nothing - no return value

Shows packaln as:

i,j,state,score,bits,cumlative-score,cumlative-bits

cumlative score and cumlative bits are useful sometimes

### 27.2 Object PackAlnUnit

The PackAlnUnit object has the following fields. To see how to access them refer to 7.1subsection.7.1

  i Type [int : Scalar] position in query
  j Type [int : Scalar] position in target
  state Type [int : Scalar] state in FSM
  score Type [int : Scalar] score of the transition that reached this state

Internal object for /PackAln: A single position of an alignment as the (i,j,state) triple

Member functions of PackAlnUnit

## 28 probability

This module only contains factory methods

### 28.1 probability factory methods

#### 28.1.1 Probability_from_average_state_occupancy

External C
  Wise2_Probability_from_average_state_occupancy (length)
Perl
  &Wise2::Probability_from_average_state_occupancy (length)

Arguments

length
  [UNKN ] average length of state [double]
returns
  [UNKN ] Undocumented return value [Probability]

for single state (exponetial decays) takes an average length and converts that to a probability that will produce that length (on average) for the state. NB... this *assumes* that you want a single state exp decay.

#### 28.1.2 state_occupancy_from_Probability

External C
  Wise2_state_occupancy_from_Probability (p)
Perl
  &Wise2::state_occupancy_from_Probability (p)

Arguments

p
  [UNKN ] probability of staying in the state [double]
returns
  [UNKN ] Undocumented return value [double]

If you have a single state then this will tak the probability for the state->state transition and give you back the average length in the state

#### 28.1.3 Probability2Score

External C
  Wise2_Probability2Score (p)
Perl
  &Wise2::Probability2Score (p)

Arguments

p
  [UNKN ] Undocumented argument [Probability]
returns
  [UNKN ] Undocumented return value [Score]

maps probabilities to scores. Deals sensibly with 0ś.

#### 28.1.4 Score2Probability

External C
  Wise2_Score2Probability (s)
Perl
  &Wise2::Score2Probability (s)

Arguments

s
  [UNKN ] Undocumented argument [Score]
returns
  [UNKN ] Undocumented return value [Probability]

maps scores to probabilities

#### 28.1.5 Score2Bits

External C
  Wise2_Score2Bits (s)
Perl
  &Wise2::Score2Bits (s)

Arguments

s
  [UNKN ] Undocumented argument [Score]
returns
  [UNKN ] Undocumented return value [Bits]

maps scores to bits

#### 28.1.6 halfbit2Probability

External C
  Wise2_halfbit2Probability (half_bit)
Perl
  &Wise2::halfbit2Probability (half_bit)

Arguments

half_bit
  [UNKN ] Undocumented argument [double]
returns
  [UNKN ] Undocumented return value [Probability]

maps halfbits (log2(prob*2) to probabilities

## 29 protein

This module contains the following objects

- 29.1subsection.29.1 Protein

### 29.1 Object Protein

The Protein object has the following fields. To see how to access them refer to 7.1subsection.7.1

  baseseq Type [Sequence * : Scalar] No documentation

The protein object is a typed example of a sequence object.

It does nothing more than a sequence object but is typed

Member functions of Protein

#### 29.1.1 Protein_from_Sequence

External C
  Wise2_Protein_from_Sequence (seq)
Perl
  &Wise2::Protein::Protein_from_Sequence (seq)
Perl-OOP call
  $obj->Protein_from_Sequence()

Arguments

seq
  [OWNER] Sequence to make protein from [Sequence *]
returns
  [UNKN ] Undocumented return value [Protein *]

makes a new protein from a Sequence. It owns the Sequence memory, ie will attempt a /free_Sequence on the structure when /free_Protein is called

If you want to give this protein this Sequence and forget about it, then just hand it this sequence and set seq to NULL (no need to free it). If you intend to use the sequecne object elsewhere outside of the Protein datastructure then use Protein_from_Sequence(/hard_link_Sequence(seq))

## 30 proteindb

This module contains the following objects

- 30.2subsection.30.2 ProteinDB
- This module also contains some factory methods

### 30.1 proteindb factory methods

#### 30.1.1 new_ProteinDB_from_single_seq

External C
  Wise2_new_ProteinDB_from_single_seq (seq)
Perl
  &Wise2::new_ProteinDB_from_single_seq (seq)

Arguments

seq
  [UNKN ] sequence which as placed into ProteinDB structure. [Sequence *]
returns
  [UNKN ] Undocumented return value [ProteinDB *]

To make a new protein database from a single Sequence with default amino acid mapping

#### 30.1.2 single_fasta_ProteinDB

External C
  Wise2_single_fasta_ProteinDB (filename)
Perl
  &Wise2::single_fasta_ProteinDB (filename)

Arguments

filename
  [UNKN ] name of fasta file [char *]
returns
  [UNKN ] Undocumented return value [ProteinDB *]

pre-packed single fasta protein database

#### 30.1.3 new_ProteinDB

External C
  Wise2_new_ProteinDB (seqdb,cses)
Perl
  &Wise2::new_ProteinDB (seqdb,cses)

Arguments

seqdb
  [UNKN ] sequence database [SequenceDB *]
cses
  [UNKN ] protein evaluation set [ComplexSequenceEvalSet *]
returns
  [UNKN ] Undocumented return value [ProteinDB *]

To make a new protein database

### 30.2 Object ProteinDB

The ProteinDB object has the following fields. To see how to access them refer to 7.1subsection.7.1

  is_single_seq Type [boolean : Scalar] No documentation
  is_random_db Type [boolean : Scalar] No documentation
  single Type [ComplexSequence * : Scalar] No documentation
  sdb Type [SequenceDB * : Scalar] No documentation
  cses Type [ComplexSequenceEvalSet * : Scalar] No documentation
  rnd Type [RandomProteinDB * : Scalar] No documentation
  test_dna Type [boolean : Scalar] No documentation

A database of proteins. This takes either a single sequence or a sequence database and allows a method expecting protein complexsequences to loop over it.

It also provides generic database indexing for this

Horrible physical dependency in this generated by the random protein db requiring histogram and randommodel stuff. Yuk!

Member functions of ProteinDB

## 31 randomdb

This module contains the following objects

- 31.1subsection.31.1 RandomProteinDB
- 31.2subsection.31.2 RandomDNADB

### 31.1 Object RandomProteinDB

The RandomProteinDB object has the following fields. To see how to access them refer to 7.1subsection.7.1

  use_flat_length Type [boolean : Scalar] No documentation
  length Type [int : Scalar] No documentation
  length_dist Type [Histogram * : Scalar] No documentation
  emission Type [RandomModel * : Scalar] No documentation
  num Type [int : Scalar] No documentation

No documentation for RandomProteinDB

Member functions of RandomProteinDB

### 31.2 Object RandomDNADB

The RandomDNADB object has the following fields. To see how to access them refer to 7.1subsection.7.1

  use_flat_length Type [boolean : Scalar] No documentation
  length Type [int : Scalar] No documentation
  length_dist Type [Histogram * : Scalar] No documentation
  emission Type [RandomModelDNA * : Scalar] No documentation
  num Type [int : Scalar] No documentation

No documentation for RandomDNADB

Member functions of RandomDNADB

## 32 randommodel

This module contains the following objects

- 32.2subsection.32.2 RandomModelDNA
- 32.3subsection.32.3 RandomModel
- This module also contains some factory methods

### 32.1 randommodel factory methods

#### 32.1.1 RandomModelDNA_std

External C
  Wise2_RandomModelDNA_std (void)
Perl
  &Wise2::RandomModelDNA_std ()

Arguments

returns
  [UNKN ] Undocumented return value [RandomModelDNA *]

Returns a structure with 0.25 set in each place

#### 32.1.2 default_RandomModel

External C
  Wise2_default_RandomModel (void)
Perl
  &Wise2::default_RandomModel ()

Arguments

returns
  [UNKN ] Undocumented return value [RandomModel *]

Gives a default random model numbers from swissprot34- via the HMMEr1 package

### 32.2 Object RandomModelDNA

The RandomModelDNA object has the following fields. To see how to access them refer to 7.1subsection.7.1

  base[5] Type [Probability : Scalar] No documentation
  name Type [char * : Scalar] No documentation

No documentation for RandomModelDNA

Member functions of RandomModelDNA

### 32.3 Object RandomModel

The RandomModel object has the following fields. To see how to access them refer to 7.1subsection.7.1

  aminoacid[26] Type [Probability : Scalar] No documentation
  name Type [char * : Scalar] No documentation

No documentation for RandomModel

Member functions of RandomModel

## 33 sequence

This module contains the following objects

- 33.2subsection.33.2 Sequence
- 33.3subsection.33.3 SequenceSet
- This module also contains some factory methods

### 33.1 sequence factory methods

#### 33.1.1 Sequence_type_to_string

External C
  Wise2_Sequence_type_to_string (type)
Perl
  &Wise2::Sequence_type_to_string (type)

Arguments

type
  [UNKN ] type eg SEQUENCE_PROTEIN [int]
returns
  [UNKN ] Undocumented return value [char *]

Converts sequence type (SEQUENCE_*) to a string

#### 33.1.2 new_Sequence_from_strings

External C
  Wise2_new_Sequence_from_strings (name,seq)
Perl
  &Wise2::new_Sequence_from_strings (name,seq)

Arguments

name
  [READ ] name of sequence, memory is allocated for it. [char *]
seq
  [READ ] char * of sequence, memory is allocated for it. [char *]
returns
  [UNKN ] Undocumented return value [Sequence *]

Makes a new sequence from strings given. Separate memory will be allocated for them and them copied into it.

They can be NULL, in which case o a dummy name SequenceName will be assigned o No sequence placed and length of zero.

Though this is dangerous later on.

The sequence type is calculated automatically using /best_guess_type. If you want a DNA sequence but are unsure of the content of, for example, IUPAC codes, please use /force_to_dna_Sequence before using the sequence. Most of the rest of dynamite relies on a five letter A,T,G,C,N alphabet, but this function will allow any sequence type to be stored, so please check if you want to save yourself alot of grief.

In perl and other interfaces, this is a much safer constructor than the raw "new" type

### 33.2 Object Sequence

The Sequence object has the following fields. To see how to access them refer to 7.1subsection.7.1

  name Type [char * : Scalar] name of the sequence
  seq Type [char * : Scalar] actual sequence
  len Type [int : Scalar] length of the sequence
  maxlen Type [int : Scalar] internal counter, indicating how much space in seq there is
  offset Type [int : Scalar] start (in bio-coords) of the sequence. Not called start due to weird legacy.
  end Type [int : Scalar] end (in bio-coords == C coords) of the sequence
  type Type [char : Scalar] guess of protein/dna type
  tax_id Type [int : Scalar] taxonimic id of this
  weight Type [double : Scalar] No documentation
  desc Type [char * : Scalar] description - often this will be NULL

This object is the basic sequence object, trying to hold little more than the name and sequence of the DNA/protein.

The len/maxlen is the actual length of the sequence (strlen(obj->seq)) and amount of memory allocated in obj->seq mainly for parsing purposes.

Member functions of Sequence

#### 33.2.1 uppercase_Sequence

External C
  Wise2_uppercase_Sequence (seq)
Perl
  &Wise2::Sequence::uppercase (seq)
Perl-OOP call
  $obj->uppercase()

Arguments

seq
  [RW ] Sequence to be uppercased [Sequence *]
returns
  Nothing - no return value

makes all the sequence uppercase

#### 33.2.2 force_to_dna_Sequence

External C
  Wise2_force_to_dna_Sequence (seq,fraction,number_of_conver)
Perl
  &Wise2::Sequence::force_to_dna (seq,fraction)
Perl-OOP call
  $obj->force_to_dna(fraction)

Arguments

seq
  [RW ] sequence object read and converted [Sequence *]
fraction
  [READ ] number 0..1 for tolerance of conversion [double]
number_of_conver
  only for C api [WRITE] number of conversions actually made [int *]
returns
  [READ ] TRUE for conversion to DNA, FALSE if not [boolean]

This

     a) sees how many non ATGCN characters there are in Seq
     b) If the level is below fraction
        a) flips non ATGC chars to N
        b) writes number of conversions to number\_of\_conver
        c) returns TRUE
     c) else returns FALSE

fraction of 0.0 means completely intolerant of errors fraction of 1.0 means completely tolerant of errors

#### 33.2.3 is_reversed_Sequence

External C
  Wise2_is_reversed_Sequence (seq)
Perl
  &Wise2::Sequence::is_reversed (seq)
Perl-OOP call
  $obj->is_reversed()

Arguments

seq
  [READ ] sequence to test [Sequence *]
returns
  [UNKN ] Undocumented return value [boolean]

Currently the sequence object stores reversed sequences as start > end.

This tests that and returns true if it is

#### 33.2.4 translate_Sequence

External C
  Wise2_translate_Sequence (dna,ct)
Perl
  &Wise2::Sequence::translate (dna,ct)
Perl-OOP call
  $obj->translate(ct)

Arguments

dna
  [READ ] DNA sequence to be translated [Sequence *]
ct
  [READ ] Codon table to do codon->aa mapping [CodonTable *]
returns
  [OWNER] new protein sequence [Sequence *]

This translates a DNA sequence to a protein. It assumes that it starts at first residue (use trunc_Sequence to chop a sequence up).

#### 33.2.5 reverse_complement_Sequence

External C
  Wise2_reverse_complement_Sequence (seq)
Perl
  &Wise2::Sequence::revcomp (seq)
Perl-OOP call
  $obj->revcomp()

Arguments

seq
  [READ ] Sequence to that is used to reverse (makes a new Sequence) [Sequence *]
returns
  [OWNER] new Sequence which is reversed [Sequence *]

This both complements and reverses a sequence, - a common wish!

The start/end are correct with respect to the start/end of the sequence (ie start = end, end = start).

#### 33.2.6 magic_trunc_Sequence

External C
  Wise2_magic_trunc_Sequence (seq,start,end)
Perl
  &Wise2::Sequence::magic_trunc (seq,start,end)
Perl-OOP call
  $obj->magic_trunc(start,end)

Arguments

seq
  [READ ] sequence that is the source to be truncated [Sequence *]
start
  [READ ] start point [int]
end
  [READ ] end point [int]
returns
  [OWNER] new Sequence which is truncated/reversed [Sequence *]

Clever function for dna sequences.

When start < end, truncates normally

when start > end, truncates end,start and then reverse complements.

ie. If you have a coordinate system where reverse sequences are labelled in reverse start/end way, then this routine produces the correct sequence.

#### 33.2.7 trunc_Sequence

External C
  Wise2_trunc_Sequence (seq,start,end)
Perl
  &Wise2::Sequence::trunc (seq,start,end)
Perl-OOP call
  $obj->trunc(start,end)

Arguments

seq
  [READ ] object holding the sequence to be truncated [Sequence *]
start
  [READ ] start point of truncation [int]
end
  [READ ] end point of truncation [int]
returns
  [OWNER] newly allocated sequence structure [Sequence *]

truncates a sequence. It produces a new memory structure which is filled from sequence start to end.

Please notice

      Truncation is in C coordinates. That is

the first residue is 0 and end is the number of the residue after the cut-point. In otherwords to 2 - 3 would be a single residue truncation. So - if you want to work in more usual, ínclusiveḿolecular biology numbers, which start at 1, then you need to say

      trunc\_Sequence(seq,start-1,end);

(NB, should be (end - 1 + 1) = end for the last coordinate).

      Truncation occurs against the *absolute* coordinate

system of the Sequence, not the offset/end pair inside. So, this is a very bad error

      ** wrong code, and also leaks memory **

      tru = trunc\_Sequence(trunc\_Sequence(seq,50,80),55,75);

This the most portable way of doing this

      temp = trunc\_Sequence(seq,50,80);

      tru  = trunc\_Sequence(temp,55-temp->offset,75-temp->offset);

      free\_Sequence(temp);

#### 33.2.8 read_fasta_file_Sequence

External C
  Wise2_read_fasta_file_Sequence (filename)
Perl
  &Wise2::Sequence::read_fasta_file_Sequence (filename)
Perl-OOP call
  $obj->read_fasta_file_Sequence()

Arguments

filename
  [READ ] filename to open [char *]
returns
  [UNKN ] Undocumented return value [Sequence *]

Just a call

      a) open filename
      b) read sequence with /read\_fasta\_Sequence
      c) close file.

#### 33.2.9 read_Sequence_EMBL_seq

External C
  Wise2_read_Sequence_EMBL_seq (buffer,maxlen,ifp)
Perl
  &Wise2::Sequence::read_Sequence_EMBL_seq (buffer,maxlen,ifp)
Perl-OOP call
  $obj->read_Sequence_EMBL_seq(maxlen,ifp)

Arguments

buffer
  [RW ] buffer containing the first line. [char *]
maxlen
  [READ ] length of buffer [int]
ifp
  [READ ] input file to read from [FILE *]
returns
  [UNKN ] Undocumented return value [Sequence *]

reads the sequence part of an EMBL file.

This function can either take a file which starts

#### 33.2.10 read_fasta_Sequence

External C
  Wise2_read_fasta_Sequence (ifp)
Perl
  &Wise2::Sequence::read_fasta_Sequence (ifp)
Perl-OOP call
  $obj->read_fasta_Sequence()

Arguments

ifp
  [UNKN ] Undocumented argument [FILE *]
returns
  [UNKN ] Undocumented return value [Sequence *]

reads a fasta file assuming pretty standard sanity for the file layout

#### 33.2.11 show_Sequence_residue_list

External C
  Wise2_show_Sequence_residue_list (seq,start,end,ofp)
Perl
  &Wise2::Sequence::show_debug (seq,start,end,ofp)
Perl-OOP call
  $obj->show_debug(start,end,ofp)

Arguments

seq
  [READ ] Sequence to show [Sequence *]
start
  [READ ] start of list [int]
end
  [READ ] end of list [int]
ofp
  [UNKN ] Undocumented argument [FILE *]
returns
  Nothing - no return value

shows a region of a sequence as

       124  A
       125  T

etc from start to end. The numbers are in C coordinates (ie, 0 is the first letter).

useful for debugging

#### 33.2.12 write_fasta_Sequence

External C
  Wise2_write_fasta_Sequence (seq,ofp)
Perl
  &Wise2::Sequence::write_fasta (seq,ofp)
Perl-OOP call
  $obj->write_fasta(ofp)

Arguments

seq
  [READ ] sequence to be written [Sequence *]
ofp
  [UNKN ] file to write to [FILE *]
returns
  Nothing - no return value

writes a fasta file of the form >name Sequence

#### 33.2.13 make_len_type_Sequence

External C
  Wise2_make_len_type_Sequence (seq)
Perl
  &Wise2::Sequence::validate (seq)
Perl-OOP call
  $obj->validate()

Arguments

seq
  [RW ] Sequence object [Sequence *]
returns
  Nothing - no return value

makes seq->len and seq->end match the seq->seq length number.

It also checks the type of the sequence with /best_guess_type

### 33.3 Object SequenceSet

The SequenceSet object has the following fields. To see how to access them refer to 7.1subsection.7.1

  set Type [Sequence ** : List] No documentation

A list of sequences. Not a database (you should use the db stuff for that!). But useful anyway

Member functions of SequenceSet

## 34 sequence_codon

This module only contains factory methods

### 34.1 sequence_codon factory methods

#### 34.1.1 reverse_complement_Sequence

External C
  Wise2_reverse_complement_Sequence (seq)
Perl
  &Wise2::reverse_complement_Sequence (seq)

Arguments

seq
  [READ ] Sequence to that is used to reverse (makes a new Sequence) [Sequence *]
returns
  [OWNER] new Sequence which is reversed [Sequence *]

This both complements and reverses a sequence, - a common wish!

The start/end are correct with respect to the start/end of the sequence (ie start = end, end = start).

#### 34.1.2 magic_trunc_Sequence

External C
  Wise2_magic_trunc_Sequence (seq,start,end)
Perl
  &Wise2::magic_trunc_Sequence (seq,start,end)

Arguments

seq
  [READ ] sequence that is the source to be truncated [Sequence *]
start
  [READ ] start point [int]
end
  [READ ] end point [int]
returns
  [OWNER] new Sequence which is truncated/reversed [Sequence *]

Clever function for dna sequences.

When start < end, truncates normally

when start > end, truncates end,start and then reverse complements.

ie. If you have a coordinate system where reverse sequences are labelled in reverse start/end way, then this routine produces the correct sequence.

#### 34.1.3 translate_Sequence

External C
  Wise2_translate_Sequence (dna,ct)
Perl
  &Wise2::translate (dna,ct)

Arguments

dna
  [READ ] DNA sequence to be translated [Sequence *]
ct
  [READ ] Codon table to do codon->aa mapping [CodonTable *]
returns
  [OWNER] new protein sequence [Sequence *]

This translates a DNA sequence to a protein. It assumes that it starts at first residue (use trunc_Sequence to chop a sequence up).

## 35 sequencedb

This module contains the following objects

- 35.2subsection.35.2 SequenceDB
- 35.3subsection.35.3 FileSource
- This module also contains some factory methods

### 35.1 sequencedb factory methods

#### 35.1.1 single_fasta_SequenceDB

External C
  Wise2_single_fasta_SequenceDB (filename)
Perl
  &Wise2::single_fasta_SequenceDB (filename)

Arguments

filename
  [UNKN ] name of fastadb [char *]
returns
  [UNKN ] Undocumented return value [SequenceDB *]

pre-packed single fasta file db

### 35.2 Object SequenceDB

The SequenceDB object has the following fields. To see how to access them refer to 7.1subsection.7.1

  name Type [char * : Scalar] No documentation
  fs Type [FileSource ** : List] No documentation
  current_source Type [int : Scalar] No documentation
  current_file Type [FILE * : Scalar] No documentation
  sequence_no Type [int : Scalar] No documentation
  byte_position Type [int : Scalar] No documentation
  has_warned_single Type [int : Scalar] No documentation
  seq_start Type [int : Scalar] No documentation
  seq_end Type [int : Scalar] No documentation

This is the basic Sequence database wrapper - it handles all the formats and the on-the-fly indexing.

Generally it wont be directly used by an algorithm, which will be using something specific to the sequence type produce complex sequence type objects: ie you will be using proteindb or cdnadb which internally will be using this object

Member functions of SequenceDB

#### 35.2.1 close_SequenceDB

External C
  Wise2_close_SequenceDB (last,sdb)
Perl
  &Wise2::SequenceDB::close_SequenceDB (last,sdb)
Perl-OOP call
  $obj->close_SequenceDB(sdb)

Arguments

last
  [WRITE] Sequence object to be freed [Sequence *]
sdb
  [READ ] database to be closed [SequenceDB *]
returns
  [UNKN ] Undocumented return value [boolean]

top level function that closes the SequenceDB after the last sequence is read.

### 35.3 Object FileSource

The FileSource object has the following fields. To see how to access them refer to 7.1subsection.7.1

  filename Type [char * : Scalar] No documentation
  input Type [FILE * : Scalar] could be stdin!
  format Type [int : Scalar] No documentation
  type Type [int : Scalar] No documentation

This object represents a single file source for a database. At the moment only multiple fasta files are catered for

Member functions of FileSource

## 36 transcript

This module contains the following objects

- 36.1subsection.36.1 Exon
- 36.2subsection.36.2 Transcript

### 36.1 Object Exon

The Exon object has the following fields. To see how to access them refer to 7.1subsection.7.1

  start Type [int : Scalar] No documentation
  end Type [int : Scalar] No documentation
  used Type [boolean : Scalar] used by some prediction programs etc
  score Type [double : Scalar] No documentation
  sf Type [SupportingFeature ** : List] No documentation
  phase Type [int : Scalar] No documentation

No documentation for Exon

Member functions of Exon

### 36.2 Object Transcript

The Transcript object has the following fields. To see how to access them refer to 7.1subsection.7.1

  exon Type [Exon ** : List] No documentation
  parent Type [Gene * : Scalar] No documentation
  translation Type [Translation ** : List] No documentation
  cDNA Type [cDNA * : Scalar] may not be here!

Transcript represents a single spliced product from a gene. The transcript is considered to be a series of exons and it contains, in addition a series of translations. Most genes will only have one translation.

Like gene before it, transcript does not necessarily contain DNA. When some DNA is asked from it, via get_cDNA_from_Transcript (notice the change from Genomic typed sequence in Gene to cDNA typed sequence in Transcript) it first checkes the ćache. If it is not there, it asks for its parents genomic DNA, and then assemblies the cDNA using the exon coordinates. The exon coordinates are such that 0 means the start of the gene, not the start of the genomic region. (makes some outputs a pain).

Supporting Features are added to exons, and, keeping in the spirit of this module, are relative to the exon start. The strand is inherieted from the exon

Member functions of Transcript

#### 36.2.1 get_cDNA_from_Transcript

External C
  Wise2_get_cDNA_from_Transcript (trs)
Perl
  &Wise2::Transcript::get_cDNA_from_Transcript (trs)
Perl-OOP call
  $obj->get_cDNA_from_Transcript()

Arguments

trs
  [READ ] transcript to get cDNA from [Transcript *]
returns
  [SOFT ] cDNA of the transcript [cDNA *]

gets the cDNA associated with this transcript, if necessary, building it from the exon information provided.

returns a soft-linked object. If you want to ensure that this cDNA object remains in memory use /hard_link_cDNA on the object.

## 37 translation

This module contains the following objects

- 37.1subsection.37.1 Translation

### 37.1 Object Translation

The Translation object has the following fields. To see how to access them refer to 7.1subsection.7.1

  start Type [int : Scalar] No documentation
  end Type [int : Scalar] No documentation
  parent Type [Transcript * : Scalar] No documentation
  protein Type [Protein * : Scalar] No documentation

Translation represents a single translation from a cDNA. Although most cDNAs will have one translation, this does allow us to deal with alternative translation points etc.

As with Transcript and Gene before it, the translation does not necessarily have any sequence in it. When sequence is asked for by get_Protein_from_Translation() the cache is checked, and if it is empty, then the transcriptś DNA is called for, and the converted into the translation with appropiate start and stops.

Of course, get_Protein_from_Translation can potentially trigger the construction of an entire gene upstairs, but that need not worry you here

Member functions of Translation

#### 37.1.1 get_Protein_from_Translation

External C
  Wise2_get_Protein_from_Translation (ts,ct)
Perl
  &Wise2::Translation::get_Protein_from_Translation (ts,ct)
Perl-OOP call
  $obj->get_Protein_from_Translation(ct)

Arguments

ts
  [UNKN ] translation [Translation *]
ct
  [UNKN ] codon table to use [CodonTable *]
returns
  [SOFT ] Protein sequence [Protein *]

Gets the protein

## 38 cdparser

This module contains the following objects

- 38.2subsection.38.2 cDNAParser
- This module also contains some factory methods

### 38.1 cdparser factory methods

#### 38.1.1 flat_cDNAParser

External C
  Wise2_flat_cDNAParser (p)
Perl
  &Wise2::flat_cDNAParser (p)

Arguments

p
  [READ ] probability of an indel [Probability]
returns
  [UNKN ] Undocumented return value [cDNAParser *]

Makes a flat (ie, indels of 1 or 2 == p) cDNA parser. This means that insertions and deletions of both 1 or 2 bases are all parameterised at the same probability

### 38.2 Object cDNAParser

The cDNAParser object has the following fields. To see how to access them refer to 7.1subsection.7.1

  trans[PCD_PARSER_TRANS_LEN] Type [Probability : Scalar] No documentation

This object holds the (very few) extra transition information needed for the estwise algorithm. It is sort of like the ǵene modelṕart of sequencing error (but very very simple)

Member functions of cDNAParser

## 39 dnaalign

This module contains the following objects

- 39.2subsection.39.2 DnaStartEnd
- This module also contains some factory methods

### 39.1 dnaalign factory methods

#### 39.1.1 make_align_dnaalign

External C
  Wise2_make_align_dnaalign (one,two,mat,se,qgap,qext,tgap,text,dpri)
Perl
  &Wise2::make_align_dnaalign (one,two,mat,se,qgap,qext,tgap,text,dpri)

Arguments

one
  [READ ] first sequence to align [Sequence *]
two
  [READ ] second sequence to align [Sequence *]
mat
  [READ ] DnaMatrix for the matching [DnaMatrix *]
se
  [READ ] DnaStartEnd policy [DnaStartEnd *]
qgap
  [READ ] gap open penalty in query (one) coordinate [int]
qext
  [READ ] gap extension penalty in query (one) coordinate [int]
tgap
  [READ ] gap open penalty in target (two) coordinate [int]
text
  [READ ] gap extension penalty in target (two) coordinate [int]
dpri
  [READ ] DPRunImpl structure [DPRunImpl *]
returns
  [UNKN ] an alb structure of the alignment [AlnBlock *]

Makes an alignment out of two DNA sequences

#### 39.1.2 DnaStartEnd_from_policy

External C
  Wise2_DnaStartEnd_from_policy (policy)
Perl
  &Wise2::DnaStartEnd_from_policy (policy)

Arguments

policy
  [UNKN ] Undocumented argument [char *]
returns
  [UNKN ] Undocumented return value [DnaStartEnd *]

Makes a DnaStartEnd from a particular string. Possible strings are:

local - fully local global - fully global edge - aligns only to edges

### 39.2 Object DnaStartEnd

The DnaStartEnd object has the following fields. To see how to access them refer to 7.1subsection.7.1

  trans[DSE_NUMBER] Type [int : Scalar] start/end points possibilities

No documentation for DnaStartEnd

Member functions of DnaStartEnd

## 40 estwrap

This module only contains factory methods

### 40.1 estwrap factory methods

#### 40.1.1 Hscore_from_TSM_estwise

External C
  Wise2_Hscore_from_TSM_estwise (tdb,cdb,cp,cm,rmd,use_syn,alg,bits_cutoff,allN,flat_insert,report_level,die_on_error,dbsi)
Perl
  &Wise2::Hscore_from_TSM_estwise (tdb,cdb,cp,cm,rmd,use_syn,alg,bits_cutoff,allN,flat_insert,report_level,die_on_error,dbsi)

Arguments

tdb
  [READ ] a three state model database [ThreeStateDB *]
cdb
  [READ ] a dna sequence database [cDNADB *]
cp
  [READ ] the codon parser for this comparison [cDNAParser *]
cm
  [READ ] the codon mapper for this comparison [CodonMapper *]
rmd
  [READ ] random model used for the dna sequence comparison [RandomModelDNA *]
use_syn
  [UNKN ] whether a synchronous coding model should be used or not [boolean]
alg
  [UNKN ] algorithm to use [int]
bits_cutoff
  [UNKN ] Undocumented argument [double]
allN
  [UNKN ] Undocumented argument [Probability]
flat_insert
  [UNKN ] Undocumented argument [boolean]
report_level
  [UNKN ] Undocumented argument [int]
die_on_error
  [UNKN ] if true, dies if there is an error [boolean]
dbsi
  [UNKN ] Undocumented argument [DBSearchImpl *]
returns
  [OWNER] a newly allocated Hscore structure of the search [Hscore *]

Runs a database search for the estwise set of algorithms

#### 40.1.2 AlnBlock_from_Protein_estwise_wrap

External C
  Wise2_AlnBlock_from_Protein_estwise_wrap (pro,cdna,cp,cm,ct,comp,gap,ext,is_global,rmd,alg,rm,use_syn,allN,dpri,palpoi)
Perl
  &Wise2::AlnBlock_from_Protein_estwise_wrap (pro,cdna,cp,cm,ct,comp,gap,ext,is_global,rmd,alg,rm,use_syn,allN,dpri)

Arguments

pro
  [READ ] protein to be used in the comparison [Protein *]
cdna
  [READ ] cdna to be compared to [cDNA *]
cp
  [READ ] cdna parser indicating insertion deletion probabilities [cDNAParser *]
cm
  [READ ] codon mapper indicating substitution errors etc [CodonMapper *]
ct
  [READ ] codon table for the codon->amino acid mappings [CodonTable *]
comp
  [READ ] comparison matrix to use [CompMat *]
gap
  [UNKN ] gap penalty [int]
ext
  [UNKN ] extension penalty [int]
is_global
  [UNKN ] if true, global start-end in protein is used [boolean]
rmd
  [UNKN ] random model of dna to use [RandomModelDNA *]
alg
  [UNKN ] est algorithm type to use [int]
rm
  [UNKN ] random protein model for use with compmat [RandomModel *]
use_syn
  [UNKN ] if true, uses a synchronous coding model [boolean]
allN
  [UNKN ] Undocumented argument [Probability]
dpri
  [UNKN ] Undocumented argument [DPRunImpl *]
palpoi
  only for C api [WRITE] the raw packed alignment output if wanted [PackAln **]
returns
  [UNKN ] Undocumented return value [AlnBlock *]

This function is the guts for the est single alignment mode.

It uses /AlnBlock_from_TSM_estwise_wrap for the heavy part of the call

#### 40.1.3 AlnBlock_from_TSM_estwise_wrap

External C
  Wise2_AlnBlock_from_TSM_estwise_wrap (tsm,cdna,cp,cm,ct,rmd,alg,use_syn,force_flat_insert,allN,dpri,palpoi)
Perl
  &Wise2::AlnBlock_from_TSM_estwise_wrap (tsm,cdna,cp,cm,ct,rmd,alg,use_syn,force_flat_insert,allN,dpri)

Arguments

tsm
  [READ ] threestatemodel to be compared to the dna [ThreeStateModel *]
cdna
  [READ ] cdna to be compared to [cDNA *]
cp
  [READ ] cdna parser indicating insertion deletion probabilities [cDNAParser *]
cm
  [READ ] codon mapper indicating substitution errors etc [CodonMapper *]
ct
  [READ ] codon table for the codon->amino acid mappings [CodonTable *]
rmd
  [UNKN ] random model of dna to use [RandomModelDNA *]
alg
  [UNKN ] est algorithm type to use [int]
use_syn
  [UNKN ] if true, uses a synchronous coding model [boolean]
force_flat_insert
  [UNKN ] Undocumented argument [boolean]
allN
  [UNKN ] Undocumented argument [Probability]
dpri
  [UNKN ] Undocumented argument [DPRunImpl *]
palpoi
  only for C api [WRITE] the raw packed alignment output if wanted [PackAln **]
returns
  [UNKN ] Undocumented return value [AlnBlock *]

This function is the basic wrap for Protein models vs cDNA sequences.

#### 40.1.4 alg_estwrap_from_string

External C
  Wise2_alg_estwrap_from_string (str)
Perl
  &Wise2::alg_estwrap_from_string (str)

Arguments

str
  [UNKN ] Undocumented argument [char *]
returns
  [UNKN ] Undocumented return value [int]

This function returns the algorithm type for an est search from the string

## 41 genedisplay

This module only contains factory methods

### 41.1 genedisplay factory methods

#### 41.1.1 protein2genomic_ascii_display

External C
  Wise2_protein2genomic_ascii_display (alb,p,gen,ct,name,main,ofp)
Perl
  &Wise2::protein2genomic_ascii_display (alb,p,gen,ct,name,main,ofp)

Arguments

alb
  [UNKN ] logical alignment [AlnBlock *]
p
  [UNKN ] protein sequence [Protein *]
gen
  [UNKN ] genomic dna to do the comparison [Genomic *]
ct
  [UNKN ] codon table for translation [CodonTable *]
name
  [UNKN ] length of name block [int]
main
  [UNKN ] length of main block [int]
ofp
  [UNKN ] output file [FILE *]
returns
  [UNKN ] Undocumented return value [boolean]

shows the alignment in alb between protsequence and protname with genomic into ofp with pretty formatting

#### 41.1.2 protcdna_ascii_display

External C
  Wise2_protcdna_ascii_display (alb,protsequence,protname,protoff,cdna,ct,name,main,mult,ofp)
Perl
  &Wise2::protcdna_ascii_display (alb,protsequence,protname,protoff,cdna,ct,name,main,mult,ofp)

Arguments

alb
  [UNKN ] logical alignment [AlnBlock *]
protsequence
  [UNKN ] protein sequence - either real or an artifical consensus [char *]
protname
  [UNKN ] name of the protein [char *]
protoff
  [UNKN ] offset of the alb from the protein [int]
cdna
  [UNKN ] cdna of the match [cDNA *]
ct
  [UNKN ] codon table for translation [CodonTable *]
name
  [UNKN ] length of name block [int]
main
  [UNKN ] length of main block [int]
mult
  [UNKN ] is multi-match [boolean]
ofp
  [UNKN ] output file [FILE *]
returns
  [UNKN ] Undocumented return value [boolean]

shows the alignment in alb between protsequence and protname with cdna into ofp with pretty formatting

## 42 genefrequency

This module contains the following objects

- 42.2subsection.42.2 GeneFrequency21
- 42.3subsection.42.3 GeneConsensus
- 42.4subsection.42.4 GeneSingleCons
- This module also contains some factory methods

### 42.1 genefrequency factory methods

#### 42.1.1 read_GeneFrequency21_file

External C
  Wise2_read_GeneFrequency21_file (filename)
Perl
  &Wise2::read_GeneFrequency21_file (filename)

Arguments

filename
  [UNKN ] will open from WISECONFIGDIR etc via openfile [char *]
returns
  [UNKN ] a newly allocated structure [GeneFrequency21 *]

Opens the file with /openfile

Reads in a GeneFrequency (Mor-Ewan style)

#### 42.1.2 read_GeneFrequency21

External C
  Wise2_read_GeneFrequency21 (ifp)
Perl
  &Wise2::read_GeneFrequency21 (ifp)

Arguments

ifp
  [UNKN ] file pointer [FILE *]
returns
  [UNKN ] a newly allocated structure [GeneFrequency21 *]

Reads in a GeneFrequency (Mor-Ewan style) file from ifp

### 42.2 Object GeneFrequency21

The GeneFrequency21 object has the following fields. To see how to access them refer to 7.1subsection.7.1

  ss5 Type [GeneConsensus * : Scalar] No documentation
  ss3 Type [GeneConsensus * : Scalar] No documentation
  codon[64] Type [double : Scalar] No documentation
  central[4] Type [double : Scalar] No documentation
  py[4] Type [double : Scalar] No documentation
  spacer[4] Type [double : Scalar] No documentation
  transition[GENEFREQUENCY21_TRANSITION_LEN] Type [double : Scalar] No documentation
  cds_triplet[64] Type [double : Scalar] phase 0

No documentation for GeneFrequency21

Member functions of GeneFrequency21

### 42.3 Object GeneConsensus

The GeneConsensus object has the following fields. To see how to access them refer to 7.1subsection.7.1

  center Type [int : Scalar] No documentation
  gsc Type [GeneSingleCons ** : List] No documentation

No documentation for GeneConsensus

Member functions of GeneConsensus

### 42.4 Object GeneSingleCons

The GeneSingleCons object has the following fields. To see how to access them refer to 7.1subsection.7.1

  string Type [char * : Scalar] No documentation
  number Type [double : Scalar] No documentation

No documentation for GeneSingleCons

Member functions of GeneSingleCons

## 43 geneparameter

This module contains the following objects

- 43.1subsection.43.1 GeneParameter21

### 43.1 Object GeneParameter21

The GeneParameter21 object has the following fields. To see how to access them refer to 7.1subsection.7.1

  gp Type [GeneParser21 * : Scalar] No documentation
  cm Type [CodonMapper * : Scalar] No documentation
  cses Type [ComplexSequenceEvalSet * : Scalar] No documentation
  ss Type [SpliceSiteModel ** : List] held only to be freed́ when GeneParser21Set is freed́
  rc Type [RandomCodon * : Scalar] needed to soak up the odd-and-sods of genes
  gwcm Type [GeneWiseCodonModel * : Scalar] No documentation
  ct Type [CodonTable * : Scalar] No documentation
  modelled_splice Type [boolean : Scalar] so we can alter balance scores.
  gms Type [GeneModel * : Scalar] No documentation

GeneParameter21 keeps all the parameters for genewise algorithms in one tidy unit.

This is also the switch between the old (compugen handled) and new statistics. This object can be made from either the old or the new statistics

I have made the object complete opaque to scripting apis because the contents have to be coordinated quite well

Member functions of GeneParameter21

## 44 matchsum

This module contains the following objects

- 44.1subsection.44.1 MatchSummarySet
- 44.2subsection.44.2 MatchSummary

### 44.1 Object MatchSummarySet

The MatchSummarySet object has the following fields. To see how to access them refer to 7.1subsection.7.1

  ms Type [MatchSummary ** : List] No documentation

This holds a set of MatchSummaries,

Member functions of MatchSummarySet

#### 44.1.1 MatchSummarySet_from_AlnBlock_estwise

External C
  Wise2_MatchSummarySet_from_AlnBlock_estwise (alb,qname,offset,target)
Perl
  &Wise2::MatchSummarySet::MatchSummarySet_from_AlnBlock_estwise (alb,qname,offset,target)
Perl-OOP call
  $obj->MatchSummarySet_from_AlnBlock_estwise(qname,offset,target)

Arguments

alb
  [UNKN ] Undocumented argument [AlnBlock *]
qname
  [UNKN ] Undocumented argument [char *]
offset
  [UNKN ] Undocumented argument [int]
target
  [UNKN ] Undocumented argument [Sequence *]
returns
  [UNKN ] Undocumented return value [MatchSummarySet *]

Builds a MatchSummarySet from a EstWise alignment. this makes alot of assumptions about the labels setc in alb, so make sure it was a estwise alignment - however as you can notice this is exactly the same labels as found in genewise set

#### 44.1.2 MatchSummarySet_from_AlnBlock_genewise

External C
  Wise2_MatchSummarySet_from_AlnBlock_genewise (alb,qname,protoff,target)
Perl
  &Wise2::MatchSummarySet::MatchSummarySet_from_AlnBlock_genewise (alb,qname,protoff,target)
Perl-OOP call
  $obj->MatchSummarySet_from_AlnBlock_genewise(qname,protoff,target)

Arguments

alb
  [UNKN ] Undocumented argument [AlnBlock *]
qname
  [UNKN ] Undocumented argument [char *]
protoff
  [UNKN ] Undocumented argument [int]
target
  [UNKN ] Undocumented argument [Sequence *]
returns
  [UNKN ] Undocumented return value [MatchSummarySet *]

Builds a MatchSummarySet from a GeneWise alignment. this makes alot of assumptions about the labels setc in alb, so make sure it was a genewise alignment

### 44.2 Object MatchSummary

The MatchSummary object has the following fields. To see how to access them refer to 7.1subsection.7.1

  bits Type [double : Scalar] No documentation
  qname Type [char * : Scalar] No documentation
  tname Type [char * : Scalar] No documentation
  qstart Type [int : Scalar] No documentation
  qend Type [int : Scalar] No documentation
  tstart Type [int : Scalar] No documentation
  tend Type [int : Scalar] No documentation
  qintron Type [int : Scalar] No documentation
  qframeshift Type [int : Scalar] No documentation
  tintron Type [int : Scalar] No documentation
  tframeshift Type [int : Scalar] No documentation

A Match Summary has summary statistics for a single alignment, with the two start/end ranges and the number of introns and frameshifts for each sequence (obviously, if one is a protein then neither are valid!)

Member functions of MatchSummary

## 45 pfamhmmer1db

This module contains the following objects

- 45.1subsection.45.1 PfamHmmer1DB
- 45.2subsection.45.2 PfamHmmer1Entry

### 45.1 Object PfamHmmer1DB

The PfamHmmer1DB object has the following fields. To see how to access them refer to 7.1subsection.7.1

  en Type [PfamHmmer1Entry ** : List] No documentation
  dirname Type [char * : Scalar] directory name with the models
  cur Type [int : Scalar] No documentation
  def Type [RandomModel * : Scalar] default random model

Pfam Hmmer1db is a wrapper around a Pfam Hmmer database. This is file called HMM.s in a directory which has appropiate .HMM and .random files

Although this DB will be phased out, it is still around for a while.

This wont be used directly, but rather in a threestatedb model. It does not implement a full dynamite style db stream. rather it expects threestatedb to prod it in the correct manner.

Member functions of PfamHmmer1DB

### 45.2 Object PfamHmmer1Entry

The PfamHmmer1Entry object has the following fields. To see how to access them refer to 7.1subsection.7.1

  entryname Type [char * : Scalar] No documentation
  is_random Type [boolean : Scalar] No documentation
  is_hmmls Type [boolean : Scalar] No documentation
  bits_cutoff Type [double : Scalar] No documentation

No documentation for PfamHmmer1Entry

Member functions of PfamHmmer1Entry

## 46 seqaligndisplay

This module only contains factory methods

### 46.1 seqaligndisplay factory methods

#### 46.1.1 write_pretty_str_align

External C
  Wise2_write_pretty_str_align (alb,qname,query,tname,target,name,main,ofp)
Perl
  &Wise2::write_pretty_str_align (alb,qname,query,tname,target,name,main,ofp)

Arguments

alb
  [UNKN ] alignment structure [AlnBlock *]
qname
  [UNKN ] name of first sequence [char *]
query
  [UNKN ] first sequence [char *]
tname
  [UNKN ] name of second sequence [char *]
target
  [UNKN ] second sequence [char *]
name
  [UNKN ] length of the name block [int]
main
  [UNKN ] length of the main block [int]
ofp
  [UNKN ] output file [FILE *]
returns
  [UNKN ] Undocumented return value [boolean]

This gives an interface into the alignment display using strings and files.

#### 46.1.2 write_pretty_seq_align

External C
  Wise2_write_pretty_seq_align (alb,q,t,name,main,ofp)
Perl
  &Wise2::write_pretty_seq_align (alb,q,t,name,main,ofp)

Arguments

alb
  [UNKN ] alignment structure [AlnBlock *]
q
  [UNKN ] first sequence [Sequence *]
t
  [UNKN ] second sequence [Sequence *]
name
  [UNKN ] length of the name block [int]
main
  [UNKN ] length of the main block [int]
ofp
  [UNKN ] output file [FILE *]
returns
  [UNKN ] Undocumented return value [boolean]

This gives an interface into the alignment display using sequences and files. A more generic function is write_pretty_str_align

#### 46.1.3 write_pretty_Protein_align

External C
  Wise2_write_pretty_Protein_align (alb,q,t,name,main,ofp)
Perl
  &Wise2::write_pretty_Protein_align (alb,q,t,name,main,ofp)

Arguments

alb
  [UNKN ] alignment structure [AlnBlock *]
q
  [UNKN ] first sequence [Protein *]
t
  [UNKN ] second sequence [Protein *]
name
  [UNKN ] length of the name block [int]
main
  [UNKN ] length of the main block [int]
ofp
  [UNKN ] output file [FILE *]
returns
  [UNKN ] Undocumented return value [boolean]

This gives an interface into the alignment display using Protein objects

## 47 seqhit

This module contains the following objects

- 47.1subsection.47.1 DnaSequenceHitList
- 47.2subsection.47.2 SegmentHitList
- 47.3subsection.47.3 SegmentHit

### 47.1 Object DnaSequenceHitList

The DnaSequenceHitList object has the following fields. To see how to access them refer to 7.1subsection.7.1

  forward Type [SegmentHitList * : Scalar] No documentation
  backward Type [SegmentHitList * : Scalar] No documentation

No documentation for DnaSequenceHitList

Member functions of DnaSequenceHitList

#### 47.1.1 show_DnaSequenceHitList

External C
  Wise2_show_DnaSequenceHitList (dsl,ofp)
Perl
  &Wise2::DnaSequenceHitList::show_DnaSequenceHitList (dsl,ofp)
Perl-OOP call
  $obj->show_DnaSequenceHitList(ofp)

Arguments

dsl
  [UNKN ] Undocumented argument [DnaSequenceHitList *]
ofp
  [UNKN ] Undocumented argument [FILE *]
returns
  Nothing - no return value

shows a DnaSequenceHitsList -

only really useful for debugging

#### 47.1.2 read_MSPcrunch_DnaSequenceHitList

External C
  Wise2_read_MSPcrunch_DnaSequenceHitList (ifp)
Perl
  &Wise2::DnaSequenceHitList::read_MSPcrunch_DnaSequenceHitList (ifp)
Perl-OOP call
  $obj->read_MSPcrunch_DnaSequenceHitList()

Arguments

ifp
  [UNKN ] input file to read [FILE *]
returns
  [UNKN ] newly allocated structure [DnaSequenceHitList *]

Reads a MSPcrunch -x output file

### 47.2 Object SegmentHitList

The SegmentHitList object has the following fields. To see how to access them refer to 7.1subsection.7.1

  seghit Type [SegmentHit ** : List] No documentation

No documentation for SegmentHitList

Member functions of SegmentHitList

### 47.3 Object SegmentHit

The SegmentHit object has the following fields. To see how to access them refer to 7.1subsection.7.1

  name Type [char * : Scalar] No documentation
  qstart Type [int : Scalar] No documentation
  qend Type [int : Scalar] No documentation
  tstart Type [int : Scalar] No documentation
  tend Type [int : Scalar] No documentation
  score Type [double : Scalar] No documentation
  next_hit Type [SegmentHit * : Scalar] for collecting hits together ;)

No documentation for SegmentHit

Member functions of SegmentHit

## 48 sw_wrap

This module only contains factory methods

### 48.1 sw_wrap factory methods

#### 48.1.1 Align_strings_ProteinSmithWaterman

External C
  Wise2_Align_strings_ProteinSmithWaterman (one,two,comp,gap,ext,dpenv,dpri)
Perl
  &Wise2::Align_strings_ProteinSmithWaterman (one,two,comp,gap,ext,dpenv,dpri)

Arguments

one
  [UNKN ] string of the first sequence [char *]
two
  [UNKN ] string of the second sequence [char *]
comp
  [UNKN ] Comparison Matrix [CompMat *]
gap
  [UNKN ] gap penalty [int]
ext
  [UNKN ] extension penalty [int]
dpenv
  [UNKN ] Undocumented argument [DPEnvelope *]
dpri
  [UNKN ] Undocumented argument [DPRunImpl *]
returns
  [UNKN ] Undocumented return value [AlnBlock *]

This is the most *stupidly* abstracted view of two sequences getting aligned, being two strings.

It would be much better if you used Sequence objects or Protein objects to carry the proteins.

#### 48.1.2 Align_Sequences_ProteinSmithWaterman

External C
  Wise2_Align_Sequences_ProteinSmithWaterman (one,two,comp,gap,ext,dpenv,dpri)
Perl
  &Wise2::Align_Sequences_ProteinSmithWaterman (one,two,comp,gap,ext,dpenv,dpri)

Arguments

one
  [READ ] First sequence to compare [Sequence *]
two
  [READ ] Second sequecne to compare [Sequence *]
comp
  [READ ] Comparison matrix to use [CompMat *]
gap
  [UNKN ] gap penalty. Must be negative or 0 [int]
ext
  [UNKN ] ext penalty. Must be negative or 0 [int]
dpenv
  [UNKN ] Undocumented argument [DPEnvelope *]
dpri
  [UNKN ] Undocumented argument [DPRunImpl *]
returns
  [OWNER] new AlnBlock structure representing the alignment [AlnBlock *]

This function is a mid-level abstraction of comparing two sequences, which could be generic types (eg DNA!). This is tested for and warnings are given but the alignment is still calculated. To prevent this test warning either make sure the Sequence types are set to PROTEIN or, better still, use the high level abstraction Align_Proteins_SmithWaterman

Otherwise this performs a standard smith waterman protein alignment...

To display the alignment use write_pretty_seq_align

#### 48.1.3 Align_Proteins_SmithWaterman

External C
  Wise2_Align_Proteins_SmithWaterman (one,two,comp,gap,ext,dpenv,dpri)
Perl
  &Wise2::Align_Proteins_SmithWaterman (one,two,comp,gap,ext,dpenv,dpri)

Arguments

one
  [UNKN ] Protein to align [Protein *]
two
  [UNKN ] Protein to align [Protein *]
comp
  [UNKN ] Comparison Matrix [CompMat *]
gap
  [UNKN ] gap penalty [int]
ext
  [UNKN ] extension penalty [int]
dpenv
  [UNKN ] Undocumented argument [DPEnvelope *]
dpri
  [UNKN ] Undocumented argument [DPRunImpl *]
returns
  [UNKN ] Undocumented return value [AlnBlock *]

This is the most correct way of aligning two Proteins, using Protein objects, which can be assumed to be proteins with no objections

To display the alignment use write_pretty_Protein_align

#### 48.1.4 Align_Proteins_ABC

External C
  Wise2_Align_Proteins_ABC (one,two,comp,a,b,c,dpenv,dpri)
Perl
  &Wise2::Align_Proteins_ABC (one,two,comp,a,b,c,dpenv,dpri)

Arguments

one
  [UNKN ] protein to align [Protein *]
two
  [UNKN ] protein to align [Protein *]
comp
  [UNKN ] comparison matrix [CompMat *]
a
  [UNKN ] generalized affine gap cost a [int]
b
  [UNKN ] generalized affine gap cost b [int]
c
  [UNKN ] generalized affine gap cost c [int]
dpenv
  [UNKN ] Undocumented argument [DPEnvelope *]
dpri
  [UNKN ] Undocumented argument [DPRunImpl *]
returns
  [UNKN ] Undocumented return value [AlnBlock *]

Analogous to Align_Proteins_SmithWaterman for ABC model

#### 48.1.5 Align_Sequences_ProteinABC

External C
  Wise2_Align_Sequences_ProteinABC (one,two,comp,a,b,c,dpenv,dpri)
Perl
  &Wise2::Align_Sequences_ProteinABC (one,two,comp,a,b,c,dpenv,dpri)

Arguments

one
  [UNKN ] Sequence to align [Sequence *]
two
  [UNKN ] Sequence to align [Sequence *]
comp
  [UNKN ] Comparison Matrix [CompMat *]
a
  [UNKN ] genearlized affine gap cost [int]
b
  [UNKN ] genearlized affine gap cost [int]
c
  [UNKN ] genearlized affine gap cost [int]
dpenv
  [UNKN ] Undocumented argument [DPEnvelope *]
dpri
  [UNKN ] Undocumented argument [DPRunImpl *]
returns
  [UNKN ] Undocumented return value [AlnBlock *]

Align_Sequences_ProteinABC this function is analogous to Align_Sequences_ProteinSmithWaterman but using the abc model

#### 48.1.6 Hscore_from_ProteinSW

External C
  Wise2_Hscore_from_ProteinSW (querydb,targetdb,comp,gap,ext,bits_cutoff,report_level,die_on_error,dbsi)
Perl
  &Wise2::Hscore_from_ProteinSW (querydb,targetdb,comp,gap,ext,bits_cutoff,report_level,die_on_error,dbsi)

Arguments

querydb
  [UNKN ] query database [ProteinDB*]
targetdb
  [UNKN ] target database [ProteinDB*]
comp
  [UNKN ] comparison matrix [CompMat*]
gap
  [UNKN ] gap penalty [int]
ext
  [UNKN ] extension penalty [int]
bits_cutoff
  [UNKN ] [double]
report_level
  [UNKN ] [int]
die_on_error
  [UNKN ] [boolean]
dbsi
  [UNKN ] [DBSearchImpl*]
returns
  [UNKN ] Undocumented return value [Hscore *]

Runs a database psw search

#### 48.1.7 Hscore_from_ProteinABC

External C
  Wise2_Hscore_from_ProteinABC (querydb,targetdb,comp,a,b,c,bits_cutoff,report_level,die_on_error,dbsi)
Perl
  &Wise2::Hscore_from_ProteinABC (querydb,targetdb,comp,a,b,c,bits_cutoff,report_level,die_on_error,dbsi)

Arguments

querydb
  [UNKN ] query database [ProteinDB*]
targetdb
  [UNKN ] target database [ProteinDB*]
comp
  [UNKN ] comparison matrix [CompMat*]
a
  [UNKN ] generalized affine gap cost a [int]
b
  [UNKN ] generalized affine gap cost b [int]
c
  [UNKN ] generalized affine gap cost c [int]
bits_cutoff
  [UNKN ] [double]
report_level
  [UNKN ] [int]
die_on_error
  [UNKN ] [boolean]
dbsi
  [UNKN ] [DBSearchImpl*]
returns
  [UNKN ] Undocumented return value [Hscore *]

Runs a database abc search

#### 48.1.8 Hscore_from_ProteinBA

External C
  Wise2_Hscore_from_ProteinBA (querydb,targetdb,comp,bentry,bexit,bfor_trans,b_self_trans,b3exit,bits_cutoff,report_level,dbsi)
Perl
  &Wise2::Hscore_from_ProteinBA (querydb,targetdb,comp,bentry,bexit,bfor_trans,b_self_trans,b3exit,bits_cutoff,report_level,dbsi)

Arguments

querydb
  [UNKN ] query database [ProteinDB*]
targetdb
  [UNKN ] target database [ProteinDB*]
comp
  [UNKN ] comparison matrix [CompMat*]
bentry
  [UNKN ] [Score]
bexit
  [UNKN ] [Score]
bfor_trans
  [UNKN ] [Score]
b_self_trans
  [UNKN ] [Score]
b3exit
  [UNKN ] [Score]
bits_cutoff
  [UNKN ] [double]
report_level
  [UNKN ] [int]
dbsi
  [UNKN ] [DBSearchImpl*]
returns
  [UNKN ] Undocumented return value [Hscore *]

Runs a database pba search

## 49 threestatedb

This module contains the following objects

- 49.1subsection.49.1 ThreeStateDB

### 49.1 Object ThreeStateDB

The ThreeStateDB object has the following fields. To see how to access them refer to 7.1subsection.7.1

  dbtype Type [int : Scalar] No documentation
  filename Type [char * : Scalar] No documentation
  type Type [int : Scalar] No documentation
  current_file Type [FILE * : Scalar] No documentation
  rm Type [RandomModel * : Scalar] NB, this is hard-linked...
  byte_position Type [long : Scalar] this is the file position for the current model
  single Type [ThreeStateModel * : Scalar] for single db cases
  phdb Type [PfamHmmer1DB * : Scalar] for Pfam Hmmer1 style databases.
  sdb Type [SequenceDB * : Scalar] for protein databases
  comp Type [CompMat * : Scalar] for protein databases
  gap Type [int : Scalar] for protein databases
  ext Type [int : Scalar] for protein databases
  seq_cache Type [Sequence * : Scalar] needed for a bit of inter-function communication
  reload_generic Type [ThreeStateModel * (*reload_generic)(ThreeStateDB * tdb,int * return_status) : Scalar] for generic parsing applications...
  open_generic Type [boolean (*open_generic)(ThreeStateDB * tdb) : Scalar] No documentation
  close_generic Type [boolean (*close_generic)(ThreeStateDB * tdb) : Scalar] No documentation
  dataentry_add Type [boolean (*dataentry_add)(ThreeStateDB * tdb,DataEntry * en) : Scalar] No documentation
  open_index_generic Type [boolean (*open_index_generic)(ThreeStateDB *tdb) : Scalar] No documentation
  index_generic Type [ThreeStateModel * (*index_generic)(ThreeStateDB *tdb,DataEntry *de) : Scalar] No documentation
  close_index_generic Type [boolean (*close_index_generic)(ThreeStateDB *tdb) : Scalar] No documentation
  data Type [void * : Scalar] whatever else the damn system wants to carry around with it!
  hmm_model_start Type [int : Scalar] No documentation
  hmm_model_end Type [int : Scalar] No documentation
  current_no Type [int : Scalar] No documentation

ThreeStateDB is the object that represents a database of profile-HMMs.

The object hold a variety of fields on some of which are occupied depending on the type.

Realistically we need a more abstract class idea, which is implemented here anyway via the generic stuff, in hacky C-style pointers to function plus a void pointer. This object therefore houses a switch system around the different types including the generic system... but as the generic function stuff was bolted on later, some things are handled with explicit datastructures. It is quite messy ;). Apologies. To be cleaned up.

The generic stuff was principly added in to allow a decoupling of this module from the HMMer2.o interface code which is held in wise2xhmmer.dy

The old static datastructure code can be made via protein sequences which are then converted or a Pfam 2.0 style directory + HMMs file.

Member functions of ThreeStateDB

#### 49.1.1 indexed_ThreeStateModel_ThreeStateDB

External C
  Wise2_indexed_ThreeStateModel_ThreeStateDB (mdb,en)
Perl
  &Wise2::ThreeStateDB::indexed_model (mdb,en)
Perl-OOP call
  $obj->indexed_model(en)

Arguments

mdb
  [UNKN ] database where this is indexed [ThreeStateDB *]
en
  [UNKN ] dataentry to pull the model from [DataEntry *]
returns
  [UNKN ] Undocumented return value [ThreeStateModel *]

Retrieves a model from a database which has been opened for indexing by /open_for_indexing_ThreeStateDB

The index information comes from the dataentry which should have been from a search of the ThreeStateDB.

#### 49.1.2 new_proteindb_ThreeStateDB

External C
  Wise2_new_proteindb_ThreeStateDB (sdb,comp,gap,ext)
Perl
  &Wise2::ThreeStateDB::new_proteindb_ThreeStateDB (sdb,comp,gap,ext)
Perl-OOP call
  $obj->new_proteindb_ThreeStateDB(comp,gap,ext)

Arguments

sdb
  [READ ] sequence database to use [SequenceDB *]
comp
  [READ ] comparison matrix to use [CompMat *]
gap
  [READ ] gap open penalty [int]
ext
  [READ ] gap extensions penalty [int]
returns
  [UNKN ] Undocumented return value [ThreeStateDB *]

makes a new ThreeStateDB from a sequencedb (better be protein!)

#### 49.1.3 new_PfamHmmer1DB_ThreeStateDB

External C
  Wise2_new_PfamHmmer1DB_ThreeStateDB (dirname)
Perl
  &Wise2::ThreeStateDB::new_PfamHmmer1DB_ThreeStateDB (dirname)
Perl-OOP call
  $obj->new_PfamHmmer1DB_ThreeStateDB()

Arguments

dirname
  [UNKN ] Undocumented argument [char *]
returns
  [UNKN ] Undocumented return value [ThreeStateDB *]

Makes a new PfamHmmer1DB from a filename indicating the directory

#### 49.1.4 new_single_ThreeStateDB

External C
  Wise2_new_single_ThreeStateDB (tsm,rm)
Perl
  &Wise2::ThreeStateDB::new_single_ThreeStateDB (tsm,rm)
Perl-OOP call
  $obj->new_single_ThreeStateDB(rm)

Arguments

tsm
  [READ ] a single ThreeStateModel [ThreeStateModel *]
rm
  [READ ] random model to be used in comparisons.. [RandomModel *]
returns
  [UNKN ] Undocumented return value [ThreeStateDB *]

Making a new ThreeStateDB from a single model

## 50 threestatemodel

This module contains the following objects

- 50.2subsection.50.2 ThreeStateModel
- 50.3subsection.50.3 ThreeStateUnit
- This module also contains some factory methods

### 50.1 threestatemodel factory methods

#### 50.1.1 read_HMMer_1_7_ascii_file

External C
  Wise2_read_HMMer_1_7_ascii_file (filename)
Perl
  &Wise2::read_HMMer_1_7_ascii_file (filename)

Arguments

filename
  [UNKN ] the name fo the hmmer file [char *]
returns
  [UNKN ] Undocumented return value [ThreeStateModel *]

reads a HMMer ascii version 1.7 (1.8) file from filename.

#### 50.1.2 read_HMMer_1_7_ascii

External C
  Wise2_read_HMMer_1_7_ascii (ifp)
Perl
  &Wise2::read_HMMer_1_7_ascii (ifp)

Arguments

ifp
  [UNKN ] Undocumented argument [FILE *]
returns
  [UNKN ] Undocumented return value [ThreeStateModel *]

Basic function to read HMMer version 1.7(1.8) files.

### 50.2 Object ThreeStateModel

The ThreeStateModel object has the following fields. To see how to access them refer to 7.1subsection.7.1

  name Type [char * : Scalar] name of the model
  unit Type [ThreeStateUnit ** : List] the actuall three state probs and emissions
  alphabet Type [char * : Scalar] alphabet used
  accession Type [char * : Scalar] accession number
  threshold Type [double : Scalar] bits threshold (if sensible)
  rm Type [RandomModel * : Scalar] Random model for the model: maybe NULL!

This is profile-HMM object, similar to the SAM and HMMer plan9 architecture.

Member functions of ThreeStateModel

#### 50.2.1 force_global_model

External C
  Wise2_force_global_model (tsm,prob_into_model)
Perl
  &Wise2::ThreeStateModel::force_global_model (tsm,prob_into_model)
Perl-OOP call
  $obj->force_global_model(prob_into_model)

Arguments

tsm
  [UNKN ] ThreeStateModel to be f́orced[ThreeStateModel *]
prob_into_model
  [UNKN ] Probability to start the model: for true global will be 1.0 [double]
returns
  Nothing - no return value

Makes start at position 0 and end at position end, no other positions being valid

#### 50.2.2 force_weighted_local_model

External C
  Wise2_force_weighted_local_model (tsm,prob_into_model,ratio_start,ratio_end)
Perl
  &Wise2::ThreeStateModel::force_weighted_local_model (tsm,prob_into_model,ratio_start,ratio_end)
Perl-OOP call
  $obj->force_weighted_local_model(prob_into_model,ratio_start,ratio_end)

Arguments

tsm
  [UNKN ] ThreeStateModel to be f́orced[ThreeStateModel *]
prob_into_model
  [UNKN ] Probability to start the model: for true global will be 1.0 [double]
ratio_start
  [UNKN ] ratio of prob to unit 0 to the rest (1.0 means all goes to start) [double]
ratio_end
  [UNKN ] ratio of prob to unit (last) to the rest (1.0 means all goes to the end) [double]
returns
  Nothing - no return value

places the ratio of probability to start/end, and then distributes the rest over the start/end

#### 50.2.3 ThreeStateModel_from_half_bit_Sequence

External C
  Wise2_ThreeStateModel_from_half_bit_Sequence (pro,mat,rm,gap,ext)
Perl
  &Wise2::ThreeStateModel::ThreeStateModel_from_half_bit_Sequence (pro,mat,rm,gap,ext)
Perl-OOP call
  $obj->ThreeStateModel_from_half_bit_Sequence(mat,rm,gap,ext)

Arguments

pro
  [READ ] protein sequence [Protein *]
mat
  [READ ] comparison matrix to use [CompMat *]
rm
  [READ ] random model which you assume the matrix was built with [RandomModel *]
gap
  [READ ] gap open penalty [int]
ext
  [READ ] gap ext penalty [int]
returns
  [UNKN ] Undocumented return value [ThreeStateModel *]

Makes a local three-state-model from a sequence. this is scary hackery, assuming that the matrix is half-bits and normalising in a *very* wrong way to get "probabilities" out.

Works though

#### 50.2.4 write_HMMer_1_7_ascii_ThreeStateModel

External C
  Wise2_write_HMMer_1_7_ascii_ThreeStateModel (tsm,ofp)
Perl
  &Wise2::ThreeStateModel::write_HMMer_1_7_ascii_ThreeStateModel (tsm,ofp)
Perl-OOP call
  $obj->write_HMMer_1_7_ascii_ThreeStateModel(ofp)

Arguments

tsm
  [UNKN ] Undocumented argument [ThreeStateModel *]
ofp
  [UNKN ] Undocumented argument [FILE *]
returns
  Nothing - no return value

writes a HMMer version 1.7 (also ok with 1.8) file

### 50.3 Object ThreeStateUnit

The ThreeStateUnit object has the following fields. To see how to access them refer to 7.1subsection.7.1

  match_emission[ALPHABET_SIZE] Type [Probability : Scalar] No documentation
  insert_emission[ALPHABET_SIZE] Type [Probability : Scalar] No documentation
  transition[TRANSITION_LEN] Type [Probability : Scalar] No documentation
  display_char Type [char : Scalar] No documentation

This object is the probability version of hte common unit to profile HMMs, ie the match,insert,delete triple

Member functions of ThreeStateUnit

> This document was translated from LATEX by H E V E A.