Package hhsuite

import "github.com/TuftsBCB/apps/hhsuite"
Overview
Index

Overview ▾

Package hhsuite provides convenient wrappers for running programs found in hhsuite like hhsearch, hhblits and hhmake.

The $HHLIB environment variable is used to determine the location of databases. i.e., a database named "nr20" will resolve to $HHLIB/data/nr20 and a database named "fragpred/pdb-select-25" will resolve to $HHLIB/data/fragpred/pdb-select-25. If this behavior is not desired, change the global variable DatabasePath to wherever databases are stored. (An empty database path will leave database named untouched.)

Note that full wrappers for each program are not provided. Options can be added on an as-needed basis.

Variables

var DatabasePath = path.Join(os.Getenv("HHLIB"), "data")

The default database path. This will be used to resolve the full paths of databases. $HHLIB is usually set in an hhsuite environment.

If you'd like to use a different database path (or none at all), then simply change this value to reflect that.

var HHBlitsDefault = HHBlitsConfig{
    Exec:       "hhblits",
    CPUs:       runtime.NumCPU(),
    Iterations: 2,
    MAct:       0.35,
    OutA3M:     "",
    Verbose:    false,
}
var HHMakePseudo = HHMakeConfig{
    Exec: "hhmake",
    PCM:  4,
    PCA:  2.5,
    PCB:  0.5,
    PCC:  1.0,
    GapB: 1.0,
    GapD: 0.15,
    GapE: 1.0,
    GapF: 0.6,
    GapG: 0.6,
    GapI: 0.6,
}
var HHSearchDefault = HHSearchConfig{
    Exec:    "hhsearch",
    CPUs:    runtime.NumCPU(),
    Verbose: false,
}

func BuildHHM

func BuildHHM(hhblits HHBlitsConfig, hhmake HHMakeConfig,
    db Database, query string) (*hmm.HHM, error)

BuildHHM is a convenience function for building an HHM file (with pseudo count correction for emission/gaps) from a single sequence FASTA file. Namely, hhblits and hhmake are the configurations for each program. db is the database to use to generate an MSA (usually 'nr20' or 'uniprot20'), and query is a file path pointing to a single sequence FASTA file.

N.B. The hhblits configuration is modified to include a temporary A3M file, which is the output of hhblits and the input to hhmake. Thus, BuildHHM will panic if the hhblits configuration contains a non-empty A3M output file name.

type Database

type Database string

A Database is an hhsuite database. A value of type Database should simply be the name of the database. i.e., for the $HHBLIB/data/nr20 database, just use 'nr20'.

So to use the 'nr20' database, just use 'Database("nr20")'.

If the database ends in '.hhm', then it is assumed to be an hhsearch database. Therefore, it cannot work with hhblits (an error will be thrown if you try). Otherwise, the database is assumed to be an hhsuite database that can be used with hhblits OR hhsearch.

Finally, if the database is an absolute path (i.e., starts with '/'), then the database name will be used unaltered.

func (Database) Resolve

func (db Database) Resolve() string

Resolve will expand a Database value to its full path using DatabasePath.

func (Database) ResolveHHSearch

func (db Database) ResolveHHSearch() string

ResolveHHSearch will exapnd a Database value to its full path using DatabasePath, but specially for HHsearch databases. Namely, if it's old style, then no modification is made after normal resolving. If it's new style, though, then "_hhm_db" is appended to the end of the resolved name.

type HHBlitsConfig

type HHBlitsConfig struct {
    Exec       string
    CPUs       int
    Iterations int
    MAct       float64
    OutA3M     string

    // When true, the 'hhblits' stdout and stderr will be mapped to the
    // current processes' stdout and stderr.
    Verbose bool
}

func (HHBlitsConfig) Run

func (conf HHBlitsConfig) Run(db Database, query string) (*hhr.HHR, error)

Run will execute HHblits using the given configuration, database and query file path. The query can be a path to a fasta file, A3M file or HHM file. (As per the '-i' flag for hhblits.)

type HHMakeConfig

type HHMakeConfig struct {
    Exec string
    PCM  int
    PCA  float64
    PCB  float64
    PCC  float64
    GapB float64
    GapD float64
    GapE float64
    GapF float64
    GapG float64
    GapI float64

    // When true, the 'hhmake' stdout and stderr will be mapped to the
    // current processes' stdout and stderr.
    Verbose bool
}

func (HHMakeConfig) Run

func (conf HHMakeConfig) Run(query string) (*hmm.HHM, error)

Run will execute HHmake using the given configuration and query file path. The query should be a file path pointing to an MSA file (fasta, a2m or a3m) or an hhm file. It should NOT be just a single sequence.

If you need to build an HHM from a single sequence, use the convenience function BuildHHM.

type HHSearchConfig

type HHSearchConfig struct {
    Exec string
    CPUs int

    // When true, the 'hhsearch' stdout and stderr will be mapped to the
    // current processes' stdout and stderr.
    Verbose bool
}

func (HHSearchConfig) Run

func (conf HHSearchConfig) Run(db Database, query string) (*hhr.HHR, error)

Run will execute HHsearch using the given configuration, database and query file path. The query can be a path to a fasta file, A3M file or HHM file. (As per the '-i' flag for hhsearch.)