Skip to content

Commit 3e6e699

Browse files
authored
Merge pull request #82 from PMCC-BioinformaticsCore/v0.11.x
V0.11.x
2 parents cf9c2de + 1e217a2 commit 3e6e699

File tree

123 files changed

+2540
-169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+2540
-169
lines changed

.github/workflows/publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Upload Python Package
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Set up Python
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: '3.x'
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install .
21+
pip install -e .[tests]
22+
pip install -e .[ci]
23+
24+
- name: Test with nosetests
25+
run: |
26+
nosetests -s -w tests -a ci --ignore-files="local_*"
27+
- name: Build and publish
28+
env:
29+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
30+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
31+
run: |
32+
python setup.py sdist bdist_wheel
33+
twine upload dist/*

.github/workflows/unit_tests.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Unit Tests
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: [3.6, 3.7, 3.8]
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install .
23+
pip install -e .[tests]
24+
- name: Test with nosetests
25+
run: |
26+
nosetests -s -w tests -a ci --ignore-files="local_*"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ janis_pipelines.bioinformatics.egg-info/
1010
pip-wheel-metadata/
1111
cromwell-executions/
1212
cromwell-workflow-logs/
13+
venv/
14+
.python-version

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ repos:
33
rev: stable
44
hooks:
55
- id: black
6-
language_version: python3.7
76
- repo: local
87
hooks:
98
- id: nosetests

.travis.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

janis_bioinformatics/__meta__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = "v0.10.12"
1+
__version__ = "v0.11.0"
22
description = "Bioinformatics tools for Janis; the Pipeline creation helper"

janis_bioinformatics/data_types/bam.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import subprocess
12
from janis_core import File
23

34

@@ -12,6 +13,28 @@ def name():
1213
def doc(self):
1314
return "A binary version of a SAM file, http://software.broadinstitute.org/software/igv/bam"
1415

16+
@classmethod
17+
def flagstat(cls, file_path: str):
18+
command = ["samtools", "flagstat", file_path]
19+
result = subprocess.run(
20+
command,
21+
stdout=subprocess.PIPE,
22+
stderr=subprocess.PIPE,
23+
universal_newlines=True,
24+
)
25+
26+
if result.stderr:
27+
raise Exception(result.stderr)
28+
29+
return result.stdout
30+
31+
@classmethod
32+
def equal(cls, file_path_1: str, file_path_2: str):
33+
flagstat1 = cls.flagstat(file_path_1)
34+
flagstat2 = cls.flagstat(file_path_2)
35+
36+
return flagstat1 == flagstat2
37+
1538

1639
class BamBai(Bam):
1740
@staticmethod
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
from janis_core import File
2+
from janis_unix.data_types import Gunzipped
3+
4+
from janis_bioinformatics.data_types.tabix import FileTabix
25

36

47
class Bed(File):
@@ -10,14 +13,16 @@ def name():
1013
return "bed"
1114

1215

13-
class BedTabix(File):
16+
class BedGz(Gunzipped):
1417
def __init__(self, optional=False):
15-
super().__init__(optional=optional, extension=".bed.gz")
18+
super().__init__(inner_type=Bed, optional=optional, extension=".bed.gz")
1619

1720
@staticmethod
1821
def name():
19-
return "BedTABIX"
22+
return "BedGz"
23+
2024

25+
class BedTabix(FileTabix, BedGz):
2126
@staticmethod
22-
def secondary_files():
23-
return [".tbi"]
27+
def name():
28+
return "BedTABIX"

janis_bioinformatics/data_types/fasta.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
class Fasta(File):
66
def __init__(self, optional=False):
7-
super().__init__(optional, extension=".fasta")
7+
super().__init__(
8+
optional, extension=".fasta", alternate_extensions={".fa", ".fna"}
9+
)
810

911
@staticmethod
1012
def name():

janis_bioinformatics/data_types/fastq.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
class Fastq(File):
77
def __init__(self, optional=False):
8-
super().__init__(optional=optional, extension=".fastq")
8+
super().__init__(
9+
optional=optional, extension=".fastq", alternate_extensions={".fq"}
10+
)
911

1012
@staticmethod
1113
def name():
@@ -20,7 +22,9 @@ def doc(self):
2022

2123
class FastqGz(File):
2224
def __init__(self, optional=False):
23-
super().__init__(optional=optional, extension=".fastq.gz")
25+
super().__init__(
26+
optional=optional, extension=".fastq.gz", alternate_extensions={".fq.gz"}
27+
)
2428

2529
@staticmethod
2630
def name():
@@ -69,7 +73,7 @@ def invalid_value_hint(self, meta):
6973

7074
class FastqPairedEnd(Array):
7175
def __init__(self, optional=False):
72-
super().__init__(File(optional=False, extension=".fastq"), optional=optional)
76+
super().__init__(Fastq(optional=False), optional=optional)
7377

7478
def id(self):
7579
if self.optional:

0 commit comments

Comments
 (0)