stockcenter

package
v0.0.0-...-75a7ee6 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: BSD-2-Clause Imports: 55 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SetAnnotator = F.Curry2(
		func(annotator source.StockAnnotatorLookup, ctx LookupContext) WithAnnotator {
			return WithAnnotator{
				LookupContext: ctx,
				Annotator:     annotator,
			}
		},
	)

	SetPubLookup = F.Curry2(
		func(pubLookup source.StockPubLookup, ctx WithAnnotator) WithPubLookup {
			return WithPubLookup{
				WithAnnotator: ctx,
				PubLookup:     pubLookup,
			}
		},
	)

	SetGeneLookup = F.Curry2(
		func(geneLookup source.StockGeneLookup, ctx WithPubLookup) WithGeneLookup {
			return WithGeneLookup{
				WithPubLookup: ctx,
				GeneLookup:    geneLookup,
			}
		},
	)
)

Curried setters for Do/Bind pattern

View Source
var ProcessingResultSemigroup = SG.MakeSemigroup(
	func(a, b ProcessingResult) ProcessingResult {
		return ProcessingResult{
			Successes:  append(a.Successes, b.Successes...),
			Errors:     errors.Join(a.Errors, b.Errors),
			ErrorCount: a.ErrorCount + b.ErrorCount,
		}
	},
)

ProcessingResultSemigroup for combining results

Functions

func GoldenBraidSummarySemigroup

func GoldenBraidSummarySemigroup() S.Semigroup[GoldenBraidProcessingResult]

func InventorySummarySemigroup

func InventorySummarySemigroup() S.Semigroup[InventoryProcessingSummary]

func LoadGeno

func LoadGeno(_ *cobra.Command, _ []string) error

func LoadGoldenBraidCli

func LoadGoldenBraidCli(cmd *cli.Context) error

LoadGoldenBraidCli is the main entry point for loading GoldenBraid CSV data

func LoadGwdi

func LoadGwdi(_ *cobra.Command, _ []string) error

func LoadOrder

func LoadOrder(_ *cobra.Command, _ []string) error

func LoadPheno

func LoadPheno(_ *cobra.Command, _ []string) error

func LoadPlasmid

func LoadPlasmid(_ *cobra.Command, _ []string) error

LoadPlasmid is the main entry point for plasmid loading

func LoadPlasmidInv

func LoadPlasmidInv(_ *cobra.Command, _ []string) error

func LoadPlasmidOntologyCli

func LoadPlasmidOntologyCli(cmd *cli.Context) error

LoadPlasmidOntologyCli is the CLI entry point for ontology updates

func LoadStrain

func LoadStrain(_ *cobra.Command, _ []string) error

func LoadStrainChar

func LoadStrainChar(_ *cobra.Command, _ []string) error

func LoadStrainInv

func LoadStrainInv(_ *cobra.Command, _ []string) error

func LoadStrainProp

func LoadStrainProp(_ *cobra.Command, _ []string) error

func LoadStrainSynProp

func LoadStrainSynProp(_ *cobra.Command, _ []string) error

func StatsSemigroup

func StatsSemigroup() S.Semigroup[OntologyUpdateStats]

StatsSemigroup creates a semigroup for combining stats

func TimestampProto

func TimestampProto(t time.Time) *timestamppb.Timestamp

Types

type AnnotationContext

type AnnotationContext struct {
	Client    pb.TaggedAnnotationServiceClient
	PlasmidID string
	Tag       string
	Value     string
}

type DBBuildContext

type DBBuildContext struct {
	Reader            io.ReadCloser
	GoldenBraidReader io.ReadCloser
	Context           context.Context
	Builder           *filesql.DBBuilder
}

DBBuildContext contains only the fields needed for building inventory database

type Deps

type Deps struct {
	StockClient      stock.StockServiceClient
	AnnotationClient pb.TaggedAnnotationServiceClient
	Logger           *slog.Logger
}

Deps holds dependencies for inventory processing

type GoldenBraidProcessingResult

type GoldenBraidProcessingResult struct {
	CreatedCount int      // New plasmids created
	SkippedCount int      // Existing plasmids skipped (already exist)
	Successes    []string // All plasmid IDs (created + skipped)
	Errors       []error
	ErrorCount   int
}

