Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5f5d738
Instate phase variable once
RenzoTale88 Jan 27, 2026
e1fae11
Shave one second
RenzoTale88 Jan 27, 2026
5ed85fb
Some small tweaks
RenzoTale88 Jan 28, 2026
31f514d
Tweaks
RenzoTale88 Jan 28, 2026
2aa8f7b
Tidy-up code
RenzoTale88 Jan 29, 2026
9f8a745
Attempt compiling in CI
RenzoTale88 Jan 29, 2026
49770cc
Drop bed/bim/fam support for now
RenzoTale88 Jan 29, 2026
25038cb
Update version
RenzoTale88 Jan 29, 2026
ef7e129
Bop
RenzoTale88 Jan 29, 2026
d115a3e
Minor tweaks
RenzoTale88 Jan 29, 2026
9428fcc
Add plink support
RenzoTale88 Jan 30, 2026
942347d
Add dockerfile for xpclrs
RenzoTale88 Jan 30, 2026
03eff5f
Minimal docker image
RenzoTale88 Jan 30, 2026
856ba20
Fix tool breaking when no input lists match the samples
RenzoTale88 Jan 30, 2026
aec55f6
Update readme
RenzoTale88 Jan 30, 2026
b1062e1
Fix clippy warnings
RenzoTale88 Jan 31, 2026
cdec73b
Reformat code
RenzoTale88 Jan 31, 2026
b74593f
Docker push image
RenzoTale88 Jan 31, 2026
ee88c2b
Add crates.io release
RenzoTale88 Jan 31, 2026
0618f8b
Add description to manifest
RenzoTale88 Jan 31, 2026
dbb79e7
Add crates-style comments, make clippy happy and make the plink allel…
RenzoTale88 Jan 31, 2026
b108152
Use genetic position in the BIM file, if different from 0
RenzoTale88 Jan 31, 2026
606091a
Use genetic position pt2
RenzoTale88 Jan 31, 2026
e45db6d
Update readme
RenzoTale88 Jan 31, 2026
6fa16a7
Multiple simple suggestions
RenzoTale88 Feb 1, 2026
e7949dc
Last two copilot suggestions
RenzoTale88 Feb 1, 2026
e066102
Drop singletons too
RenzoTale88 Feb 1, 2026
701d2f9
Rustfmt
RenzoTale88 Feb 1, 2026
5f58aa2
Plink analysis now matching filtering
RenzoTale88 Feb 2, 2026
1b6372d
Add more test data and run more CI testings
RenzoTale88 Feb 2, 2026
ebd2f55
Save all compiled artifacts
RenzoTale88 Feb 2, 2026
cff0366
Attempt release all static compiled CI artifacts
RenzoTale88 Feb 2, 2026
723945c
Attempt fix
RenzoTale88 Feb 2, 2026
bab503e
Attempt fix pt2
RenzoTale88 Feb 2, 2026
109997f
Explore issue
RenzoTale88 Feb 2, 2026
f92eaf5
Finish fixing
RenzoTale88 Feb 2, 2026
eb06cc0
Plink automatically renames the chromosome from chr1 to 1
RenzoTale88 Feb 2, 2026
1887b02
Tweak to logging order
RenzoTale88 Feb 2, 2026
5ad07e4
Change category
RenzoTale88 Feb 2, 2026
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
28 changes: 28 additions & 0 deletions .github/workflows/crates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: crates
# This builds the docker image and pushes it to DockerHub
# Runs on nf-core repo releases and push event to 'dev' branch (PR merges)
on:
release:
types: [published]

jobs:
push_cratesio:
name: Push repository to crates.io
runs-on: ubuntu-latest
# Only run for the nf-core repo, for releases and merged PRs
if: ${{ github.repository == 'RenzoTale88/xpclrs' }}
steps:
- name: Check out pipeline code
uses: actions/checkout@v4

- name: Linux deps
run: sudo apt-get update && sudo apt-get install libopenblas-dev

