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

Update chemistry commands #174

Merged
merged 5 commits into from
Dec 30, 2024
Merged

Update chemistry commands #174

merged 5 commits into from
Dec 30, 2024

Conversation

an-altosian
Copy link
Contributor

I did the following things related to chemistry commands:

  1. update documentation
  2. update help messages
  3. fixed bugs

#[arg(long,
default_value = &DefaultParams::SKIPPING_STRATEGY,
value_parser = clap::builder::PossibleValuesParser::new(["permissive", "strict"]),
help_heading = "Piscem Mapping Options",
conflicts_with = "use_piscem")]
pub skipping_strategy: String,

/// determines the maximum cardinality equivalence class
/// d\Determines the maximum cardinality equivalence class
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is a typo, we just want "D", right? Not "d\D".

@@ -185,50 +185,49 @@ pub struct MapQuantOpts {
conflicts_with = "use_piscem")]
pub max_ec_card: u32,

/// in the first pass, consider only k-mers having <= --max-hit-occ hits.
/// In the first pass, consider only k-mers of a read having <= --max-hit-occ hits.
Copy link
Contributor

Choose a reason for hiding this comment

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

it's not all k-mers of a read. Perhaps "considers only collected and matched k-mers having"

#[arg(long,
default_value_t = DefaultParams::MAX_HIT_OCC,
help_heading = "Piscem Mapping Options",
conflicts_with = "use_piscem")]
pub max_hit_occ: u32,

/// if all k-mers have > --max-hit-occ hits, then make a second pass and consider k-mers
/// if all k-mers of a read have > --max-hit-occ hits, then make a second pass and consider k-mers
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above. "If all collected and matched k-mers have".

@@ -99,7 +99,7 @@ pub fn add_chemistry(

// check if the file already exists
if local_plist_path.is_file() {
info!("A content-equivalent permit list file already exists; will use the exising file.");
info!("Found a content-equivalent permit list file; Will use the existing file.");
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't capitalize after a ;, only a .

local_url.display(),
local_plist_path.display()
)
})?;
}
local_plist = Some(local_plist_name.display().to_string());
} else {
bail!("The local-url {} was provided, but no file could be found at that location. Cannot continue.", local_url.display());
bail!("The provided local path does not point to a file: {}; Cannot proceed.", local_url.display());
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, we needn't capitalize after a ;.

info!(
"A content-equivalent permit list file already exists; will use the exising file."
);
info!("Found a cached, content-equivalent permit list file; Will use the existing file.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.

name
);
}

if num_matched == 0 {
info!(
"no chemistry with name {} (or matching this as a regex) was found in the registry; nothing to remove",
"No chemistry with name \"{}\" (or matching this as a regex) was found in the registry; Nothing to remove.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't need capitalization after ';'

println!("{:#?}", cc);
if let Some(cc) = get_single_custom_chem_from_file(&chem_p, &name)? {
println!("=================");
cc.print();
Copy link
Contributor

Choose a reason for hiding this comment

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

Will refactor this to implement Display, I think.

if refresh_opts.chemistries.is_empty() {
bail!("The list of chemistries to fetch was empty; nothing to do!");
if fetch_opts.name.is_empty() {
bail!("The list of chemistries to fetch was empty; Nothing to do!");
Copy link
Contributor

Choose a reason for hiding this comment

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

No capitalization after ;. Fetch makes no sense with no arguments, should probably validate the length of the vector in the argument parser.

}

// check if the chemistry file is absent altogether
// if so, then download it
// @rob-p: why don't we just download the file if it's missing?
Copy link
Contributor

Choose a reason for hiding this comment

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

Because we have the refresh command for that. I know we haven't always followed this principle (but it's time for a New Year's resolution anyway ;P) --- as much as possible, a function should do just one thing. Minimizing side-effects is good.

let chem_path = af_home.join(CHEMISTRIES_PATH);
if !chem_path.is_file() {
bail!(
"The chemistry file was missing from {}; nothing to download.",
"The chemistry file is missing from {}; Nothing to download.",
Copy link
Contributor

Choose a reason for hiding this comment

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

No cap after ;

Copy link
Contributor

@rob-p rob-p left a comment

Choose a reason for hiding this comment

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

Will merge this and make the commented changes.

@rob-p rob-p merged commit 10fee7c into COMBINE-lab:dev Dec 30, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants