hhr

package
v0.0.0-...-22b94e9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2014 License: MIT Imports: 9 Imported by: 4

Documentation

Overview

Package hhr provides routines for reading (but not writing) hhr files, which are the output produced by hhsuite's hhsearch and hhblits programs.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alignment

type Alignment struct {
	QSeq, QConsensus, QDssp, QPred, QConf []seq.Residue
	TSeq, TConsensus, TDssp, TPred, TConf []seq.Residue
}

type HHR

type HHR struct {
	Query        string
	MatchColumns int
	NumSeqs      string
	Neff         seq.Prob
	SearchedHMMs int
	Date         string
	Command      string
	Hits         []Hit
}

func Read

func Read(r io.Reader) (*HHR, error)
Example
package main

import (
	"flag"
	"fmt"
	"log"
	"os"
)

var (
	flagReadFile = ""
)

func init() {
	flag.StringVar(&flagReadFile, "hhr", flagReadFile,
		"The HHR file to use for tests.")
	flag.Parse()

	log.SetFlags(0)
}

func main() {
	r := getFile()

	hhr, err := Read(r)
	if err != nil {
		log.Fatalf("%s", err)
	}

	hit := hhr.Hits[9]
	fmt.Println(hit.Num)
	fmt.Println(hit.Name)
	fmt.Printf("%0.3f\n", hit.Prob)
	fmt.Println(hit.EValue)
	fmt.Println(hit.PValue)
	fmt.Println(hit.ViterbiScore)
	fmt.Println(hit.SSScore)
	fmt.Println(hit.NumAlignedCols)
	fmt.Println(hit.QueryStart)
	fmt.Println(hit.QueryEnd)
	fmt.Println(hit.TemplateStart)
	fmt.Println(hit.TemplateEnd)
	fmt.Println(hit.NumTemplateCols)
	fmt.Printf("%s\n", hit.Aligned.QSeq)
	fmt.Printf("%s\n", hit.Aligned.TSeq)
}

func getFile() *os.File {
	if len(flagReadFile) == 0 {
		log.Fatalf("Please set the '--hhr path/to/file.hhr' flag.")
	}

	r, err := os.Open(flagReadFile)
	if err != nil {
		log.Fatalf("%s", err)
	}
	return r
}
Output:

10
2fxaD
0.571
0.24
0.00011
34.3
0
47
106
154
46
94
207
IGNSAFELLLEVAKSGEKGINTMDLAQVTGQDPRSVTGRIKKINH--LLTS
LNINEHHILWIAY--QLNGASISEIAKFGVMHVSTAFNFSKKLEERGYLRF

type Hit

type Hit struct {
	Num             int
	Chunk           int
	Name            string
	Prob            float64
	EValue          float64
	PValue          float64
	ViterbiScore    float64
	SSScore         float64
	NumAlignedCols  int
	QueryStart      int
	QueryEnd        int
	TemplateStart   int
	TemplateEnd     int
	NumTemplateCols int
	Aligned         Alignment
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL