Skip to content

Commit

Permalink
CI and dependencies managment (#20)
Browse files Browse the repository at this point in the history
* fix: list looseversion in dependencies

* fix: unpin biopython

* fix: raise python pin to 3.13

* fix: GC roudings for tests with GC/gc_fraction

* ci: add codecov back

* docs: update badges
  • Loading branch information
js2264 authored Feb 20, 2025
1 parent 8b5437e commit 5fd32e3
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ jobs:
run: |
ruff check . --select=E9,F63,F7,F82
pytest --cov --cov-report=xml
codecov
shell: micromamba-shell {0}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

[![PyPI version](https://badge.fury.io/py/metator.svg)](https://badge.fury.io/py/metator)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/metator.svg)
[![Build Status](https://github.com/koszullab/metator/actions/workflows/python-package.yml/badge.svg)](https://github.com/koszullab/metaTOR/actions)
[![Build Status](https://github.com/koszullab/metator/actions/workflows/ci.yml/badge.svg)](https://github.com/koszullab/metaTOR/actions)
[![codecov](https://codecov.io/gh/koszullab/metator/branch/master/graph/badge.svg)](https://codecov.io/gh/koszullab/metator)
[![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/koszullab/metator)](https://hub.docker.com/r/koszullab/metator)
<!-- [![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/koszullab/metator)](https://hub.docker.com/r/koszullab/metator) -->
[![Read the docs](https://readthedocs.org/projects/metator/badge)](https://metator.readthedocs.io)
[![License: GPLv3](https://img.shields.io/badge/License-GPL%203-0298c3.svg)](https://opensource.org/licenses/bo-3.0)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
Expand Down
5 changes: 3 additions & 2 deletions metator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ channels:
- bioconda
- defaults
dependencies:
- python<3.12
- python<3.13
- hicstuff
- networkx
- checkv
- biopython<=1.80
- biopython
- pysam
- pairtools
- pyfastx
Expand All @@ -18,6 +18,7 @@ dependencies:
- scikit-learn
- scipy
- seaborn
- looseversion
- bowtie2
- pairix
- bwa
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "metator"
version = "1.3.4"
description = "A pipeline for binning metagenomic datasets from metaHiC data."
readme = "README.md"
requires-python = ">=3.9,<3.12"
requires-python = ">=3.9,<3.13"
license = { text = "GNU General Public License v3 (GPLv3)" }

authors = [
Expand All @@ -34,7 +34,7 @@ dependencies = [
"hicstuff",
"networkx",
"checkv",
"biopython<=1.80",
"biopython",
"pysam",
"pairtools",
"pyfastx",
Expand All @@ -44,18 +44,17 @@ dependencies = [
"scikit-learn",
"scipy",
"seaborn",
"looseversion",
"micomplete"

# NON PIP DEPENDENCIES

#"bowtie2"
#"pairix"
#"bwa"
#"samtools"
#"prodigal"
#"hmmer"
#"gcc"
#"java-jdk"
#"openjdk"
]

[project.optional-dependencies]
Expand Down Expand Up @@ -90,6 +89,7 @@ docs = [
dev = [
"metator[test,docs]",
"hatch",
"hatchling",
"hatch-build-scripts",
"pre-commit",
"mypy",
Expand Down
14 changes: 12 additions & 2 deletions src/metator/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import csv
import numpy as np
import re
from packaging import version
import Bio
from Bio import SeqIO
from Bio import SeqUtils
from os.path import join, basename
Expand Down Expand Up @@ -294,10 +296,14 @@ def create_contig_data(assembly, nb_alignment=1, depth_file=None, enzyme=None):
line = depth.readline()
for contig in SeqIO.parse(assembly, "fasta"):
line = depth.readline().split("\t")
if version.parse(Bio.__version__) >= version.parse("1.80"):
gc_content = int(SeqUtils.gc_fraction(contig.seq) * 100 * 10**13) / 10**13
else:
gc_content = int(SeqUtils.GC(contig.seq) * 10**13) / 10**13
contig_data[contig.id] = {
"id": global_id,
"length": int(line[1]),
"GC": SeqUtils.gc_fraction(contig.seq)*100,
"GC": gc_content,
"hit": 0,
"coverage": float(line[2]),
"RS": (len(re.findall(pattern, str(contig.seq))) + 1)
Expand All @@ -312,10 +318,14 @@ def create_contig_data(assembly, nb_alignment=1, depth_file=None, enzyme=None):
global_id += 1
else:
for contig in SeqIO.parse(assembly, "fasta"):
if version.parse(Bio.__version__) >= version.parse("1.80"):
gc_content = int(SeqUtils.gc_fraction(contig.seq) * 100 * 10**13) / 10**13
else:
gc_content = int(SeqUtils.GC(contig.seq) * 10**13) / 10**13
contig_data[contig.id] = {
"id": global_id,
"length": len(contig.seq),
"GC": SeqUtils.gc_fraction(contig.seq)*100,
"GC": gc_content,
"hit": 0,
"coverage": "-",
"RS": (len(re.findall(pattern, str(contig.seq))) + 1)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def test_create_contig_data():
assert contig_data["NODE_522"] == {
"id": 1,
"length": 22786,
"GC": 62.07759150355482,
"GC": 62.0775915035548,
"hit": 0,
"coverage": "-",
"RS": "-",
Expand All @@ -142,7 +142,7 @@ def test_create_contig_data():
assert contig_data["NODE_522"] == {
"id": 1,
"length": 22786,
"GC": 62.07759150355482,
"GC": 62.0775915035548,
"hit": 0,
"coverage": 4.76595,
"RS": 162,
Expand Down

0 comments on commit 5fd32e3

Please sign in to comment.