Skip to content

Commit

Permalink
update dist, update deps, reorganize help menu, add defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Patro committed Feb 16, 2024
1 parent 45d6e69 commit c2193a9
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 55 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
# we specify bash to get pipefail; it guards against the `curl` command
# failing. otherwise `sh` won't catch that `curl` returned non-0
shell: bash
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.9.0/cargo-dist-installer.sh | sh"
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.10.0/cargo-dist-installer.sh | sh"
# sure would be cool if github gave us proper conditionals...
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
# functionality based on whether this is a pull_request, and whether it's from a fork.
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
with:
submodules: recursive
- name: Install cargo-dist
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.9.0/cargo-dist-installer.sh | sh"
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.10.0/cargo-dist-installer.sh | sh"
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
- name: Fetch local artifacts
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:
with:
submodules: recursive
- name: Install cargo-dist
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.9.0/cargo-dist-installer.sh | sh"
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.10.0/cargo-dist-installer.sh | sh"
# Fetch artifacts from scratch-storage
- name: Fetch artifacts
uses: actions/download-artifact@v4
Expand Down
40 changes: 20 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "piscem"
version = "0.7.2"
version = "0.7.3"
edition = "2021"
build = "build.rs"
repository = "https://github.com/COMBINE-lab/piscem"
Expand All @@ -13,7 +13,7 @@ cmake = "0.1"
[dependencies]
num_cpus = "1.16.0"
anyhow = "1.0"
clap = { version = "4.4.18", features = ["cargo", "derive", "env", "wrap_help"] }
clap = { version = "4.5.1", features = ["cargo", "derive", "env", "wrap_help"] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", default-features = true, features = ["env-filter"] }
prepare_fasta = "0.1.0"
Expand All @@ -29,7 +29,7 @@ inherits = "release"
# Config for 'cargo dist'
[workspace.metadata.dist]
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
cargo-dist-version = "0.9.0"
cargo-dist-version = "0.10.0"
# The installers to generate for each app
installers = ["shell"]
# Target platforms to build apps for (Rust target-triple syntax)
Expand Down
10 changes: 10 additions & 0 deletions clean_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

echo "cleaning external dependency directories of cuttlefish and piscem-cpp."
rm -fr ${SCRIPT_DIR}/cuttlefish/external/*
rm -fr ${SCRIPT_DIR}/piscem-cpp/external/zlib-cloudflare

echo "invoking cargo clean"
cargo clean --target-dir ${SCRIPT_DIR}/target
14 changes: 7 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::io;
use std::os::raw::{c_char, c_int};
use std::path::PathBuf;

use prepare_fasta;
use anyhow::{bail, Result};
use clap::{Parser, Subcommand};
use tracing::{error, info, warn, Level};
Expand Down Expand Up @@ -175,12 +174,13 @@ fn main() -> Result<(), anyhow::Error> {

if let Some(seqs) = ref_seqs {
if !seqs.is_empty() {
let out_stem = PathBuf::from(output.as_path().to_string_lossy().into_owned() + ".sigs");
let configs = prepare_fasta::RecordParseConfig{
input: seqs.clone(),
output_stem: out_stem,
polya_clip_length: None
};
let out_stem =
PathBuf::from(output.as_path().to_string_lossy().into_owned() + ".sigs");
let configs = prepare_fasta::RecordParseConfig {
input: seqs.clone(),
output_stem: out_stem,
polya_clip_length: None,
};
info!("Computing and recording reference signatures...");
prepare_fasta::parse_records(configs)?;
info!("done.");
Expand Down
89 changes: 67 additions & 22 deletions src/piscem_commands.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::{bail, Result};
use anyhow::{anyhow, bail, Result};
use clap::{ArgGroup, Args};
use std::ffi::CString;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -30,6 +30,19 @@ pub trait AsArgv {
fn as_argv(&self) -> Result<Vec<CString>>;
}

fn klen_is_good(s: &str) -> Result<usize> {
let k: usize = s
.parse()
.map_err(|_| anyhow!("`{s}` can't be parsed as a number"))?;
if k > 31 {
bail!("klen = {k} must be <= 31");
} else if (k & 1) == 0 {
bail!("klen = {k} must be odd");
} else {
Ok(k)
}
}

#[derive(Args, Clone, Debug)]
#[command(arg_required_else_help = true)]
#[command(group(
Expand All @@ -39,28 +52,33 @@ pub trait AsArgv {
))]
pub(crate) struct BuildOpts {
/// ',' separated list of reference FASTA files
#[arg(short = 's', long, value_delimiter = ',', required = true)]
#[arg(short = 's', long, help_heading = "Input", value_delimiter = ',')]
pub ref_seqs: Option<Vec<String>>,

/// ',' separated list of files (each listing input FASTA files)
#[arg(short = 'l', long, value_delimiter = ',', required = true)]
#[arg(short = 'l', long, help_heading = "Input", value_delimiter = ',')]
pub ref_lists: Option<Vec<String>>,

/// ',' separated list of directories (all FASTA files in each directory will be indexed,
/// but not recursively).
#[arg(short = 'd', long, value_delimiter = ',', required = true)]
#[arg(short = 'd', long, help_heading = "Input", value_delimiter = ',')]
pub ref_dirs: Option<Vec<String>>,

/// length of k-mer to use
#[arg(short, long)]
/// length of k-mer to use, must be <= 31 and odd
#[arg(short, long, help_heading = "Index Construction Parameters", default_value_t = 31, value_parser = klen_is_good)]
pub klen: usize,

/// length of minimizer to use
#[arg(short, long)]
/// length of minimizer to use; must be < `klen`
#[arg(
short,
long,
help_heading = "Index Construction Parameters",
default_value_t = 19
)]
pub mlen: usize,

/// number of threads to use
#[arg(short, long)]
#[arg(short, long, help_heading = "Index Construction Parameters")]
pub threads: usize,

/// output file stem
Expand All @@ -69,50 +87,65 @@ pub(crate) struct BuildOpts {

/// retain the reduced format GFA files produced by cuttlefish that
/// describe the reference cDBG (the default is to remove these).
#[arg(long)]
#[arg(long, help_heading = "Indexing Details")]
pub keep_intermediate_dbg: bool,

/// working directory where temporary files should be placed.
#[arg(short = 'w', long, default_value_os_t = PathBuf::from("."))]
#[arg(short = 'w', long, help_heading = "Indexing Details", default_value_os_t = PathBuf::from("./workdir.noindex"))]
pub work_dir: PathBuf,

/// overwite an existing index if the output path is the same.
#[arg(long)]
#[arg(long, help_heading = "Indexing Details")]
pub overwrite: bool,

/// skip the construction of the equivalence class lookup table
/// when building the index (not recommended).
#[arg(long)]
#[arg(long, help_heading = "Index Construction Parameters")]
pub no_ec_table: bool,

/// path to (optional) ',' sparated list of decoy sequences used to insert poison
/// k-mer information into the index.
#[arg(long, value_delimiter = ',')]
pub decoy_paths: Option<Vec<PathBuf>>,


/// index construction seed (seed value passed to SSHash index construction; useful if empty
/// buckets occur).
#[arg(long = "seed", default_value_t = 1)]
#[arg(
long = "seed",
help_heading = "Index Construction Parameters",
default_value_t = 1
)]
pub seed: u64,
}

#[derive(Args, Clone, Debug)]
pub(crate) struct MapSCOpts {
/// input index prefix
#[arg(short, long)]
#[arg(short, long, help_heading = "Input")]
pub index: String,

/// geometry of barcode, umi and read
#[arg(short, long)]
pub geometry: String,

/// path to list of read 1 files
#[arg(short = '1', long, value_delimiter = ',', required = true)]
#[arg(
short = '1',
long,
help_heading = "Input",
value_delimiter = ',',
required = true
)]
pub read1: Vec<String>,

/// path to list of read 2 files
#[arg(short = '2', long, value_delimiter = ',', required = true)]
#[arg(
short = '2',
long,
help_heading = "Input",
value_delimiter = ',',
required = true
)]
pub read2: Vec<String>,

/// number of threads to use
Expand Down Expand Up @@ -178,19 +211,31 @@ pub(crate) struct MapSCOpts {
))]
pub(crate) struct MapBulkOpts {
/// input index prefix
#[arg(short, long)]
#[arg(short, long, help_heading = "Input")]
pub index: String,

/// path to list of read 1 files
#[arg(short = '1', long, value_delimiter = ',', requires = "read2")]
#[arg(
short = '1',
long,
help_heading = "Input",
value_delimiter = ',',
requires = "read2"
)]
pub read1: Option<Vec<String>>,

/// path to list of read 2 files
#[arg(short = '2', long, value_delimiter = ',', requires = "read1")]
#[arg(
short = '2',
long,
help_heading = "Input",
value_delimiter = ',',
requires = "read1"
)]
pub read2: Option<Vec<String>>,

/// path to list of read unpaired read files
#[arg(short = 'r', long, value_delimiter = ',', conflicts_with_all = ["read1", "read2"])]
#[arg(short = 'r', long, help_heading = "Input", value_delimiter = ',', conflicts_with_all = ["read1", "read2"])]
pub reads: Option<Vec<String>>,

/// number of threads to use
Expand Down

0 comments on commit c2193a9

Please sign in to comment.