- name: Build
run: cargo login --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

- name: Build
run: cargo publish --dry-run

- name: Publish xpclrs to crates.io
run: cargo publish
56 changes: 56 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Docker
# This builds the docker image and pushes it to DockerHub
# Runs on nf-core repo releases and push event to 'dev' branch (PR merges)
on:
push:
branches:
- main
release:
types: [published]

jobs:
push_dockerhub:
name: Push new Docker image to Docker Hub
runs-on: ubuntu-latest
# Only run for the nf-core repo, for releases and merged PRs
if: ${{ github.repository == 'RenzoTale88/xpclrs' }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKERHUB_PASS: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
steps:
- name: Check out pipeline code
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push Docker image (push event)
if: ${{ github.event_name == 'push' }}
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/xpclrs:latest
no-cache: true

- name: Build and push Docker image (release event)
if: ${{ github.event_name == 'release' }}
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKER_HUB_USERNAME }}/xpclrs:latest
${{ secrets.DOCKER_HUB_USERNAME }}/xpclrs:${{ github.event.release.tag_name }}
no-cache: true
55 changes: 38 additions & 17 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
fail-fast: false
matrix:
build: [
ubuntu,
ubuntu-arm,
linux_x86,
linux_arm,
macos_arm64,
macos_x86_64
]
Expand All @@ -26,9 +26,9 @@ jobs:
os: macos-latest
- build: macos_x86_64
os: macos-15-intel
- build: ubuntu
- build: linux_x86
os: ubuntu-latest
- build: ubuntu-arm
- build: linux_arm
os: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
Expand All @@ -53,14 +53,13 @@ jobs:
- name: Release
run: cargo build --release

# Upload the binaries from the ubuntu analysis
# Upload the binaries from each build
- name: Upload artifacts
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: binaries
path: target/release
retention-days: 0.5
name: xpclrs_${{ matrix.build }}
path: target/release/xpclrs
retention-days: 1

# Test the binaries
exe:
Expand All @@ -72,18 +71,40 @@ jobs:
- name: Download Binaries
uses: actions/download-artifact@v4
with:
name: binaries
name: xpclrs_linux_x86
path: ./bin/ # This will store the downloaded artifacts in ./bin
- name: Run help
run: |
ls ./bin/
chmod +x ./bin/xpclrs
./bin/xpclrs --help
- name: Run test
- name: Run test (VCF, unphased)
run: |
chmod +x ./bin/xpclrs
./bin/xpclrs --input test/test.vcf.gz --out test --samplesA test/samplesA.txt --samplesB test/samplesB.txt --chr chr1 -t 1
head test.chr1.xpclr
- name: Run test (VCF, phased)
run: |
chmod +x ./bin/xpclrs
./bin/xpclrs --input test/test.vcf.gz --out test --samplesA test/samplesA.txt --samplesB test/samplesB.txt --chr chr1 -t 1 --phased
head test.chr1.xpclr
- name: Run test (VCF, unphased, fast)
run: |
chmod +x ./bin/xpclrs
./bin/xpclrs --input test/test.vcf.gz --out test --samplesA test/samplesA.txt --samplesB test/samplesB.txt --chr chr1 -t 1 --fast
head test.chr1.xpclr
- name: Run test (VCF, phased, fast)
run: |
chmod +x ./bin/xpclrs
./bin/xpclrs --input test/test.vcf.gz --out test --samplesA test/samplesA.txt --samplesB test/samplesB.txt --chr chr1 -t 1 --phased --fast
head test.chr1.xpclr
- name: Run test (plink)
run: |
chmod +x ./bin/xpclrs
./bin/xpclrs --input test/plink --plink --out test --samplesA test/samplesA_plink.txt --samplesB test/samplesB_plink.txt --chr 1 -t 1
head test.chr1.xpclr
- name: Run test (plink, fast)
run: |
chmod +x ./bin/xpclrs
wget https://raw.githubusercontent.com/hardingnj/xpclr/refs/heads/master/fixture/samplesA.txt
wget https://raw.githubusercontent.com/hardingnj/xpclr/refs/heads/master/fixture/samplesB.txt
wget https://raw.githubusercontent.com/hardingnj/xpclr/refs/heads/master/fixture/small.vcf.gz
wget https://raw.githubusercontent.com/hardingnj/xpclr/refs/heads/master/fixture/small.vcf.gz.tbi
./bin/xpclrs --input small.vcf.gz --out test --samplesA samplesA.txt --samplesB samplesB.txt --chr 3L -t 1
cat test.3L.xpclr
./bin/xpclrs --input test/plink --plink --out test --samplesA test/samplesA_plink.txt --samplesB test/samplesB_plink.txt --chr 1 -t 1 --fast
head test.chr1.xpclr
2 changes: 1 addition & 1 deletion Cargo.lock

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

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
[package]
name = "xpclrs"
version = "0.1.0"
version = "1.0.0"
authors = ["Andrea Talenti"]
edition = "2021"
license = "MIT"
repository = "https://github.com/RenzoTale88/xpclrs"
readme = "README.md"
keywords = ["genome", "bioinformatics", "sequencing"]
categories = ["bioinformatics"]
keywords = ["genome", "bioinformatics", "sequencing", "selection"]
categories = ["science::bioinformatics"]
description = "A high-performance rust implementation of the XP-CLR method."

