Skip to content
Snippets Groups Projects
Commit a4ce5f20 authored by Mate Balajti's avatar Mate Balajti
Browse files

refactor: setup.py, CI

parent 0364a552
No related branches found
No related tags found
1 merge request!48refactor: setup.py, CI
Pipeline #17417 passed
......@@ -13,9 +13,8 @@ build-job: # First stage deployment and installation of dependencies.
- pip install -r requirements.txt
- pip install -r requirements_dev.txt
- pip install -e .
- echo "Dependencies successfully deployed."
Coverage-test-job: # Test Stage
unit-test-job: # Test Stage
stage: test # Starts when the above build stages finishes installing dependencies.
script:
- pip install -r requirements.txt
......@@ -23,9 +22,8 @@ Coverage-test-job: # Test Stage
- pip install -e .
- coverage run --source tsg -m pytest
- coverage report -m
- echo "Coverage successfully deployed."
Flake8/Pylint/mypy-test-job: # Test Stage
lint-test-job: # Test Stage
stage: test # Deploys and runs all 3 linters.
script:
- pip install -r requirements.txt
......@@ -34,4 +32,3 @@ Flake8/Pylint/mypy-test-job: # Test Stage
- flake8 --docstring-convention google tsg/ tests/
- pylint tsg/ tests/
- mypy tsg/ tests/
- echo "Linters successfully deployed."
FROM python:3.9-slim-buster
WORKDIR /usr/src/app
COPY README.md pyproject.toml ./
ADD tsg ./tsg
ADD data ./data
RUN pip install .
ENTRYPOINT [ "transcript-generator" ]
\ No newline at end of file
......@@ -6,11 +6,11 @@ We hope that others would find use for this transcript_structure generator that
# Installation
To install the Python virtual environment, run
To install package, run
```
conda env create --file environment.yml
conda activate transcript-structure-generator
pip install "setuptools>=62.1.0"
pip install .
```
# Usage
......@@ -27,45 +27,17 @@ Output:
- id of original transcript (without intron inclusions)
- count
To install package, run
```
pip install "setuptools>=62.1.0"
pip install .
```
To generate the sampled transcripts, open a new shell, activate your environment and run
To generate the sampled transcripts, run
```
conda activate transcript-structure-generator
transcript-generator --prob-inclusion <probability_inclusion> [--log "INFO"] <transcripts_file> <annotations_file>
transcript-structure-generator --prob-inclusion <probability_inclusion> [--log "INFO"] <transcripts_file> <annotations_file>
```
where the transcripts file should be csv-formatted, the annotation file gtf-formatted and the inclusion probability for introns a float in the range [0,1]. The log parameter is optional and can be one of `["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG"]`. The default is `INFO`.
Sample Transcripts and Annotation files can be found in the repository under main/tests/resources.
# Development
To perform all tests, make sure your environment corresponds to the `environment.yml` file and run
```
pytest tests
```
To build Docker image, run
```
docker build -t transcript-app .
```
Afterwards, you can use the Docker image like so
```
docker run transcript-app --prob_inclusion <probability_inclusion> [--log "INFO"] <transcripts_file> <annotations_file>
```
# License
MIT license, Copyright (c) 2021 Zavolan Lab, Biozentrum, University of Basel
......
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
```c
/*
* Define the input parameters"""Takes input from csv-formatted file ("ID,Count")
with counts for individual transcripts.
Also a gtf-formatted file with exon coordinates
of the transcripts included in the csv file.
Outputs gtf-formatted file containing
generated intron/exon structures per transcript.
Outputs csv-formatted file
("NewTranscriptID,ID,Count") with id of
generated transcript, id of original
transcript (without intron inclusions) and
Counts.
*/
params.cvs_file = "$projectDir/tests/ #Input cvs file from group 1
params.gtf_file = "$projectDir/tests/ #Input gtf file from group 1
params.outdir = "results"
/* Log some information for the user */
log.info """\
R N A S E Q - N F P I P E L I N E
===================================
cvs_file : ${params.cvs_file}
gtf_file : ${params.gtf_file}
outdir : ${params.outdir}
"""
.stripIndent()
/*
* define the `file_validation` process
* given that the input files exist and are the correct format
*/
process file_validation {
input:
path cvs_file
path gtf_file
output:
path cvs_file into struc_gen
path gtf_file into struc_gen
script:
"""
"""
}
/*
* Define the transcript structure generation
* Read gtf files to define exons/introns and add random mutation coefficient.
*/
process struc_gen {
input:
output:
script:
"""
"""
}
/* Start the job:
* initialize variables
*/
Channel
.fromFilePairs( params.reads, checkIfExists:true )
.set { read_pairs_ch }
/* The "main" function:
* Use CLI arguments to create structure sequences and output text file & gtf file with selected exon structures
*/
workflow {
file_validation_ch = file_validation(params.cvs_file, params.gtf_file)
struc_gen_ch = struc_gen( # No idea yet) }
/* Book keeping upon workflow completion */
workflow.onComplete {
log.info (workflow.success ? "\nDone! Open the following report in your browser --> $params.outdir/multiqc/multiqc_report.html\n" : "Oops .. something went wrong")
)
}
```
name: transcript-structure-generator
channels:
- defaults
- conda-forge
dependencies:
- python=3.9
- matplotlib
- pandas
- pip
- tqdm
- flake8-docstrings
- mypy
- flake8
- pytest
- pylint
- coverage
[project]
name = "tsg"
version = "0.2.0"
authors = [
{ name="Michael Zimmermann", email="michael.zimmermann@unibas.ch" },
{ name="Andri Fraenkl", email="andri.fraenkl@unibas.ch" },
{ name="Larissa Glass", email="larissa.glass@unibas.ch" },
]
description = "Transcript Structure Generator"
readme = "README.md"
requires-python = ">=3.7"
license = {text = "MIT"}
dependencies = [
"pandas",
"tqdm",
]
[tool.setuptools]
packages = ["tsg"]
[project.urls]
"Homepage" = "https://git.scicore.unibas.ch/zavolan_group/tools/transcript-structure-generator"
[project.scripts]
transcript-generator = "tsg.cli:app"
\ No newline at end of file
"""Tests for the package tsg."""
"""Initialise tests."""
"""Transcript structure generator package."""
import importlib.metadata
from tsg.main import Gtf, TranscriptGenerator, sample_transcripts
__version__ = importlib.metadata.version("tsg")
__version__ = importlib.metadata.version("transcript-structure-generator")
__all__ = ["Gtf", "TranscriptGenerator", "sample_transcripts"]
......@@ -308,6 +308,7 @@ class Gtf:
class TranscriptGenerator:
"""Class to sample a transcript."""
# pylint: disable=W0613
def __new__(
cls,
transcript_id: str,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment