util

package
v0.0.0-...-569c3a6 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2014 License: MIT Imports: 23 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FlagCpu     = runtime.NumCPU()
	FlagCpuProf = ""

	FlagPdbDir = path.Join("/", "data", "bio", "pdb")

	FlagSeqDB hhsuite.Database

	FlagPdbHhmDB hhfrag.PDBDatabase

	HHfragConf = hhfrag.DefaultConfig

	FlagQuiet = false
)

Functions

func AllFilesFromArgs

func AllFilesFromArgs(fileArgs []string) []string

func Arg

func Arg(i int) string

Arg just calls `flag.Arg`. It's included here to avoid an extra import to `flag` just to call Arg.

func Args

func Args() []string

Args just calls `flag.Args`.

func Assert

func Assert(err error, v ...interface{})

func AssertIsDir

func AssertIsDir(path string)

func AssertLeastNArg

func AssertLeastNArg(n int)

func AssertNArg

func AssertNArg(n int)

func AssertOverwritable

func AssertOverwritable(path string, overwritable bool)

func BowRead

func BowRead(path string) bow.Bowed

func BowWrite

func BowWrite(w io.Writer, b bow.Bowed)

func BowerOpen

func BowerOpen(fpath string, lib fragbag.Library, models bool) <-chan BowerErr

BowerOpen reads the contents of `fpath` and attempts to interpret it as a value (or values) that implement the `bow.Bower` interface. The list of `bow.Bower` values returned is guaranteed to be homogenous: they will either be all `bow.SequenceBower` values or `bow.StructureBower` values.

The actual return value of the function is a receive-only channel of BowerErr values. Each BowerErr value either has the `Bower` member set or has the `err` field set to an error that prevented the file from being opened. Errors in this case are reserved for files that appear to be capable of producing a BOW, but were unable to be read.

If the fpath given cannot be detected as a bower file, then a closed empty channel will be returned. A warning is also emitted to stderr.

`lib` is a fragment library that is used to help interpret what kind of value must be in `r`. For example, if `lib` is a sequence fragment library, then `BowerOpen` is guaranteed to return a `Bower` value that implements the `bow.SequenceBower` interface.

As of now, `BowerOpen` can read these types of files:

File extension                 Format    Interpretation
*.{ent.gz,pdb,ent}             PDB       whatever `lib` is
*.{fasta,fas,fasta.gz,fas.gz}  FASTA     sequence
everything else                error     invalid

Note that special syntax for PDB file names is supported. Namely, chain identifiers can be appended to the end of the file name, and only that chain will be included in the `bow.Bower` value. Otherwise, all chains in the PDB entry will be returned as individual `bow.Bower` values.

The format is simple and easily demonstrated by examples:

1ctf.end.gz       Chains A and B
1ctf.ent.gz:A     Only chain A
1ctf.ent.gz:B     Only chain B
1ctf.ent.gz:A,B   Chains A and B

A secondary format is also accepted. The following are equivalent to their corresponding examples above:

1ctf
1ctfA
1ctfB
1ctf:A,B

Finally, `fpath` may be the name of a PDB identifier and its file path will be inferred from the value of the `PDB_PATH` environment variable. Alternatively, `fpath` may be the name of a SCOP domain, and its corresponding PDB file will be inferred from the value of the `SCOP_PDB_PATH` environment variable.

func CathPath

func CathPath(pid string) string

CathPath takes a CATH identifier (e.g., "2h5xB03") and returns the full path to the PDB file on the file system.

The CATH_PDB_PATH environment variable must be set.

func CopyFile

func CopyFile(src, dest string)

func CreateFile

func CreateFile(path string) *os.File

func Exists

func Exists(path string) bool

func Fatalf

func Fatalf(format string, v ...interface{})

func FlagParse

func FlagParse(positional string, desc string)

func FlagUse

func FlagUse(names ...string)

func FmapRead

func FmapRead(path string) *hhfrag.FragmentMap

func FmapWrite

func FmapWrite(w io.Writer, fmap *hhfrag.FragmentMap)

func GetFmap

func GetFmap(fpath string) *hhfrag.FragmentMap

func IsChainID

func IsChainID(s string) bool

func IsDir

func IsDir(path string) bool

func IsFasta

func IsFasta(fpath string) bool

func IsFmap

func IsFmap(fpath string) bool

func IsPDB

func IsPDB(fpath string) bool

func IsPDBID

func IsPDBID(s string) bool

func Library

func Library(fpath string) fragbag.Library

func MSA

func MSA(path string) seq.MSA

func NArg

func NArg() int

NArg just calls `flag.NArg`. It's included here to avoid an extra import to `flag` just to call NArg.

func OpenBowDB

func OpenBowDB(path string) *bowdb.DB

func OpenFasta

func OpenFasta(fpath string) io.Reader

func OpenFile

func OpenFile(path string) *os.File

func PDBOpen

func PDBOpen(fpath string) (*pdb.Entry, []*pdb.Chain, error)

func PDBOpenMust

func PDBOpenMust(fpath string) (*pdb.Entry, []*pdb.Chain)

func PDBPath

func PDBPath(pid string) string

PDBPath takes a PDB identifier (e.g., "1ctf" or "1ctfA") and returns the full path to the PDB file on the file system.

The PDB_PATH environment variable must be set.

func PDBRead

func PDBRead(path string) *pdb.Entry

func PDBReadId

func PDBReadId(pid string) (*pdb.Entry, *pdb.Chain)

func ParseInt

func ParseInt(str string) int

func ProcessBowers

func ProcessBowers(
	fpaths []string,
	lib fragbag.Library,
	models bool,
	n int,
	hideProgress bool,
) <-chan bow.Bowed

ProcessBowers is a convenient wrapper around BowerOpen that processes each bower value in parallel and sends the resulting BOW value on the channel returned. The number of goroutines spawned is equivalent to N.

It is appropriate for fpaths to be the arguments given to be command line arguments. Each directory is recursively expanded to its files, and special syntax is parsed as well.

If `hideProgress` is true, then a progress bar will not be emitted to stderr.

If `models` is true, then every model in a PDB bower file will have its BOW computed. Otherwise, the first model from each chain will be used.

func ReadLines

func ReadLines(r io.Reader) []string

func RecursiveFiles

func RecursiveFiles(dir string) []string

func ScopPath

func ScopPath(pid string) string

ScopPath takes a SCOP identifier (e.g., "d3ciua1" or "d1g09c_") and returns the full path to the PDB file on the file system.

The SCOP_PDB_PATH environment variable must be set.

func SequenceLibrary

func SequenceLibrary(path string) fragbag.SequenceLibrary

func StructureLibrary

func StructureLibrary(path string) fragbag.StructureLibrary

func Usage

func Usage()

Usage just calls `flag.Usage`. It's included here to avoid an extra import to `flag` just to call Usage.

func Verbosef

func Verbosef(format string, v ...interface{})

func Warnf

func Warnf(format string, v ...interface{})

func Warning

func Warning(err error, v ...interface{}) bool

Types

type BowerErr

type BowerErr struct {
	Bower interface{}
	Err   error
}

BowerErr corresponds to a value that is either a Bower or an error indicating why a Bower value could not be constructed.

type Progress

type Progress struct {
	// contains filtered or unexported fields
}

func NewProgress

func NewProgress(total int) *Progress

func (*Progress) Close

func (p *Progress) Close()

func (*Progress) JobDone

func (p *Progress) JobDone(err error)

Jump to

Keyboard shortcuts

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