config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2022 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package config is for app wide settings

Index

Constants

This section is empty.

Variables

View Source
var (

	// Primer3Config is the path to a primer3 config directory
	// primer3 is (overly) particular about the trailing slash
	Primer3Config = filepath.Join(reppDir, "primer3_config") + string(os.PathSeparator)

	// FeatureDB is the path to the features file
	FeatureDB = filepath.Join(reppDir, "features.json")

	// EnzymeDB is the path to the enzymes file
	EnzymeDB = filepath.Join(reppDir, "enzymes.json")

	// SeqDatabaseDir is the path to a directory of sequence databases.
	SeqDatabaseDir = filepath.Join(reppDir, "dbs")

	// SeqDatabaseManifest is the path to the manifest file for the sequence databases.
	SeqDatabaseManifest = filepath.Join(SeqDatabaseDir, "manifest.json")
)
View Source
var (
	// DefaultConfig is the initiate client config that's embedded with repp
	// and installed on the first run
	//go:embed config.yaml
	DefaultConfig []byte

	// DefaultEnzymes is the JSON file of default enzymes embedded with repp
	//go:embed enzymes.json
	DefaultEnzymes []byte

	// DefaultFeatures is the JSON file of default features embedded with repp
	//go:embed features.json
	DefaultFeatures []byte

	// DefaultPrimer3Config is the FS of Primer3, needed to run primer3_core, etc
	//go:embed primer3_config primer3_config/interpretations
	DefaultPrimer3Config embed.FS
)

Functions

func Setup

func Setup()

Setup checks that the REPP data directory exists. It creates one and writes default config files to it otherwise.

Types

type Config

type Config struct {
	// the config file's version
	Version string `mapstructure:"version"`

	// the cost of each Gibson Assembly
	GibsonAssemblyCost float64 `mapstructure:"gibson-assembly-cost"`

	// the cost of time for each Gibson Assembly
	GibsonAssemblyTimeCost float64 `mapstructure:"gibson-assembly-time-cost"`

	// the cost per bp of synthesized DNA as a fragment (as a step function)
	SyntheticFragmentCost map[int]SynthCost `mapstructure:"synthetic-fragment-cost"`

	// the cost per bp of synthesized clonal DNA  (delivered in a plasmid)
	SyntheticPlasmidCost map[int]SynthCost `mapstructure:"synthetic-plasmid-cost"`

	// the maximum number of fragments in the final assembly
	FragmentsMaxCount int `mapstructure:"fragments-max-count"`

	// the minimum homology between this fragment and the net one
	FragmentsMinHomology int `mapstructure:"fragments-min-junction-length"`

	// maximum length of homology between two adjacent fragments in bp
	FragmentsMaxHomology int `mapstructure:"fragments-max-junction-length"`

	// maximum allowable hairpin melting temperature (celcius)
	FragmentsMaxHairpinMelt float64 `mapstructure:"fragments-max-junction-hairpin"`

	// the cost per bp of primer DNA
	PcrBpCost float64 `mapstructure:"pcr-bp-cost"`

	// the cost of each PCR reaction
	PcrRxnCost float64 `mapstructure:"pcr-rxn-cost"`

	// the cost of time for each PCR reaction
	PcrTimeCost float64 `mapstructure:"pcr-time-cost"`

	// PcrMinLength is the minimum size of a fragment (used to filter BLAST results)
	PcrMinLength int `mapstructure:"pcr-min-length"`

	// the maximum primer3 score allowable
	PcrPrimerMaxPairPenalty float64 `mapstructure:"pcr-primer-max-pair-penalty"`

	// the maximum length of a sequence to embed up or downstream of an amplified sequence
	PcrPrimerMaxEmbedLength int `mapstructure:"pcr-primer-max-embed-length"`

	// PcrPrimerMaxOfftargetTm is the maximum tm of an offtarget, above which PCR is abandoned
	PcrPrimerMaxOfftargetTm float64 `mapstructure:"pcr-primer-max-ectopic-tm"`

	// PcrBufferLength is the length of buffer from the ends of a match in which
	// to allow Primer3 to look for a primer
	PcrBufferLength int `mapstructure:"pcr-buffer-length"`

	// minimum length of a synthesized piece of DNA
	SyntheticMinLength int `mapstructure:"synthetic-min-length"`

	// maximum length of a synthesized piece of DNA
	SyntheticMaxLength int `mapstructure:"synthetic-max-length"`
}

Config is the Root-level settings struct and is a mix of settings available in config.yaml and those available from the command line

func New

func New() *Config

New returns a new Config struct populated by settings from config.yaml, in the repo, or some other settings file the user points to with the "--config" command

TODO: check for and error out on nonsense config values TODO: add back the config file path setting

func (*Config) SynthFragmentCost

func (c *Config) SynthFragmentCost(fragLength int) float64

SynthFragmentCost returns the cost of synthesizing a linear stretch of DNA

func (*Config) SynthPlasmidCost

func (c *Config) SynthPlasmidCost(insertLength int) float64

SynthPlasmidCost returns the cost of synthesizing the insert and having it delivered in a plasmid

type SynthCost

type SynthCost struct {
	// whether it's a fixed or variable cost
	Fixed bool `mapstructure:"fixed"`

	// the cost (either per bp or for the whole stretch)
	Cost float64 `mapstructure:"cost"`
}

SynthCost contains data of the cost of synthesizing DNA up to a certain size. Can be fixed (ie everything beneath that limit is the same amount) or not (pay by the bp)

Jump to

Keyboard shortcuts

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