diff --git a/.github/workflows/comparison.yml b/.github/workflows/comparison.yml new file mode 100644 index 0000000..65f48fe --- /dev/null +++ b/.github/workflows/comparison.yml @@ -0,0 +1,28 @@ +name: Compare + +on: + push: + branches: + - main + pull_request: + +jobs: + crossmap: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: chainfiles + key: ${{ runner.os }}-chainfiles + - name: Update Rust + run: rustup update stable && rustup default stable + - name: Install CrossMap + run: pip install CrossMap + - uses: Swatinem/rust-cache@v2 + with: + workspaces: . + - run: | + mkdir -p chainfiles + cargo run --release --features=binaries -- -d chainfiles hg19ToHg38 -vvv | exit 0 + ls chainfiles/reference \ No newline at end of file diff --git a/src/bin/kitchen_sink.rs b/src/bin/kitchen_sink.rs index bf46063..7f41660 100644 --- a/src/bin/kitchen_sink.rs +++ b/src/bin/kitchen_sink.rs @@ -142,18 +142,18 @@ impl std::fmt::Display for LiftoverResult { // CrossMap execution //////////////////////////////////////////////////////////////////////////////////////// -/// A struct for working with `crossmap`. +/// A struct for working with `CrossMap`. struct CrossMap; impl CrossMap { - /// Ensures the `crossmap` is installed. + /// Ensures the `CrossMap` is installed. fn ensure_installed() -> Result<()> { - Command::new("crossmap") + Command::new("CrossMap") .arg("--version") .stdout(Stdio::piped()) .stderr(Stdio::piped()) .status() - .context("retrieving `crossmap`'s version") + .context("retrieving `CrossMap`'s version") .map(|_| ()) } @@ -181,7 +181,7 @@ impl CrossMap { let stderr = String::from_utf8_lossy(&output.stderr); for line in stderr.lines() { if !line.contains("[INFO]") { - panic!("`crossmap` returned something on stderr: {stderr}"); + panic!("`CrossMap` returned something on stderr: {stderr}"); } } } @@ -193,7 +193,7 @@ impl CrossMap { let parts = line.split("\t").collect::>(); assert!( parts.len() > 3, - "should always have at least four parts of a `crossmap` result line; found \ + "should always have at least four parts of a `CrossMap` result line; found \ `{line}`" ); @@ -221,7 +221,7 @@ impl CrossMap { LiftoverResult::Mapped(to) } - _ => unreachable!("cannot parse `crossmap` result: `{line}`"), + _ => unreachable!("cannot parse `CrossMap` result: `{line}`"), }; results.insert(from, to); @@ -333,7 +333,7 @@ impl WorkDirectory { self.0.join("reference") } - /// The input positions bed file to `crossmap`. + /// The input positions bed file to `CrossMap`. fn input_bed_file(&self) -> PathBuf { self.0.join("input.bed") } @@ -389,10 +389,10 @@ impl Deref for WorkDirectory { } //////////////////////////////////////////////////////////////////////////////////////// -// Comparsion between `chainfile` and `crossmap` +// Comparsion between `chainfile` and`CrossMap` //////////////////////////////////////////////////////////////////////////////////////// -/// A comparison of liftover results between `chainfile` and `crossmap`. +/// A comparison of liftover results between `chainfile` and `CrossMap`. #[derive(Clone, Debug)] struct Comparison { /// The original position. @@ -401,7 +401,7 @@ struct Comparison { /// The lifted position from `chainfile`. chainfile: LiftoverResult, - /// The lifted position from `crossmap`. + /// The lifted position from `CrossMap`. crossmap: LiftoverResult, } @@ -475,8 +475,8 @@ fn throw(args: &Args) -> Result<()> { info!("working directory: {}", work_dir.display()); - info!("crossmap: ensuring `crossmap` is installed"); - CrossMap::ensure_installed().context("ensuring `crossmap` is installed")?; + info!("crossmap: ensuring `CrossMap` is installed"); + CrossMap::ensure_installed().context("ensuring `CrossMap` is installed")?; let chain_file_path = work_dir .download_chain_file(&args.chain) @@ -510,7 +510,7 @@ fn throw(args: &Args) -> Result<()> { info!("crossmap: running liftover"); for (from, crossmap_result) in CrossMap::run_bed(&chain_file_path, &work_dir.input_bed_file()) - .context("getting the `crossmap` mappings")? + .context("getting the `CrossMap` mappings")? { let start = Coordinate::::new(from.contig.as_str(), Strand::Positive, from.start); @@ -570,7 +570,7 @@ fn throw(args: &Args) -> Result<()> { let matched_percent = (n_matches as f64 * 100.0) / total_comparisons as f64; println!( - "`chainfile` and `crossmap` matched in {matched_percent:.2}% of cases (n = {})", + "`chainfile` and `CrossMap` matched in {matched_percent:.2}% of cases (n = {})", total_comparisons );