choppa.IO.input.FitnessFactory

class choppa.IO.input.FitnessFactory(input_fitness_csv: Path, resindex_colname: str | None = 'residue_index', wildtype_colname: str | None = 'wildtype', mutant_colname: str | None = 'mutant', fitness_colname: str | None = 'fitness', confidence_colname: str | None = None)[source]

Base class for handling Fitness data within choppa.

__init__(input_fitness_csv: Path, resindex_colname: str | None = 'residue_index', wildtype_colname: str | None = 'wildtype', mutant_colname: str | None = 'mutant', fitness_colname: str | None = 'fitness', confidence_colname: str | None = None)[source]

Methods

__init__(input_fitness_csv[, ...])

check_validity(fitness_df)

Does some quick checks to make sure the imported CSV file is valid.

get_fitness_basedict()

Converts a pandas fitness dataframe (read by FitnessFactory.read_fitness_csv) into a fitness basedict which is essentially just an OrderedDict.

read_fitness_csv()

Reads in a fitness CSV file and checks that all requested columns are present, complete and numeric.

check_validity(fitness_df)[source]

Does some quick checks to make sure the imported CSV file is valid.

get_fitness_basedict()[source]

Converts a pandas fitness dataframe (read by FitnessFactory.read_fitness_csv) into a fitness basedict which is essentially just an OrderedDict.

We want the dict to have the form: { residue_index: {

fitness_csv_index, # this is the original index in the fitness CSV for provenance wildtype: {AA, fitness, confidence}, mutants: [{AA, fitness, confidence}, {AA, fitness, confidence}, etc]

}

}

read_fitness_csv()[source]

Reads in a fitness CSV file and checks that all requested columns are present, complete and numeric.