Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
8188495
rust reimplementation working
cmatKhan Nov 23, 2024
003520a
optimization refactored
cmatKhan Nov 23, 2024
4461365
version 2.0.0 draft for release ready
cmatKhan Nov 28, 2024
fb93804
adjusting readme
cmatKhan Nov 28, 2024
5ec1a57
updating readme with links
cmatKhan Nov 28, 2024
179b238
updating changelog
cmatKhan Nov 28, 2024
f554122
updating headline
cmatKhan Nov 28, 2024
2d46221
adding build instructions
cmatKhan Nov 28, 2024
edd6bca
fixing a typo in readme
cmatKhan Nov 28, 2024
5c44bb1
adding .md to license
cmatKhan Nov 28, 2024
dbcceaa
removing license
cmatKhan Nov 28, 2024
dfd5fca
Create LICENSE
cmatKhan Nov 28, 2024
e4d0067
adding name to license
cmatKhan Nov 28, 2024
5b75653
adding pre-commit
cmatKhan Nov 30, 2024
3141497
adidng verbose to precommit
cmatKhan Nov 30, 2024
7c0dfe3
adjusting precommit
cmatKhan Nov 30, 2024
7f2ea90
linting with clippy
cmatKhan Nov 30, 2024
68050c0
continuing to lint with clippy
cmatKhan Nov 30, 2024
7461538
addressing clippy
cmatKhan Nov 30, 2024
8cc66ee
addressing clippy warnings
cmatKhan Nov 30, 2024
82b8d23
testing precommit
cmatKhan Nov 30, 2024
200bcea
still addressing clippy
cmatKhan Nov 30, 2024
f0e06b0
removing old main
cmatKhan Nov 30, 2024
35bd86c
testing CI
cmatKhan Nov 30, 2024
d741090
testing ci linting
cmatKhan Nov 30, 2024
7add022
fixing linting CI
cmatKhan Nov 30, 2024
6adc660
debugging linting ci
cmatKhan Nov 30, 2024
bdf5e71
adding a release CI
cmatKhan Nov 30, 2024
667f991
troubleshooting ci
cmatKhan Nov 30, 2024
916319e
debugging ci
cmatKhan Nov 30, 2024
587a065
debugging ci
cmatKhan Nov 30, 2024
29ee93f
debugging ci
cmatKhan Nov 30, 2024
43f795d
debugging ci
cmatKhan Nov 30, 2024
c1b84b5
debugging ci
cmatKhan Nov 30, 2024
94c69d7
debugging ci
cmatKhan Nov 30, 2024
6a3d456
adding gh token env var
cmatKhan Nov 30, 2024
c621eb3
debugging ci
cmatKhan Nov 30, 2024
cda0487
ci confirmed
cmatKhan Nov 30, 2024
39107fc
ready for pushing to dev
cmatKhan Nov 30, 2024
497c2bf
Merge pull request #1 from cmatKhan/rust_implementation
cmatKhan Nov 30, 2024
26f5690
revising readme installation instructions
cmatKhan Nov 30, 2024
87cd71b
Merge pull request #2 from cmatKhan/update_readme
cmatKhan Nov 30, 2024
2d2f36f
Update README.md
cmatKhan Nov 30, 2024
f42579b
Merge pull request #3 from BrentLab/cmatKhan-patch-1
cmatKhan Nov 30, 2024
eff7789
Update README.md
cmatKhan Nov 30, 2024
12c5f87
Merge pull request #4 from BrentLab/cmatKhan-patch-1
cmatKhan Nov 30, 2024
dec0619
adding status badges
cmatKhan Nov 30, 2024
fd166f6
Merge pull request #5 from BrentLab/cmatKhan-patch-1
cmatKhan Nov 30, 2024
75aa584
fixing threshold formula rendering
cmatKhan Dec 4, 2024
8f7e3e4
Merge pull request #6 from BrentLab/cmatKhan-patch-1
cmatKhan Dec 4, 2024
5ace98a
Update README.md
cmatKhan Dec 4, 2024
b92188c
Merge pull request #7 from BrentLab/cmatKhan-patch-1
cmatKhan Dec 4, 2024
38ecc79
changinasymptotic runtime println to eprintln
cmatKhan Dec 2, 2024
f6de002
fixing links in readme
cmatKhan Dec 4, 2024
a7f45f6
further refinements to the README
cmatKhan Dec 4, 2024
7618a51
Merge pull request #8 from cmatKhan/yeast_debugs
cmatKhan Dec 4, 2024
3226e0e
revising readme installation instructions
cmatKhan Nov 30, 2024
dc6551e
Update README.md
cmatKhan Nov 30, 2024
0c5de47
Update README.md
cmatKhan Nov 30, 2024
80711db
adding status badges
cmatKhan Nov 30, 2024
c46c8d0
fixing threshold formula rendering
cmatKhan Dec 4, 2024
5a6fe3e
Update README.md
cmatKhan Dec 4, 2024
d03258f
changinasymptotic runtime println to eprintln
cmatKhan Dec 2, 2024
5740ed7
fixing links in readme
cmatKhan Dec 4, 2024
8806b3a
further refinements to the README
cmatKhan Dec 4, 2024
dd0ddbd
Merge branch 'dev' of https://github.com/cmatKhan/Dual_Threshold_Opti…
cmatKhan Dec 4, 2024
5a7fc2a
Merge pull request #9 from cmatKhan/dev
cmatKhan Dec 4, 2024
315a65d
addressing linting
cmatKhan Dec 4, 2024
3255625
Merge branch 'dev' of https://github.com/BrentLab/Dual_Threshold_Opti…
cmatKhan Dec 4, 2024
61a6038
adding cachebusting to crates badge
cmatKhan Dec 4, 2024
5d11063
adding documentation link to library section of readme
cmatKhan Dec 4, 2024
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
39 changes: 39 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Rust Linting and Formatting

on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
jobs:
lint:
runs-on: ubuntu-latest

steps:
# Step 1: Check out the code from the repository
- name: Check out code
uses: actions/checkout@v3

# Step 2: Install OpenMPI
- name: install openmpi
run: sudo apt-get update && sudo apt-get install -y libopenmpi-dev openmpi-bin

# Step 3: Install Rust using rustup
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
override: true

# Step 4: Run cargo fmt to check formatting
- name: Run cargo fmt
run: cargo fmt --all -- --check

# Step 5: Run cargo clippy to check for lints
- name: Run cargo clippy
run: cargo clippy --all-targets --all-features -- -D warnings
112 changes: 112 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Rust Release

on:
push:
branches:
- main

env:
GH_TOKEN: ${{ github.token }}

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
feature: ["default", mpi]

steps:
# Step 1: Checkout the code
- name: Checkout
uses: actions/checkout@v3

# Step 2: Install OpenMPI (for mpi feature only)
- name: Install OpenMPI
if: matrix.feature == 'mpi' && runner.os == 'Linux'
run: |
sudo apt-get update \
&& sudo apt-get install -y libopenmpi-dev openmpi-bin

# Step 3: Cache Rust dependencies
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: target
key: ${{ runner.OS }}-${{ matrix.feature }}-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.OS }}-${{ matrix.feature }}-build-

# Step 4: Install Rust toolchain
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: beta
default: true
override: true
target: ${{ matrix.os == 'macos-latest' && 'x86_64-apple-darwin' || matrix.os == 'windows-latest' && 'x86_64-pc-windows-msvc' || '' }}

# Step 5: Build the binary with features
- name: Build
shell: bash
run: |
if [ "${{ matrix.feature }}" == "mpi" ] && [ "${{ matrix.os }}" != "ubuntu-latest" ]; then
echo "Skipping mpi build for non-Linux systems"
exit 0
fi
cargo build --release ${{ matrix.feature == 'mpi' && '--features mpi' || '' }}
mv target/release/dual_threshold_optimization \
target/release/dual_threshold_optimization-${{ matrix.os }}-${{ matrix.feature }}${{ runner.os == 'Windows' && '.exe' || '' }}

# Step 6: Upload artifact
- name: Upload artifact
uses: actions/upload-artifact@v3
if: success()
with:
name: dual_threshold_optimization-${{ matrix.os }}-${{ matrix.feature }}
path: target/release/dual_threshold_optimization-${{ matrix.os }}-${{ matrix.feature }}${{ runner.os == 'Windows' && '.exe' || '' }}

release:
runs-on: ubuntu-latest
needs: [build]

steps:
# Step 1: Checkout the code
- name: Checkout
uses: actions/checkout@v3

# Step 2: Extract version from Cargo.toml
- name: Get version from Cargo.toml
id: version
run: |
VERSION=$(grep '^version =' Cargo.toml | head -n 1 | cut -d '"' -f 2)
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_ENV

# Step 3: Create a release
- name: Create GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ env.version }}"
release_name: "${{ env.version }}"
draft: false
prerelease: false

# Step 4: Download artifacts from build jobs
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: binaries

# Step 5: Upload binaries to the release
- name: Upload binaries to release
run: |
for file in binaries/*/*; do
if [ -f "$file" ]; then
echo "Uploading $file"
gh release upload "v${{ env.version }}" "$file" --clobber
fi
done

47 changes: 47 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Rust Tests

on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev

jobs:
test:
name: Run Cargo Tests
runs-on: ubuntu-latest

steps:
# Checkout the code from the repository
- name: Checkout Code
uses: actions/checkout@v3

# Install OpenMPI
- name: Install OpenMPI
run: sudo apt-get update && sudo apt-get install -y libopenmpi-dev openmpi-bin

# Set up Rust
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

# Cache Cargo dependencies
- name: Cache Cargo Dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

# Run cargo test
- name: Run Tests
run: cargo test --all --verbose
42 changes: 28 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
Code/*.pyc
Code/tmp/
Job_scripts
ResourcesDataframes
ExtraFiles/
Notebooks/
Output/
PaperFigures/
PaperSupplementals/
Patel*/
archive/
venv/
.ipynb_checkpoints/
__pycache__
# vscode
.vscode/

# ignore local files
/tmp

# Featurerated by Cargo
# will have compiled files and executables
debug/
target/
target-debug/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
# Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# RustRover
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
repos:
- repo: local
hooks:
- id: rust-linting
name: Rust linting
description: Run cargo fmt on files included in the commit. rustfmt should be installed before-hand.
entry: cargo fmt --all --
pass_filenames: true
types: [file, rust]
language: system
- id: rust-clippy
name: Rust clippy
description: Run cargo clippy on files included in the commit. clippy should be installed before-hand.
entry: cargo clippy --all-targets --all-features -- -Dclippy::all
pass_filenames: false
types: [file, rust]
language: system
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 2.0.1

This only addresses a build error in the crates.io. Previously, I had tried to include
a header to render LaTeX. But, that proved error prone. It is removed in favor of html
in the README. I added a line in the Cargo.toml that should build the docs on crates.io
with the --feature mpi, so that all functions, including the mpi functions, have
documentation generated. Finally, I added documentation to `optimize()`.

No code changes were made from 2.0.0.

## 2.0.0

This is a complete re-write in Rust. In addition to changing the language, the
the following modifications to the algorithm have been made:

1. The heart of this algorithm is $O(n^2)$. In order to approximate the null distribution,
this $O(n^2)$ operation is performed n times. These permutations are now parallelized and
will scale linearly down to the time it takes to run a single search through the
threshold space. Run time on human data with ~16k genes on 30 CPU is less than an hour
now, and uses less than 3G space.
1. The cmd line input has been greatly simplified. This additionally represents a
significant change to the protocol:
- Previously, while in the documentation the operation was described as 'ranking',
it would be more appropriate to call it sorting or ordering. Ties were not
addressed. In version 2.0.0, we now expect that the input is a ranked list where
the first column is the feature identifier, and the second column is the rank. It
is up to the user to appropriately rank their data. Examples and recommendations
are provided in the documentation.
1. There are messages printed to stderr when there is more than one set of thresholds
with the same minimum p-value and the same intersect size. This occurs due to the
nature of the hypergeometric p-value.

### Added

1. `profiling/` stores runtime and memory usage information from
[hyperfine](https://github.com/sharkdp/hyperfine) and
[heaptrack](https://github.com/KDE/heaptrack) respectively
1. github actions CI has been added to run tests on pushes to `dev` and `main`
1. Semantic versioning and github releases have been added
1. The package is distributed through crates.io and bioconda
1. Docstrings with examples and module level documentation
1. tests
1. an MPI implementation to parallelize across multiple machines

## 1.0.0 -- Initial release

This version was written by [Yiming Kang](https://github.com/yiming-kang) and is the
version which was used to produce the results in
[Dual threshold optimization and network inference reveal convergent evidence from TF binding locations and TF perturbation responses](https://doi.org/10.1101/gr.259655.119)
Loading
Loading