Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagated all hidden arguments in gCNV CASE mode from the given model #7464

Merged
merged 2 commits into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,12 @@
* <dt>CASE mode:</dt>
* <dd><p>The tool will be run in CASE mode using the argument {@code run-mode CASE}. The path to a previously
* obtained model directory must be provided via the {@code model} argument in this mode. The modeled intervals are
* then specified by a file contained in the model directory, all interval-related arguments are ignored in this
* mode, and all model intervals must be present in all of the input count files. The tool output in CASE mode
* is only the "-calls" subdirectory and is organized similarly to that in COHORT mode.</p>
* then specified by a file contained in the model directory,and all model intervals must be present in all of the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

directory,and -> directory, and

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* input count files. All interval-related arguments (e.g. {@code interval-psi-scale} argument) are ignored in this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(e.g. {@code interval-psi-scale} argument) -> (e.g. {@code interval-psi-scale})

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* mode, however an advanced user can adjust various sample-related (e.g. {@code sample-psi-scale}) and global
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mode, however -> mode. However,

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* (e.g. {@code p_alt}) arguments for custom applications of the tool. Inference-related (e.g.
* {@code min_training_epochs}) arguments can be adjusted as well. The tool output in CASE mode is only the "-calls"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inference-related (e.g. {@code min_training_epochs}) arguments -> Inference-related arguments (e.g. {@code min_training_epochs})

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* subdirectory and is organized similarly to that in COHORT mode.</p>
*
* <p>Note that at the moment, this tool does not automatically verify the compatibility of the provided parametrization
* with the provided count files. Model compatibility may be assessed a posteriori by inspecting the magnitude of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@
# logging args
gcnvkernel.cli_commons.add_logging_args_to_argparse(parser)

hidden_denoising_args = {
"max_bias_factors",
"psi_t_scale",
"log_mean_bias_std",
"init_ard_rel_unexplained_variance",
"enable_bias_factors",
"enable_explicit_gc_bias_modeling",
"disable_bias_factors_in_active_class",
"num_gc_bins",
"gc_curve_sd"
}

hidden_calling_args = {
"p_active",
"class_coherence_length"
}

# add tool-specific args
group = parser.add_argument_group(title="Required arguments")

Expand Down Expand Up @@ -79,26 +96,13 @@
# Note: we are hiding parameters that are either set by the model or are irrelevant to the case calling task
gcnvkernel.DenoisingModelConfig.expose_args(
parser,
hide={
"--max_bias_factors",
"--psi_t_scale",
"--log_mean_bias_std",
"--init_ard_rel_unexplained_variance",
"--enable_bias_factors",
"--enable_explicit_gc_bias_modeling",
"--disable_bias_factors_in_active_class",
"--num_gc_bins",
"--gc_curve_sd",
})
hide={"--" + arg for arg in hidden_denoising_args})

# add calling config args
# Note: we are hiding parameters that are either set by the model or are irrelevant to the case calling task
gcnvkernel.CopyNumberCallingConfig.expose_args(
parser,
hide={
'--p_active',
'--class_coherence_length'
})
hide={"--" + arg for arg in hidden_calling_args})

# override some inference parameters
gcnvkernel.HybridInferenceParameters.expose_args(parser)
Expand All @@ -109,24 +113,16 @@ def update_args_dict_from_saved_model(input_model_path: str,
logging.info("Loading denoising model configuration from the provided model...")
with open(os.path.join(input_model_path, "denoising_config.json"), 'r') as fp:
loaded_denoising_config_dict = json.load(fp)

# boolean flags
_args_dict['enable_bias_factors'] = \
loaded_denoising_config_dict['enable_bias_factors']
_args_dict['enable_explicit_gc_bias_modeling'] = \
loaded_denoising_config_dict['enable_explicit_gc_bias_modeling']
_args_dict['disable_bias_factors_in_active_class'] = \
loaded_denoising_config_dict['disable_bias_factors_in_active_class']

# bias factor related
_args_dict['max_bias_factors'] = \
loaded_denoising_config_dict['max_bias_factors']

# gc-related
_args_dict['num_gc_bins'] = \
loaded_denoising_config_dict['num_gc_bins']
_args_dict['gc_curve_sd'] = \
loaded_denoising_config_dict['gc_curve_sd']
with open(os.path.join(input_model_path, "calling_config.json"), 'r') as fp:
loaded_calling_config_dict = json.load(fp)

# load arguments from the model denoising config that are hidden by the tool
for arg in hidden_denoising_args:
_args_dict[arg] = \
loaded_denoising_config_dict[arg]
for arg in hidden_calling_args:
_args_dict[arg] = \
loaded_calling_config_dict[arg]

logging.info("- bias factors enabled: "
+ repr(_args_dict['enable_bias_factors']))
Expand Down