Package hhfrag

import ""

Overview ▾

This package provides a Go implementation of Kalev and Habeck's HHfrag algorithm from their 2011 paper in Bioinformatics. Notably, this implementation uses hhsuite 2.0 with either hhsearch or hhblits from Johann Soeding in lieu of the older hhsuite 1.5/1.6 version (which requires PSI-BLAST).

Note that this package will likely not be maintained, but it is provided for anyone who would like to pursue using FragBag fragment libraries with HHfrag. (In particular, the FragmentMap type implements the fragbag/bow.StructureBower interface by computing BOWs on each segment and returning their sum as a single BOW.)

The PDB database used in this package is not the regular PDB normally seen. In particular, it corresponds to a database that contains both an HHblitz and a set of PDB structures corresponding to entries in the HHblitz database. This database can be created with the "build-pdb-hhm-db" shell script included in this repository (although it has not been maintained). The shell script requires the pdb2fasta tool (use "go get") along with a properly configured HHsuite environment (see Johann Soeding's handbook).

It is worth reading Kalev and Habeck's paper for additional insight in how this package works. (In lieu of better documentation that simply does not exist.)


var DefaultConfig = MapConfig{
    WindowMin:       30,
    WindowMax:       35,
    WindowIncrement: 5,
    Blits:           true,

type Fragment

type Fragment struct {
    Query    seq.Sequence
    Template seq.Sequence
    Hit      hhr.Hit
    CaAtoms  []structure.Coords

An HHfrag Fragment corresponds to a match between a portion of a query HMM and a portion of a template HMM. The former is represented as a slice of a regular sequence, where the latter is represented as an hhsuite hit and a list of alpha-carbon atoms corresponding to the matched region.

func NewFragment

func NewFragment(
    pdbDb PDBDatabase, qs seq.Sequence, hit hhr.Hit) (Fragment, error)

NewFragment constructs a new fragment from a full query sequence and the hit from the HHR file.

Since NewFragment requires access to the raw PDB alpha-carbon atoms (and the sequence) of the template hit, you'll also need to pass a path to the PDB database. (Which is a directory containing a flat list of all PDB files used to construct the corresponding hhblits database.) This database is usually located inside the 'pdb' directory contained in the corresponding hhsuite database. i.e., $HHLIB/data/pdb-select25/pdb

func (Fragment) IsCorrupt

func (frag Fragment) IsCorrupt() bool

IsCorrupt returns true when a particular fragment could not be paired with alpha-carbon positions for every residue in the template strand. (This problem stems from the fact that we use SEQRES records for sequence information, but not all residues in SEQRES have alpha-carbon ATOM records associated with them.)

type FragmentMap

type FragmentMap struct {
    Name     string
    Segments []Fragments

func (*FragmentMap) Len

func (fmap *FragmentMap) Len() int

func (*FragmentMap) Less

func (fmap *FragmentMap) Less(i, j int) bool

func (*FragmentMap) StructureBow

func (fmap *FragmentMap) StructureBow(lib fragbag.StructureLibrary) bow.Bowed

func (*FragmentMap) Swap

func (fmap *FragmentMap) Swap(i, j int)

type Fragments

type Fragments struct {
    Frags      []Fragment
    Start, End int

func FindFragments

func FindFragments(pdbDb PDBDatabase, blits bool,
    queryHHM *hmm.HHM, qs seq.Sequence, start, end int) (*Fragments, error)

func (Fragments) Write

func (frags Fragments) Write(w io.Writer)

type MapConfig

type MapConfig struct {
    WindowMin       int
    WindowMax       int
    WindowIncrement int
    Blits           bool

func (MapConfig) MapFromFasta

func (m MapConfig) MapFromFasta(pdbDb PDBDatabase, seqDb hhsuite.Database,
    queryFasta string) (*FragmentMap, error)

func (MapConfig) MapFromHHM

func (m MapConfig) MapFromHHM(pdbDb PDBDatabase, seqDb hhsuite.Database,
    queryFasta string, queryHHM string) (*FragmentMap, error)

type PDBDatabase

type PDBDatabase hhsuite.Database

func (PDBDatabase) HHsuite

func (db PDBDatabase) HHsuite() hhsuite.Database

func (PDBDatabase) PDB

func (db PDBDatabase) PDB() string