Documentation ¶
Index ¶
- func GetMD5Hash(text string) string
- func ParseConfig(buffer *bytes.Buffer) map[string]string
- type ChadoHelper
- func (helper *ChadoHelper) CreateCvtermId(params map[string]string) (int, error)
- func (helper *ChadoHelper) FindCvtermId(cv, cvt string) (int, error)
- func (helper *ChadoHelper) FindOrCreateCvId(cv string) (int, error)
- func (helper *ChadoHelper) FindOrCreateDbId(db string) (int, error)
- func (helper *ChadoHelper) NormaLizeId(dbxref string) (int, string, error)
- type ChadoLoader
- type Cv
- type Cvterm
- type DataBucket
- type DataCache
- type Database
- type Db
- type Dbxref
- type Feature
- type FeatureCvterm
- type FeatureDbxref
- type GpadFixtureLoader
- type Organism
- type Pub
- type SqlParser
- type StagingLoader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChadoHelper ¶
type ChadoHelper struct { *Database // contains filtered or unexported fields }
Helper for finding and creating cv, cvterm , db and dbxrefs in chado database.
func (*ChadoHelper) CreateCvtermId ¶
func (helper *ChadoHelper) CreateCvtermId(params map[string]string) (int, error)
Creates a cvterm record from cvterm, cv, dbxref and db parameters and return a primary key of cvterm table(cvterm_id). The parameters are passed through a map structure with the following keys
cv : manadatory cvterm: manadatory dbxref: mandatory. If dbxref has Db:Id structure the Db and Id are split before storing db: optional. By default internal is used.
func (*ChadoHelper) FindCvtermId ¶
func (helper *ChadoHelper) FindCvtermId(cv, cvt string) (int, error)
func (*ChadoHelper) FindOrCreateCvId ¶
func (helper *ChadoHelper) FindOrCreateCvId(cv string) (int, error)
Given a cv namespace returns its primary key identifier. The lookup is done on the cache first and if absent retrieved from cv table.
func (*ChadoHelper) FindOrCreateDbId ¶
func (helper *ChadoHelper) FindOrCreateDbId(db string) (int, error)
Given a db name returns its primary key identifier. The lookup is done on the cache first and if absent retrieved from db table.
func (*ChadoHelper) NormaLizeId ¶
func (helper *ChadoHelper) NormaLizeId(dbxref string) (int, string, error)
Given a dbxref returns its db_id and accession. Accepts both Db:Dbxref and Dbxref form. Create the Db entry if absent in the database. In case of without specific Db, *internal* is used
type ChadoLoader ¶
type ChadoLoader interface { // To prepare involved chado tables for bulk load, such as // disabling indexes and/or foreign keys if needed AlterTables() // Primarilly to complement the AlterTables method, put back the chaged tables // in its pristine states. Could also be used to re-calcualate statistics // on tables that has inserts after bulk load. ResetTables() // Actual data loading by running a series of sql statements that transfers // data from staging tables. BulkLoad() }
Interface for making a chado loader from staging tables
type DataBucket ¶
type DataBucket struct {
// contains filtered or unexported fields
}
A simple way to hold bucket of data primarilly for inserting in batch to a relational backend. It is a simple slice of maps container where each will have values keyed by a column name. Ultimately, each of this map will be transformed into a row in the database.
func NewDataBucket ¶
func NewDataBucket() *DataBucket
func (*DataBucket) Clear ¶
func (b *DataBucket) Clear()
func (*DataBucket) Count ¶
func (b *DataBucket) Count() int
func (*DataBucket) Elements ¶
func (b *DataBucket) Elements() []map[string]interface{}
func (*DataBucket) GetByPosition ¶
func (b *DataBucket) GetByPosition(pos int) map[string]interface{}
func (*DataBucket) Push ¶
func (b *DataBucket) Push(m map[string]interface{})
type DataCache ¶
A simple thread safe cache for holding key(string) value(int). This is a typical use case for working with chado database where db,dbxref, cv and cvterm entries are shared as foreign keys between most of the tables. Caching those foreign keys with a unique name reduces redundant database lookups.
func (*DataCache) Get ¶
Retrieve an entry from the cache. However, it is advisable to run *Has* method before retrieving the entry.
type Database ¶
Type to hold an active chado database handler. It is expected to be embedded in other type structure that requires an active chado connection.
type Feature ¶
type Feature struct { FeatureId int64 `primary_key:"feature_id"` Name string Uniquename string Residues string Seqlen int64 Md5checksum string IsAnalysis bool IsObsolete bool Timeaccessioned time.Time Timelastmodified time.Time //foreign keys OrganismId int64 Organism Organism DbxrefId int64 Dbxref Dbxref TypeId int64 Type Cvterm //has_many relations FeatureCvterms []FeatureCvterm FeatureDbxrefs []FeatureDbxref }
type FeatureCvterm ¶
type FeatureDbxref ¶
type GpadFixtureLoader ¶
type GpadFixtureLoader struct {
// contains filtered or unexported fields
}
func NewGpadFixtureLoader ¶
func NewGpadFixtureLoader(tc testchado.DBManager) *GpadFixtureLoader
func (*GpadFixtureLoader) LoadGenes ¶
func (f *GpadFixtureLoader) LoadGenes(genes []string) []Feature
func (*GpadFixtureLoader) LoadGoIds ¶
func (f *GpadFixtureLoader) LoadGoIds(ids map[string][]string) []Cvterm
func (*GpadFixtureLoader) LoadMiscCvterms ¶
func (f *GpadFixtureLoader) LoadMiscCvterms(cv string) []Cvterm
func (*GpadFixtureLoader) LoadPubIds ¶
func (f *GpadFixtureLoader) LoadPubIds(ids []string) []Pub
type SqlParser ¶
type SqlParser struct {
// contains filtered or unexported fields
}
Parsing sql statements from ini style config file. Each ini section expects to have a sql statement
In caboose.ini file ¶
[create_bag] CREATE TABLE bag (
id INTEGER PRIMARY KEY NOT NULL, name TEXT
);
[select_bag] SELECT id FROM bag WHERE name = ?
[insert_bag] INSERT INTO bag(name) VALUES(?)
.......
parser := NewSqlParserFromFile("caboose.ini") for _, section := range parser.Sections() { fmt.Printf("section:%s\nvalue:%s\n\n",section,parser.GetSection(section)) }
func NewSqlParserFromFile ¶
Parse ini sql content from a file and returns a new instance
func NewSqlParserFromString ¶
Parse ini sql content from a string and returns a new instance
func (*SqlParser) GetSection ¶
Value of a particular section
type StagingLoader ¶
type StagingLoader interface { // Add a row of unprocessed data to the staging cache AddDataRow(string) // Create temporary staging tables CreateTables() // Drop the staging tables DropTables() // Alteration in the staging tables, for example creating indexes AlterTables() // Bulk upload data from staging cache to the staging tables BulkLoad() }
Interface for making a loader for staging tables