db

package
v0.8.29 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func ConnectDB

func ConnectDB()

ConnectDB handles the connection and migrations depending on the configured database engine.

func ConnectPostgres

func ConnectPostgres()

TODO: DELETE THIS feature<<<<<, change to MySQL for compatibility with already written manual queries

func ConnectSQLite

func ConnectSQLite()

ConnectSQLite manages the creation and connection to a local SQLite file. Includes extra PRAGMA statements and settings for improved write performance.

func StoreExons

func StoreExons(geneID uint, exons []ensembl.Exon)

StoreExons stores in the database a record for a gene exon

func StoreFile

func StoreFile(file string, hash string, kitID uint, size int64) (bamFileID uint, created bool)

StoreFile stores in the database an associated record to an original BAM file source

func StoreGene

func StoreGene(hgncAccession string, geneAccession string, name string, description string, transcriptAccession string) (geneID uint, created bool)

StoreGene stores in the database a record for a gene

func StoreKit

func StoreKit(name string) (kitID uint, created bool)

StoreKit stores in the database a commercial exon capture kit name and associated details

func StoreSynonyms

func StoreSynonyms(geneID uint, synonyms []ensembl.Synonym) (created bool)

StoreSynonyms stores in the database a record for a gene synonym mapping

func StoreVariant

func StoreVariant(allele clinvar.Allele, exonId uint) (variantID uint)

StoreExons stores in the database a single variant (rs) from ClinVar

Types

type BAMFile

type BAMFile struct {
	ID                 uint                `gorm:"primarykey"`
	SHA256Sum          string              `gorm:"uniqueIndex"`
	Size               uint64              `json:"size"`
	Name               string              `json:"name"`
	KitID              uint                `json:"-"`
	ExonDepthCoverages []ExonDepthCoverage `gorm:"constraint:OnDelete:CASCADE;" json:"-"`
}

type Coverage

type Coverage float64

type Depth

type Depth uint8

type DepthCoverage

type DepthCoverage struct {
	ID                  uint  `gorm:"primarykey" json:"-"`
	ExonDepthCoverageID uint  `gorm:"index" json:"-"`
	Depth               uint8 `json:"depth"`
	Coverage            uint8 `json:"coverage"`
}

type Exon

type Exon struct {
	ID                 uint                `gorm:"primarykey" json:"id"`
	GeneID             uint                `json:"-"`
	Strand             int                 `json:"strand"`
	Chromosome         string              `gorm:"index" json:"chromosome"`
	Start              uint64              `gorm:"index" json:"start"`
	End                uint64              `json:"end"`
	ExonNumber         uint                `json:"exonNumber"`
	ExonDepthCoverages []ExonDepthCoverage `json:"-"`
	Variants           []Variant           `json:"-"`
}

func GetExons

func GetExons() []Exon

GetExons returns a slice of all exons in the database

type ExonDepthCoverage

type ExonDepthCoverage struct {
	ID             uint            `gorm:"primarykey" json:"-"`
	ExonID         uint            `gorm:"index" json:"-"`
	BAMFileID      uint            `gorm:"index" json:"-"`
	BAMFile        BAMFile         `json:"bamFile"`
	DepthCoverages []DepthCoverage `gorm:"constraint:OnDelete:CASCADE;" json:"depthCoverages"`
}

type ExonReadCount

type ExonReadCount struct {
	ID         uint        `gorm:"primarykey" json:"-"`
	ExonID     uint        `gorm:"index" json:"-"`
	BAMFileID  uint        `gorm:"index" json:"-"`
	BAMFile    BAMFile     `json:"bamFile"`
	ReadCounts []ReadCount `gorm:"constraint:OnDelete:CASCADE;" json:"readCounts"`
}

type Gene

type Gene struct {
	ID                  uint          `gorm:"primarykey" json:"id"`
	HGNCAccession       string        `gorm:"unique" json:"hgncAccession"`
	GeneAccession       string        `gorm:"uniqueIndex" json:"geneAccession"`
	Name                string        `gorm:"uniqueIndex" json:"name"`
	Description         string        `json:"description"`
	TranscriptAccession string        `json:"transcriptAccession"`
	Exons               []Exon        `json:"exons"`
	GeneSynonyms        []GeneSynonym `json:"synonyms"`
}

type GeneSynonym

type GeneSynonym struct {
	ID      uint   `gorm:"primarykey" json:"id"`
	GeneID  uint   `json:"-"`
	Synonym string `json:"synonym"`
}

type Kit

type Kit struct {
	ID       uint      `gorm:"primarykey" json:"id"`
	Name     string    `json:"name"`
	BAMFiles []BAMFile `json:"-"`
}

type ReadCount

type ReadCount struct {
	ID              uint   `gorm:"primarykey" json:"-"`
	ExonReadCountID uint   `gorm:"index" json:"-"`
	Position        uint64 `json:"depth"`
	Count           uint64 `json:"coverage"`
}

type Variant

type Variant struct {
	ID            uint   `gorm:"primarykey" json:"-"`
	VariantID     string `gorm:"uniqueIndex" json:"variantId"`
	Name          string `json:"-"`
	ClinSig       string `json:"clinSig"`
	ClinSigSimple int    `json:"-"`
	ProteinChange string `json:"-"`
	ReviewStatus  string `json:"-"`
	Phenotypes    string `json:"-"`
	Chromosome    string `gorm:"index" json:"chromosome"`
	Start         uint64 `gorm:"index" json:"start"`
	End           uint64 `gorm:"index" json:"end"`
	ExonID        uint   `gorm:"index" json:"exonId"`
}

Jump to

Keyboard shortcuts

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