[dependencies]
anyhow = "1.0.98"
Expand Down
15 changes: 13 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Use the official NVIDIA CUDA image as the base image
FROM ubuntu:18.04
# Use an old ubuntu image to maximize compatibility with older systems relying on
# older libc versions
FROM ubuntu:18.04 AS build

# Copy source code
COPY . /xpclrs

# Set up the environment
ENV DEBIAN_FRONTEND=noninteractive
Expand All @@ -17,3 +21,10 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

# Add Cargo to PATH
ENV PATH="/root/.cargo/bin:${PATH}"

# Compile the tool, then declutter the image
WORKDIR /xpclrs
RUN /root/.cargo/bin/cargo build --release

FROM ubuntu:18.04 AS runtime
COPY --from=build /xpclrs/target/release/xpclrs /usr/local/bin/xpclrs
Comment thread
RenzoTale88 marked this conversation as resolved.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ xpclrs --help
## Input
The software requires the following mandatory options:
1. Input genotypes in VCF(.GZ)/BCF format with `-I-`/`--input`.
* PLINK binary files (BED/BIM/FAM) are also supported by providing the root of the file name with the same `-I`/`--input` option and adding the `--plink` flag..
* Loading in plink file is substantially faster than using the VCF format, but worth noticing that it can lead to different results due to the variants being coded as major/minor rather than REF/ALT (XP-CLR relies on allele frequencies).
2. The lists of individuals in each group (one individual per line) with `-A`/`--samplesA` and `-B`/`--samplesB`.
* PLINK samples are loaded as `FID_IID`. So if your sample in the FAM file is `POP1 SAMP1 0 0 0 -9`, the sample will be listed as `POP1_SAMP1` in the group of individuals.
3. The sequence to analyse with `-C`/`--chr`.

The VCF can optionally include a genetic distance key, that can be specified with the `--gdistkey [NAME]`. Alternatively, users can provide the recombination rate with the `-R`/`--rrate` option.
The VCF can optionally include a genetic distance key, that can be specified with the `--gdistkey [NAME]`. Alternatively, users can provide the recombination rate with the `-R`/`--rrate` option. For PLINK inputs, the software will automatically detect the presence of a genetic position in the dataset and use that; if the value is equal to 0, the script will compute the genetic position based on the physical position and the recombination rate. Ensure that there are not gaps in the genetic position (i.e. a 0 following a known genetic position).

The analysis can be further sped up using multithreading with the `--threads`/`-t` option, followed by the number of threads to use. If set to 0, the software will try to use all the threads available.

Expand Down
Loading