parsers
Description
Contains modules for working with output files of **BLUPF90 utilities:**
Module for reading(parsing) the parameter file - configuration file
param.txt.Modules for reading(parsing) the file with the results of calculation of variants
(ai)remlf90.log.Module for reading(parsing) the file with pedigree
renaddxx.ped.Module for reading(parsing) file with ebv (Estimate Breeding Value)
solutionresults.
Modules
- class bpf90tools.parsers.IParser[source]
Bases:
ABCAbstract class for file parsers.
Defines an interface for classes that must implement methods for processing and reading files.
- _abc_impl = <_abc._abc_data object>
- class bpf90tools.parsers.Keywords[source]
Bases:
objectA class that stores sets of keywords used in various genetic analysis programs.
This class defines keyword sets for different software tools, such as RENUMF90, BLUPF90, REMLF90, and AIREMLF90. These keywords are used in parameter files to control various settings and options.
- AIREMLF90_keyword = {'OPTION EM-REML', 'OPTION SNP_file', 'OPTION approx_loglike', 'OPTION constant_var', 'OPTION conv_crit', 'OPTION fact_once', 'OPTION hetres_pol', 'OPTION hetres_pos', 'OPTION maxrounds', 'OPTION missing', 'OPTION se_covar_function', 'OPTION sol', 'OPTION tol', 'OPTION use_yams'}
- BLUPF90_keyword = {'OPTION blksize', 'OPTION conv_crit', 'OPTION fixed_var', 'OPTION hetres_int', 'OPTION maxrounds', 'OPTION r_factor', 'OPTION sol', 'OPTION solv_method', 'OPTION use_yams'}
- REMLF90_keyword = {'OPTION', 'OPTION SNP_file', 'OPTION constant_var', 'OPTION conv_crit', 'OPTION maxrounds', 'OPTION missing', 'OPTION sol', 'OPTION use_yams'}
- RENUMF90_keyword = {'(CO)VARIANCES', '(CO)VARIANCES_MPE', '(CO)VARIANCES_PE', 'COMBINE', 'DATAFILE', 'EFFECT', 'FIELDS_PASSED TO OUTPUT', 'FILE', 'FILE_POS', 'GEN_INT', 'INBREEDING', 'NESTED', 'OPTION alpha_size', 'OPTION max_field_readline', 'OPTION max_string_readline', 'OPTIONAL', 'PED_DEPTH', 'RANDOM', 'REC_SEX', 'RESIDUAL_VARIANCE', 'SKIP_HEADER', 'SNP_FILE', 'TRAITS', 'UPG_TYPE', 'WEIGHT(S)'}
- property complex_par: set[str]
Returns a set of keywords that are more complex and may take multiple parameters.
- property single_par: set[str]
Returns a set of keywords that typically take a single parameter.
- property unique_keywords: set[str]
Returns a set of all unique keywords from all keyword groups.
- class bpf90tools.parsers.PParams[source]
Bases:
IParser,Keywords,CheckMixinThis is a class that processes a parameter file which is a configuration file for calculating blupf90.
- _abc_impl = <_abc._abc_data object>
- _read(pth_file: str | Path) None | list[source]
Reading a file.
- Parameters:
pth_file – The path to the file.
- Returns:
Return the list line.
- property params: dict[str, list]
Method that returns data - a dictionary of keywords and their values.
- class bpf90tools.parsers.PPed[source]
Bases:
IParser,CheckMixinPedigree file processing renadd.ped which is obtained as a result of processing by renumf90 program. Example file: renadd02.ped
- _abc_impl = <_abc._abc_data object>
- parse_file(pth_file: str | Path) bool[source]
The parsing data files pedigree.
- Parameters:
pth_file – The path to file renadd.ped - pedigree.
- Returns:
Throws an exception when an error occurs.
- property values: DataFrame | None
Return of dataframe - [‘nomer’, ‘ID’].
- class bpf90tools.parsers.PSolution(varg: float = None)[source]
Bases:
IParser,CheckMixinProcessing the file with results of the assessment.
- _abc_impl = <_abc._abc_data object>
- static _rel_from_sep(se_data: float, var_gen: float) float[source]
Derivation of the reliability of the estimate from its standard deviation.
- Parameters:
se_data – Standard deviation calculated by blupf90.
var_gen – Genetic variance calculated by remlf90.
- Returns:
The return reliability.
- property _varg: float | None
- parse_file(file: str | Path) bool[source]
Handler for a file with the results of evaluations of breeding values.
- Parameters:
file – Path to file solutions.
- Returns:
Returns true if file parsing was successful, false if it failed.
- property solutions: DataFrame | None
- class bpf90tools.parsers.PVar[source]
Bases:
IParser,CheckMixinProcessing the file method (ai)remlf90 in which the variance information is stored.
- _abc_impl = <_abc._abc_data object>
- _heritability() None[source]
Heritability, the degree of conditionality of the phenotypic variability of any trait in an animal population by genotypic differences between individuals.
- _next_value(elem: str) int[source]
Determines the index of the next element in the list.
- Parameters:
elem – List item.
- Returns:
Return the index of the next element.
- class bpf90tools.parsers.Variance(*, varG: float = None, varE: float = None, aic: float = None, bic: float = None, heritability: float = None)[source]
Bases:
BaseModel- _abc_impl = <_abc._abc_data object>
- aic: float
- bic: float
- heritability: float
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- varE: float
- varG: float