genetest.phenotypes package

Submodules

genetest.phenotypes.core module

class genetest.phenotypes.core.PhenotypesContainer[source]

Bases: object

close()[source]
get_nb_samples()[source]

Returns the number of samples.

Returns:The number of samples.
Return type:int
get_nb_variables()[source]

Returns the number of variables.

Returns:The number of variables.
Return type:int
get_phenotypes(li=None)[source]

Returns a dataframe of phenotypes.

Parameters:li (list) – A list of phenotypes to extract (default: None means all phenotypes).
Returns:A dataframe containing the phenotypes (with the sample IDs as index).
Return type:pandas.DataFrame
get_sex()[source]

Returns the sex for all samples.

Returns:The sex for all samples.
Return type:pandas.Series
is_repeated()[source]

Check if the phenotypes contain repeated measurements.

Returns:True if the data contains repeated measurements, False otherwise.
Return type:bool
keep_samples(keep)[source]

Keeps only a subset of samples.

Parameters:keep (list) – The list of samples to keep.

genetest.phenotypes.text module

class genetest.phenotypes.text.TextPhenotypes(filename, sample_column='sample', field_separator='t', missing_values=None, repeated_measurements=False, keep_sample_column=False, sex_column=None)[source]

Bases: genetest.phenotypes.core.PhenotypesContainer

Instantiate a new TextPhenotypes object.

Parameters:
  • filename (str) – The name of the text file containing the phenotypes.
  • sample_column (str) – The name of the column containing the sample identification number (to fit with the genotypes).
  • field_separator (str) – The field separator (default is tabulation).
  • missing_values (str or list or dict) – The missing value(s).
  • repeated_measurements (bool) – Are the data containing repeated measurements (e.g. for MixedLM).
  • sex_column (str) – The name of the column containing the sex for each sample.
close()[source]
get_nb_samples()[source]

Returns the number of samples.

Returns:The number of samples.
Return type:int
get_nb_variables()[source]

Returns the number of variables.

Returns:The number of variables.
Return type:int
get_phenotypes(li=None)[source]

Returns a dataframe of phenotypes.

Returns:A dataframe containing the phenotypes (with the sample IDs as index).
Return type:pandas.DataFrame
is_repeated()[source]

Check if the phenotypes contain repeated measurements.

Returns:True if the data contains repeated measurements, False otherwise.
Return type:bool
keep_samples(keep)[source]

Keeps only a subset of samples.

Parameters:keep (set) – The list of samples to keep.
merge(other)[source]

Merge this instance with another.

Module contents