Skip to content

workflow

list_lcc_files(session_dir)

List all lcc.mrc files in the PowerFit runs in the session directory.

Parameters:

Name Type Description Default
session_dir Path

Directory containing the session data.

required

Yields:

Type Description
Generator[tuple[str, str, Path]]

Tuples containing the run ID, structure name, and path to the lcc.mrc

powerfit_commands(target, resolution, session_dir, /, *, options, powerfit_run_id=None)

Generate PowerFit commands for structure files in the session directory.

Parameters:

Name Type Description Default
target Path

Target density map to fit the model in. Data should either be in CCP4 or MRC format

required
resolution float

Resolution of map in Angstrom

required
session_dir Path

Session directory for input and output

required
options PowerfitOptions

Powerfit options.

required
powerfit_run_id str | None

ID of the PowerFit run to use. If not provided, will autoincrement based on existing runs.

None

Raises:

Type Description
FileNotFoundError

If no structure files are found in the session directory.

FileExistsError

If the PowerFit run directory already exists.

Returns:

Type Description
tuple[list[str], str]

A tuple containing a list of PowerFit commands and the PowerFit run ID.

powerfit_filtered_report(session_dir, powerfit_run_id=None, top=1, group_by_structure=True)

Return PowerFit solutions filtered by rank and grouping mode.

Parameters:

Name Type Description Default
session_dir Path

Directory containing the session data.

required
powerfit_run_id str | None

Optional ID of the PowerFit run to report. If None, reports over all runs.

None
top int

Number of top solutions to return.

1
group_by_structure bool

Whether to group solutions by structure before selecting top solutions.

True

Raises:

Type Description
FileNotFoundError

If no structure files are found in the session directory.

Returns:

Type Description
DataFrame

A DataFrame containing the filtered PowerFit solutions.

powerfit_fit_models(session_dir, powerfit_run_id=None, top=1, group_by_structure=True)

Fit models using PowerFit solutions.

Parameters:

Name Type Description Default
session_dir Path

Directory containing the session data.

required
powerfit_run_id str | None

Optional ID of the PowerFit run to report. If None, reports over all runs.

None
top int

Number of top solutions to fit.

1
group_by_structure bool

Whether to group solutions by structure before selecting top solutions.

True

Raises:

Type Description
FileNotFoundError

If no structure files are found in the session directory.

Returns:

Type Description
DataFrame

A DataFrame containing following columns:

  • powerfit_run_id: ID of the PowerFit run
  • structure: Name of the structure file
  • rank: Rank of the solution
  • fitted_model_file: Path to the fitted model file
  • unfitted_model_file: Path to the unfitted model file

Dataframe is written to <session_dir>/powerfit/fitted_models.csv with paths relative to session dir.

powerfit_list_runs(session_dir)

List all PowerFit runs in the session directory.

Parameters:

Name Type Description Default
session_dir Path

Directory containing the session data.

required

Raises:

Type Description
FileNotFoundError

If no density map is found in any run directory.

Returns:

Type Description
list[RunInfo]

A list of RunInfo dictionaries for each PowerFit run.

powerfit_report(session_dir, powerfit_run_id=None)

Return a DataFrame containing the PowerFit solutions.

Parameters:

Name Type Description Default
session_dir Path

Directory containing the session data.

required
powerfit_run_id str | None

Optional ID of the PowerFit run to report. If None,

None

Raises:

Type Description
FileNotFoundError

If no structure files are found in the session directory.

Returns:

Type Description
DataFrame

A DataFrame containing the PowerFit solutions. With following columns:

  • powerfit_run_id: ID of the PowerFit run
  • structure: Name of the structure file
  • rank: Rank of the solution
  • cc: Cross-correlation coefficient of the solution
  • fishz: FishZ score of the solution
  • relz: Relative Z-score of the solution
  • translation: Translation vector of the solution
  • rotation: Rotation matrix of the solution
  • template_file: Path to the template structure file, relative to the session directory
  • uniprot_accessions: Comma-separated list of UniProt accessions
  • structure_id: Structure ID of the template structure
  • is_alphafold: Whether the template structure comes from AlphaFoldDB

powerfit_run_options_from_rocrate(session_dir)

Extract PowerFit run options from the RO-Crate metadata.

Parameters:

Name Type Description Default
session_dir Path

Directory containing the session data.

required

Raises:

Type Description
FileNotFoundError

If the RO-Crate file is missing from the session directory.

Returns:

Type Description
dict[str, str]

A dictionary mapping PowerFit run IDs to their corresponding options.

powerfit_runs(target, resolution, session_dir, /, *, options, powerfit_run_id=None, scheduler_address=None)

Run PowerFit on PDB files in the session directory and store results.

Parameters:

Name Type Description Default
target Path

Target density map to fit the model in. Data should either be in CCP4 or MRC format

required
resolution float

Resolution of map in Angstrom

required
session_dir Path

Session directory for input and output

required
options PowerfitOptions

Powerfit options.

required
powerfit_run_id str | None

ID of the PowerFit run to use. If not provided, will autoincrement based on existing runs.

None
scheduler_address str | Cluster | None

Address of the Dask scheduler to use. If not provided, will create a local Dask cluster. If set to "sequential", will run PowerFit sequentially without using Dask.

None

Raises:

Type Description
FileNotFoundError

If no structure files are found in the session directory.

FileExistsError

If the PowerFit run directory already exists.

Returns:

Type Description
str

The PowerFit run ID.

powerfit_solutions_query(join)

Generate SQL query that reads PowerFit solutions files and joins them with fittable structures.

Parameters:

Name Type Description Default
join str

JOIN clause that combines the solutions subquery with the fittable structures, for example JOIN read_csv($fittable_structures_csv) AS fittable_structures USING (structure) or JOIN fittable_structures USING (structure) when the table already exists.

required

Returns:

Type Description
str

SQL query string with named parameter $solutions_pattern

str

and any parameters referenced by join.