Clumppling
Wrappers for Clumppling's main and compModels functions.
Wrappers for Clumppling and compModels.
Functions
prepare_compmodels(models, model_dirs, comp_dir, *, suffixes=None, modes_aligned_subdir='modes_aligned', mode_stats_relpath='modes/mode_stats.txt', exist_ok=True)
Write the compModels input files for several aligned models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
models
|
Sequence[str]
|
Model names, used to name the output files. |
required |
model_dirs
|
Sequence[str | Path]
|
Clumppling output directory of each model. |
required |
comp_dir
|
str | Path
|
Directory for the output files. |
required |
suffixes
|
Sequence[str] | None
|
Suffix of the aligned Q files per model, "rep" or "avg"; None uses "rep" for all. |
None
|
modes_aligned_subdir
|
str
|
Subdirectory of each model directory with the aligned Q files. |
'modes_aligned'
|
mode_stats_relpath
|
str
|
Path of the mode statistics file in each model directory. |
'modes/mode_stats.txt'
|
exist_ok
|
bool
|
Allow comp_dir to exist already. |
True
|
Returns:
| Type | Description |
|---|---|
qfilelists
|
One .qfilelist file per model. |
qnamelists
|
One .qnamelist file per model. |
mode_stats_files
|
One copied mode_stats file per model. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If models, model_dirs and suffixes differ in length. |
FileNotFoundError
|
If Q files or mode_stats files are missing. |
run_clumppling(input_dir, output_dir, fmt='generalQ', *, vis=True, custom_cmap='', plot_type='graph', include_cost=True, include_label=True, alt_color=True, ind_labels='', ordered_uniq_labels='', regroup_ind=True, reorder_within_group=True, reorder_by_max_k=True, order_cls_by_label=True, plot_unaligned=False, fig_format='tiff', extension='', skip_rows=0, remove_missing=True, cd_method='louvain', cd_res=1.0, test_comm=True, comm_min=1e-06, comm_max=0.01, merge=True, use_rep=True, use_best_pair=True, setup_logging=True, log_file=None)
Run Clumppling on the clustering runs in one directory.
Arguments other than those below are Clumppling options of the same name; see clumppling --help.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_dir
|
PathLike
|
Directory with the clustering files (-i). |
required |
output_dir
|
PathLike
|
Output directory (-o). |
required |
fmt
|
str
|
Input format (-f): "generalQ", "admixture", "structure" or "fastStructure". |
'generalQ'
|
setup_logging
|
bool
|
Write a log, as the command line does. |
True
|
log_file
|
Optional[PathLike]
|
Log file; defaults to output_dir/clumppling.log. |
None
|
vis
|
bool
|
Clumppling options. |
True
|
custom_cmap
|
bool
|
Clumppling options. |
True
|
plot_type
|
bool
|
Clumppling options. |
True
|
include_cost
|
bool
|
Clumppling options. |
True
|
include_label
|
bool
|
Clumppling options. |
True
|
alt_color
|
bool
|
Clumppling options. |
True
|
ind_labels
|
bool
|
Clumppling options. |
True
|
ordered_uniq_labels
|
bool
|
Clumppling options. |
True
|
regroup_ind
|
bool
|
Clumppling options. |
True
|
reorder_within_group
|
bool
|
Clumppling options. |
True
|
reorder_by_max_k
|
bool
|
Clumppling options. |
True
|
order_cls_by_label
|
bool
|
Clumppling options. |
True
|
plot_unaligned
|
bool
|
Clumppling options. |
True
|
fig_format
|
bool
|
Clumppling options. |
True
|
extension
|
bool
|
Clumppling options. |
True
|
skip_rows
|
bool
|
Clumppling options. |
True
|
remove_missing
|
bool
|
Clumppling options. |
True
|
cd_method
|
bool
|
Clumppling options. |
True
|
cd_res
|
bool
|
Clumppling options. |
True
|
test_comm
|
bool
|
Clumppling options. |
True
|
comm_min
|
bool
|
Clumppling options. |
True
|
comm_max
|
bool
|
Clumppling options. |
True
|
merge
|
bool
|
Clumppling options. |
True
|
use_rep
|
bool
|
Clumppling options. |
True
|
use_best_pair
|
bool
|
Clumppling options. |
True
|
Returns:
| Type | Description |
|---|---|
Namespace
|
Arguments passed to Clumppling. |
run_comp_models(models, comp_dir, output_dir, *, fig_format='png', vis=True, custom_cmap='', bg_colors=None, include_sim_in_label=True, ind_labels='', qfilelists=None, qnamelists=None, mode_stats_files=None, setup_logging=True, log_file=None)
Run compModels to align and compare several models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
models
|
Sequence[str]
|
Model names (--models). |
required |
comp_dir
|
str | Path
|
Directory with the input files from |
required |
output_dir
|
str | Path
|
Output directory (--output). |
required |
fig_format
|
str
|
Figure format. |
'png'
|
vis
|
bool
|
Write figures. |
True
|
custom_cmap
|
str
|
Color file, or "" for the default colors. |
''
|
bg_colors
|
Sequence[str] | None
|
Background colors, or None. |
None
|
include_sim_in_label
|
bool
|
Show similarity in figure labels. |
True
|
ind_labels
|
str
|
File of cell labels, or "". |
''
|
qfilelists
|
Sequence[str | Path] | None
|
Input files per model; None uses comp_dir/{model}.qfilelist, comp_dir/{model}.qnamelist and comp_dir/{model}_mode_stats.txt. |
None
|
qnamelists
|
Sequence[str | Path] | None
|
Input files per model; None uses comp_dir/{model}.qfilelist, comp_dir/{model}.qnamelist and comp_dir/{model}_mode_stats.txt. |
None
|
mode_stats_files
|
Sequence[str | Path] | None
|
Input files per model; None uses comp_dir/{model}.qfilelist, comp_dir/{model}.qnamelist and comp_dir/{model}_mode_stats.txt. |
None
|
setup_logging
|
bool
|
Write a log, as the command line does. |
True
|
log_file
|
Optional[PathLike]
|
Log file; defaults to output_dir/clumppling.compModels.log. |
None
|