Documentation ¶
Overview ¶
Package phenotype defines the structure and associated methods for handling phenotype annotations. Each annotation is represented by the PhenotypeAnnotation struct, which includes details like strain ID, phenotype ID, assay ID, environment ID, strain descriptor, notes, reference, assigned by, and flags for deletion and emptiness. The struct's methods provide accessors and checkers for the various fields.
Package phenotype provides functionality to read phenotype annotations from an Excel file. It defines the PhenotypeAnnotationReader struct with methods to create a new reader, iterate over rows of data, and retrieve phenotype annotations as structured data with validation. The reader is initialized with a file path, a specific sheet name, and a creation date, and it includes error handling for file and row reading. It uses the third-party libraries excelize for Excel file manipulation and go-playground/validator for data validation.
Index ¶
- type PhenotypeAnnotation
- func (pha *PhenotypeAnnotation) AssayId() string
- func (pha *PhenotypeAnnotation) AssignedBy() string
- func (pha *PhenotypeAnnotation) CreatedOn() time.Time
- func (pha *PhenotypeAnnotation) EnvironmentId() string
- func (pha *PhenotypeAnnotation) HasAssayId() bool
- func (pha *PhenotypeAnnotation) HasEnvironmentId() bool
- func (pha *PhenotypeAnnotation) HasNotes() bool
- func (pha *PhenotypeAnnotation) HasStrainDescriptor() bool
- func (pha *PhenotypeAnnotation) HasStrainId() bool
- func (pha *PhenotypeAnnotation) IsEmpty() bool
- func (pha *PhenotypeAnnotation) Notes() string
- func (pha *PhenotypeAnnotation) PhenotypeId() string
- func (pha *PhenotypeAnnotation) Reference() string
- func (pha *PhenotypeAnnotation) StrainDescriptor() string
- func (pha *PhenotypeAnnotation) StrainId() string
- type PhenotypeAnnotationReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PhenotypeAnnotation ¶
type PhenotypeAnnotation struct {
// contains filtered or unexported fields
}
PhenotypeAnnotation represents annotations related to a phenotype.
func (*PhenotypeAnnotation) AssayId ¶
func (pha *PhenotypeAnnotation) AssayId() string
AssayId returns the assay ID associated with the phenotype annotation.
func (*PhenotypeAnnotation) AssignedBy ¶
func (pha *PhenotypeAnnotation) AssignedBy() string
AssignedBy returns the identifier of the entity that assigned the phenotype annotation.
func (*PhenotypeAnnotation) CreatedOn ¶
func (pha *PhenotypeAnnotation) CreatedOn() time.Time
func (*PhenotypeAnnotation) EnvironmentId ¶
func (pha *PhenotypeAnnotation) EnvironmentId() string
EnvironmentId returns the environment ID associated with the phenotype annotation.
func (*PhenotypeAnnotation) HasAssayId ¶
func (pha *PhenotypeAnnotation) HasAssayId() bool
HasAssayId checks whether an assay ID is associated with the phenotype annotation. It returns true if the assay ID is set.
func (*PhenotypeAnnotation) HasEnvironmentId ¶
func (pha *PhenotypeAnnotation) HasEnvironmentId() bool
HasEnvironmentId checks whether an environment ID is associated with the phenotype annotation. It returns true if the environment ID is set.
func (*PhenotypeAnnotation) HasNotes ¶
func (pha *PhenotypeAnnotation) HasNotes() bool
func (*PhenotypeAnnotation) HasStrainDescriptor ¶
func (pha *PhenotypeAnnotation) HasStrainDescriptor() bool
HasStrainDescriptor checks if the PhenotypeAnnotation instance has a strainDescriptor defined. It returns true if the strainDescriptor is not empty, otherwise false.
func (*PhenotypeAnnotation) HasStrainId ¶
func (pha *PhenotypeAnnotation) HasStrainId() bool
HasStrainId checks whether a strain ID is associated with the phenotype annotation. It returns true if the strain ID is set.
func (*PhenotypeAnnotation) IsEmpty ¶
func (pha *PhenotypeAnnotation) IsEmpty() bool
IsEmpty checks if the phenotype annotation is marked as empty. It returns true if the annotation is considered empty.
func (*PhenotypeAnnotation) Notes ¶
func (pha *PhenotypeAnnotation) Notes() string
Notes returns any notes associated with the phenotype annotation.
func (*PhenotypeAnnotation) PhenotypeId ¶
func (pha *PhenotypeAnnotation) PhenotypeId() string
PhenotypeId returns the phenotype ID associated with the phenotype annotation.
func (*PhenotypeAnnotation) Reference ¶
func (pha *PhenotypeAnnotation) Reference() string
Reference returns the reference associated with the phenotype annotation.
func (*PhenotypeAnnotation) StrainDescriptor ¶
func (pha *PhenotypeAnnotation) StrainDescriptor() string
StrainDescriptor returns the strain descriptor associated with the PhenotypeAnnotation.
func (*PhenotypeAnnotation) StrainId ¶
func (pha *PhenotypeAnnotation) StrainId() string
StrainId returns the strain ID associated with the phenotype annotation.
type PhenotypeAnnotationReader ¶
PhenotypeAnnotationReader is responsible for reading phenotype annotations from an Excel file
func NewPhenotypeAnnotationReader ¶
func NewPhenotypeAnnotationReader( file, sheet string, date time.Time, ) (*PhenotypeAnnotationReader, error)
NewPhenotypeAnnotationReader creates a new reader for phenotype annotations from an Excel file. It initializes the reader for the specified sheet in the file and sets the creation date for the annotations. The function also sets up a data validator for structural validation of the annotations. If the function encounters an error while opening the file or reading the rows, it returns the reader object created up to that point along with the error.
Parameters: - file: The path to the Excel file to be read. - sheet: The name of the sheet within the Excel file which contains the phenotype annotations. - date: The creation date to be associated with the annotations being read.
func (*PhenotypeAnnotationReader) Value ¶
func (phr *PhenotypeAnnotationReader) Value() (*PhenotypeAnnotation, error)
Value retrieves the current phenotype annotation from the reader. Before calling Value, Next should be used to advance the reader to the desired row. Value decodes the current row into a PhenotypeAnnotation struct and performs data validation. If the validation fails or an error occurs while reading the columns, it returns an error.