xpclrs 1.0.1

A high-performance rust implementation of the XP-CLR method.
Documentation
name: Rust

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        build: [
          linux_x86,
          linux_arm,
          macos_arm64,
          macos_x86_64
        ]
        include:
          - build: macos_arm64
            os: macos-latest
          - build: macos_x86_64
            os: macos-15-intel
          - build: linux_x86
            os: ubuntu-latest
          - build: linux_arm
            os: ubuntu-24.04-arm
    steps:
    - uses: actions/checkout@v4

    - name: Linux X86 deps
      if: matrix.os == 'ubuntu-latest'
      run: sudo apt-get update && sudo apt-get install libopenblas-dev

    - name: Linux ARM deps
      if: matrix.os == 'ubuntu-24.04-arm'
      run: sudo apt-get update && sudo apt-get install libopenblas-dev

    - name: Build
      run: cargo build --verbose

    - name: Run tests
      run: cargo test --verbose

    - name: Run clippy
      run: cargo clippy -- -Dwarnings

    - name: Release
      run: cargo build --release

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

  # Test the binaries
  exe:
    needs: build  # This job depends on the build job
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      # Download the Ubuntu artifact from the build job
      - name: Download Binaries
        uses: actions/download-artifact@v4
        with:
          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 (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
          ./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