pandora.converter module

pandora.converter.get_filenames(prefix: Path, file_format: FileFormat) Tuple[Path, Path, Path][source]

Constructs the triple of file names for the geno, snp, and ind files for the given data format.

For a list of expected file endings see the Pandora wiki on GitHub.

Parameters:
prefixpathlib.Path

Prefix of the filepath pointing to the respective dataset files.

file_formatFileFormat

FileFormat of the respective format the dataset is in.

Returns:
Tuple[pathlib.Path, pathlib.Path, pathlib.Path]

File paths for the respective geno, snp and ind files.

Raises:
PandoraException

If the given file format is not recognized.

pandora.converter.run_convertf(convertf: str | Path, in_prefix: Path, in_format: FileFormat, out_prefix: Path, out_format: FileFormat, redo: bool = False) None[source]

Uses the EIGENSOFT convertf program to convert the given dataset in in_format into the same dataset in out_format.

If all respective out_prefix files are already present, only runs convertf if redo is True.

Parameters:
convertfExecutable

Executable of the EIGENSOFT convertf program.

in_prefixpathlib.Path

Prefix of the filepath pointing to the respective dataset files that should be converted.

in_formatFileFormat

Format of the input files.

out_prefixpathlib.Path

Prefix of the filepath where the output should be stored.

out_formatFileFormat

Desired output format.

redobool, default=False

Whether to rerun the conversion if the output files are already present.

Returns:
None
Raises:
RuntimeError

If the file conversion using the convertf program failed.