Documentation
¶
Overview ¶
package stockcenter is the data source for stockcenter and related data
Index ¶
- Constants
- Variables
- func BuildGoldenBraidContext(userEmail string, plasmidCVTerm string, depositor string) func([]string) *GoldenBraidContext
- func NameError(p *GoldenBraidContext) error
- func RecordLengthError(r []string) error
- func SummaryError(p *GoldenBraidContext) error
- func UserError(p *GoldenBraidContext) error
- type Dependencies
- type GoldenBraidContext
- type ParseContext
- type Plasmid
- type PlasmidGenbank
- type PlasmidGenbankReader
- type PlasmidParser
- type PlasmidReader
- type StockAnnotatorLookup
- type StockGeneLookup
- type StockOrder
- type StockOrderReader
- type StockPubLookup
- type Strain
- type StrainReader
Constants ¶
const (
// GoldenBraidFieldCount is the expected number of fields in a GoldenBraid CSV record
GoldenBraidFieldCount = 7
)
Variables ¶
var ( HasValidUser = F.Flow2( func(p *GoldenBraidContext) string { return p.User }, S.IsNonEmpty, ) HasValidSummary = F.Flow2( func(p *GoldenBraidContext) string { return p.Summary }, S.IsNonEmpty, ) // HasValidName checks if plasmid name starts with 'p' and is non-empty HasValidName = F.Flow2( func(p *GoldenBraidContext) string { return p.Name }, Pred.MonoidAll[string]().Concat( S.IsNonEmpty, hasPrefix, ), ) // Eq.Of creates an Eq instance for comparable types. // We then create a predicate that checks for equality with GoldenBraidFieldCount. HasValidRecordLength = F.Flow2( A.Size[string], Eq.Equals(Eq.FromStrictEquals[int]())(GoldenBraidFieldCount), ) )
Functions ¶
func BuildGoldenBraidContext ¶
func BuildGoldenBraidContext( userEmail string, plasmidCVTerm string, depositor string, ) func([]string) *GoldenBraidContext
BuildGoldenBraidContext constructs GoldenBraidContext immutably from CSV record (curried)
func NameError ¶
func NameError(p *GoldenBraidContext) error
NameError creates error for invalid name
func RecordLengthError ¶
RecordLengthError creates error for invalid record length
func SummaryError ¶
func SummaryError(p *GoldenBraidContext) error
SummaryError creates error for empty summary
func UserError ¶
func UserError(p *GoldenBraidContext) error
UserError creates error for missing user
Types ¶
type Dependencies ¶
type Dependencies struct {
Alookup StockAnnotatorLookup
Plookup StockPubLookup
Glookup StockGeneLookup
}
Dependencies holds lookup services for enrichment
type GoldenBraidContext ¶
type GoldenBraidContext struct {
Name string // Column 0: "Plasmid Name"
Summary string // Column 5: "Description"
Genes O.Option[[]string] // Column 3: parsed comma-separated genes
Publications O.Option[[]string] // Column 6: "PMID" (stored as single-element slice)
User string // From CLI --user-email
PlasmidType string // From CLI --plasmid-cvterm
Depositor string // From CLI --depositor
CreatedOn time.Time // Default timestamp
UpdatedOn time.Time // Default timestamp
}
GoldenBraidContext holds all inputs for a single GoldenBraid plasmid pipeline
type ParseContext ¶
ParseContext carries data through the parsing pipeline
type Plasmid ¶
type Plasmid struct {
ID string
Summary string
User string
CreatedOn time.Time
UpdatedOn time.Time
Name string
Publications []string
Genes []string
}
Plasmid is the container for plasmid data
type PlasmidGenbank ¶
PlasmidGenbank is the container for genbank link for plasmid
type PlasmidGenbankReader ¶
type PlasmidGenbankReader interface {
datasource.IteratorWithoutValue
Value() (*PlasmidGenbank, error)
}
PlasmidGenbankReader is the defined interface for reading the data
func NewPlasmidGenbankReader ¶
func NewPlasmidGenbankReader(r io.Reader) PlasmidGenbankReader
NewPlasmidGenbankReader is to get an instance of PlasmidGenbankReader
type PlasmidParser ¶
type PlasmidParser = RE.ReaderEither[Dependencies, error, ParseContext]
PlasmidParser represents a parsing step in the pipeline
type PlasmidReader ¶
type PlasmidReader interface {
datasource.IteratorWithoutValue
Value() E.Either[error, *Plasmid]
}
PlasmidReader is the defined interface for reading the plasmid data
func NewCsvPlasmidReader ¶
func NewCsvPlasmidReader( r io.Reader, al StockAnnotatorLookup, pl StockPubLookup, gl StockGeneLookup, ) PlasmidReader
NewCsvPlasmidReader is to get an instance of PlasmidReader instance
type StockAnnotatorLookup ¶
type StockAnnotatorLookup interface {
StockAnnotator(id string) (string, time.Time, time.Time, bool)
}
StockAnnotatorLookup is an interface for retrieving stock annotator
func NewStockAnnotatorLookup ¶
func NewStockAnnotatorLookup(r io.Reader) (StockAnnotatorLookup, error)
type StockGeneLookup ¶
type StockGeneLookup interface {
// StockGene looks up a stock identifier and returns a slice
// with a list of gene identifiers
StockGene(id string) []string
}
func NewStockGeneLookp ¶
func NewStockGeneLookp(r io.Reader) (StockGeneLookup, error)
NewStockGeneLookp returns a struct implementing StockGeneLookup interface
type StockOrder ¶
StockOrder is the container for order data
type StockOrderReader ¶
type StockOrderReader interface {
datasource.IteratorWithoutValue
Value() (*StockOrder, error)
}
StockOrderReader is the defined interface for reading the data
func NewCsvStockOrderReader ¶
func NewCsvStockOrderReader(r io.Reader) StockOrderReader
NewCsvStockOrderReader is to get an instance of order reader
type StockPubLookup ¶
type StockPubLookup interface {
// StockPub looks up a stock identifier and returns a slice
// with a list of publication identifiers
StockPub(id string) []string
}
StockPubLookup is an interface for retrieving publication linked to a stock record
func NewStockPubLookup ¶
func NewStockPubLookup(r io.Reader) (StockPubLookup, error)
NewStockPubLookup returns an StockPubLookup implementing struct
type Strain ¶
type Strain struct {
ID string
Descriptor string
Summary string
Species string
User string
Publications []string
Genes []string
CreatedOn time.Time
UpdatedOn time.Time
}
Strain is the container for strain data
type StrainReader ¶
type StrainReader interface {
datasource.IteratorWithoutValue
Value() (*Strain, error)
}
StrainReader is the defined interface for reading the strain data
func NewCsvStrainReader ¶
func NewCsvStrainReader( r io.Reader, al StockAnnotatorLookup, pl StockPubLookup, gl StockGeneLookup, ) StrainReader
NewCsvStrainReader is to get an instance of strain reader