Skip to content

Commit

Permalink
Merge pull request #14 from js2264/master
Browse files Browse the repository at this point in the history
Improve install stability
  • Loading branch information
js2264 authored Jan 20, 2024
2 parents 153b1d7 + 0b53c09 commit 703adee
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 79 deletions.
9 changes: 9 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
coverage:
status:
project:
default:
target: auto
threshold: 1%
if_ci_failed: ignore #success, failure, error, ignore
informational: false
only_pulls: false
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
*
Dockerfile*
.dockerignore
!metator/*
!setup.py
!setup.cfg
!metator.yaml
!requirements.txt
!MANIFEST.in
!README.md
!external
!external
21 changes: 9 additions & 12 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9']
python-version: ['3.8', '3.9', '3.10']

steps:

- uses: actions/checkout@v3



- name: Install Conda environment from metator.yaml
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: metator.yaml
extra-specs: |
python=${{ matrix.python-version }}
- name: Load apt packages
run: |
sudo apt-get update
Expand All @@ -52,13 +43,19 @@ jobs:
./gradlew build
cd ..
- name: Install Conda environment from metator.yaml
uses: mamba-org/setup-micromamba@v1
with:
environment-file: metator.yaml
generate-run-shell: true
create-args: >-
python=${{ matrix.python-version }}
- name: Test with pytest
run: |
micromamba activate metator
export LOUVAIN_PATH=external/gen-louvain
export LEIDEN_PATH=networkanalysis/build/libs/networkanalysis-1.2.0.jar
PWD=$(pwd)
export PATH="$PATH:$PWD/bwa:$PWD/pairix/bin/:$PWD/pairix/util:$PWD/pairix/util/bam2pairs:/root/.local/bin"
pytest --pylint --pylint-error-types=EF --pylint-rcfile=.pylintrc --doctest-modules metator
pytest --cov=metator
codecov
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ tests_data/assembly.fa.fxi
tests_data/outdir/cam.pdf
nohup.out
codecov*
!.codecov.yml

# vscode
.vscode
Expand Down
59 changes: 19 additions & 40 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,60 +1,39 @@
# syntax=docker/dockerfile:1

FROM adoptopenjdk/openjdk12
FROM mambaorg/micromamba:latest

LABEL Name=metator Version=1.3.2

WORKDIR /app
COPY ./ /app
COPY --chown=$MAMBA_USER:$MAMBA_USER . ./

# Install 3rd party packages
RUN \
apt-get update && \
apt-get install -y --no-install-recommends git make g++ curl

# Install miniconda to /miniconda
RUN curl -LO http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
RUN bash Miniconda3-latest-Linux-x86_64.sh -p /miniconda -b
RUN rm Miniconda3-latest-Linux-x86_64.sh
ENV PATH=/miniconda/bin:${PATH}
RUN conda update -y conda
RUN conda config --add channels bioconda

# # Get 3rd party package
RUN conda install -c conda-forge -y python=3.8\
pip \
bowtie2 \
samtools \
pairix \
checkm-genome && conda clean -afy

# Install bwa
RUN git clone https://github.com/lh3/bwa.git && \
cd bwa && \
make &&\
cd /app
ENV PATH="$PATH:/app/bwa"
USER root
RUN apt update && \
apt install -y --no-install-recommends git make g++ curl default-jre default-jdk zlib1g-dev

# Install Louvain
RUN cd /app/external && \
RUN cd ./external && \
tar -xzf louvain-generic.tar.gz && \
cd gen-louvain && \
make && \
cd /app
ENV LOUVAIN_PATH=/app/external/gen-louvain
cd ../
ENV LOUVAIN_PATH=./external/gen-louvain

# Install Leiden through Network analysis repo
RUN git clone https://github.com/vtraag/networkanalysis.git && \
cd /app/networkanalysis && \
cd ./networkanalysis && \
./gradlew build && \
cd /app
ENV LEIDEN_PATH=/app/networkanalysis/build/libs/networkanalysis-1.2.0.jar
cd ../
ENV LEIDEN_PATH=$(pwd)/networkanalysis/build/libs/networkanalysis-1.2.0.jar


# Install python dependencies
RUN pip3 install -Ur requirements.txt
## Install dependencies
USER mambauser
RUN micromamba install -y -n base --file metator.yaml && \
micromamba install -y -n base pip && \
micromamba clean --all --yes

# Install metator
RUN pip3 install .
RUN micromamba run -n base python3 -m pip install -e .

ENTRYPOINT ["metator"]
WORKDIR /home/mambauser/
ENTRYPOINT [ "/bin/bash" ]
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,45 @@ Metagenomic Tridimensional Organisation-based Reassembly - A set of scripts that

## Table of contents

* [Installation](#Installation)
* [Requirements](#Requirements)
* [Using pip](#Using-pip)
* [Using docker container](#Using-docker-container)
* [Usage](#Usage)
* [Output files](#Output-files)
* [References](#References)
* [Contact](#Contact)
1. [MetaTOR](#metator)
1. [Table of contents](#table-of-contents)
2. [Installation](#installation)
1. [Requirements](#requirements)
2. [Using pip](#using-pip)
3. [Using conda](#using-conda)
4. [Louvain or Leiden dependency](#louvain-or-leiden-dependency)
5. [Using docker container](#using-docker-container)
3. [Usage](#usage)
4. [Output files](#output-files)
5. [References](#references)
6. [Contact](#contact)
1. [Authors](#authors)
2. [Research lab](#research-lab)

## Installation

### Requirements

* Python 3.6 or later is required.
* The following librairies are required but will be automatically installed with the pip installation: `numpy`, `scipy`, `sklearn`, `pandas`, `docopt`, `networkx` `biopython` `pyfastx` and `pysam`.
* Python `3.8` to `3.10` or later is required.
* The following librairies are required but will be automatically installed with the pip installation: `numpy`, `scipy`, `sklearn`, `pandas`, `docopt`, `networkx` `biopython` `pyfastx`, `pysam`, `micomplete` and `pairix`.
* The following software should be installed separately if you used the pip installation:
* [bowtie2](http://bowtie-bio.sourceforge.net/bowtie2/index.shtml)
* [samtools](http://www.htslib.org/)
* [louvain](https://sourceforge.net/projects/louvain/) (original
implementation).
* [networkanalysis](https://github.com/vtraag/networkanalysis) (not
necessary only if you want to use Leiden algorithm to partition the network)
* [micomplete](https://bitbucket.org/evolegiolab/micomplete/src/master/)
* [pairix](https://github.com/4dn-dcic/pairix) (not necessary if you do not use metator contact map)

### Using pip

```sh
pip3 install metator
pip3 install metator
```

or, to use the latest version:

```sh
pip3 install -e git+https://github.com/koszullab/metator.git@master#egg=metator
pip3 install -e git+https://github.com/koszullab/metator.git@master#egg=metator
```

### Using conda
Expand Down Expand Up @@ -85,13 +89,13 @@ export LEIDEN_PATH=/networkanalysis_repository_path/build/libs/networkanalysis-1
A dockerfile is also available if that is of interest. You may fetch the image by running the following:

```sh
docker pull koszullab/metator
docker pull koszullab/metator
```

## Usage

```sh
metator {network|partition|validation|pipeline} [parameters]
metator {network|partition|validation|pipeline} [parameters]
```

A metaTOR command takes the form `metator action --param1 arg1 --param2
Expand Down
13 changes: 6 additions & 7 deletions metator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dependencies:
- requests
- pip
- git
- biopython=1.80
- bowtie2=2.5.1
- bwa=0.7.17
- samtools=1.17
Expand All @@ -15,17 +16,15 @@ dependencies:
- pysam=0.21.0
- pairix=0.3.7
- pairtools=1.0.2
- pyfastx==0.8.4
- cooler==0.9.1
- pandas==1.5.3
- hicstuff
- pip:
- pyfastx==0.8.4
- micomplete==1.1.1
- cooler==0.9.1
- pandas==1.5.3
- git+https://github.com/koszullab/hicstuff.git
- metator
- pytest
- pylint
- codecov
- pytest-cov
- pylint
- pytest-pylint
- codecov

4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
biopython
biopython==1.80
cdlib
checkv
docopt
hicstuff
looseversion
micomplete
micomplete==1.1.1
networkx
numpy
pairtools
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
classifiers=CLASSIFIERS,
url=URL,
packages=find_packages(),
python_requires=">=3.6",
python_requires=">=3.8,<=3.10",
include_package_data=True,
long_description_content_type="text/markdown",
install_requires=REQUIREMENTS,
Expand Down

0 comments on commit 703adee

Please sign in to comment.