GoldenBraidProcessingResult holds aggregate processing statistics

type GoldenBraidResult

type GoldenBraidResult struct {
	PlasmidID string
	Created   bool // true=created, false=skipped
	Error     error
}

Result of UPSERT operation

type InventoryLoaderConfig

type InventoryLoaderConfig struct {
	DB                *sql.DB
	Reader            io.ReadCloser
	GoldenBraidReader io.ReadCloser
	Logger            *slog.Logger
	Cmd               *cli.Context
}

type InventoryLoaderIOE

type InventoryLoaderIOE = IOE.IOEither[error, InventoryLoaderConfig]

func InventoryBuilderFromFile

func InventoryBuilderFromFile(
	cmd *cli.Context,
	logger *slog.Logger,
) InventoryLoaderIOE

type InventoryProcessingSummary

type InventoryProcessingSummary struct {
	SuccessCount  int
	ErrorCount    int
	ExpectedCount int
	Errors        []string
}

type LoaderConfig

type LoaderConfig struct {
	LoaderContext
	Cmd     *cli.Context
	Reader  *csv.Reader
	Closer  io.Closer
	Slogger *slog.Logger
}

LoaderConfig holds CLI context and CSV reader

type LoaderContext

type LoaderContext struct{}

LoaderContext is the initial empty context

type LookupContext

type LookupContext struct{}

Context types for Do/Bind pattern

type LookupTuple

type LookupTuple struct {
	Annotator  source.StockAnnotatorLookup
	PubLookup  source.StockPubLookup
	GeneLookup source.StockGeneLookup
}

LookupTuple holds all lookup instances

type OntologyUpdateStats

type OntologyUpdateStats struct {
	ProcessedCount int       `json:"processed_count"` // Total plasmids examined
	UpdatedCount   int       `json:"updated_count"`   // Successfully updated
	ErrorCount     int       `json:"error_count"`     // Failed updates
	Errors         []error   `json:"-"`               // Error samples (first 5)
	StartTime      time.Time `json:"start_time"`
	EndTime        time.Time `json:"end_time"`
}

OntologyUpdateStats tracks update operation metrics

type PipelineContext

type PipelineContext struct {
	Deps             Deps
	PlasmidName      string
	Location         string
	PlasmidID        string
	Inventory        *pb.TaggedAnnotationGroupCollection
	InventoryDeleted bool
	AnnotationIDs    []string
	GroupCreated     bool
}

PipelineContext represents the complete state of inventory processing

type PlasmidEnv

type PlasmidEnv struct {
	Logger    *logrus.Entry
	APIClient pb.StockServiceClient
}

PlasmidEnv contains all dependencies for plasmid loading

type ProcessContext

type ProcessContext struct {
	Client  stockpb.StockServiceClient
	Term    string
	Plasmid *stockpb.PlasmidCollection_Data
}

ProcessContext - Context struct for processPlasmid (point-free, no lambda wrapper)

type Processing

type Processing[A any] = RE.ReaderIOEither[Deps, error, A]

Processing is a ReaderIOEither that injects Deps

type ProcessingResult

type ProcessingResult struct {
	Successes  []string // Successfully processed plasmid IDs
	Errors     error    // All validation/processing errors
	ErrorCount int      // Number of errors (for accurate statistics)
}

ProcessingResult accumulates successes and errors

type Status

type Status int
const (
	Created Status = iota
	Updated
	Deleted
	Read
	Nop
)

func NewOrReloadGeno

func NewOrReloadGeno(client pb.TaggedAnnotationServiceClient, p *genoArgs) (Status, error)

func (Status) String

func (i Status) String() string

type UpdateContext

type UpdateContext struct {
	Client  stockpb.StockServiceClient
	Term    string
	Plasmid *stockpb.Plasmid
}

UpdateContext - Context struct for updatePlasmidTerm (point-free, no lambda wrapper)

type WithAnnotator

type WithAnnotator struct {
	LookupContext
	Annotator source.StockAnnotatorLookup
}

type WithGeneLookup

type WithGeneLookup struct {
	WithPubLookup
	GeneLookup source.StockGeneLookup
}

type WithPubLookup

type WithPubLookup struct {
	WithAnnotator
	PubLookup source.StockPubLookup
}

Jump to

Keyboard shortcuts

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