Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

* modernize packaging & create stub for tests #1

Merged
merged 1 commit into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.tox
*.egg-info
**/__pycache__
**/*.pyc
3 changes: 1 addition & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
#include README.rst
#include docs/*.txt
include VERSION
46 changes: 26 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,42 @@
# Somatic base substitution caller for LRS

Python tool that calls somatic base substitutions from matched tumour normal whole genome pileups.
Python tool that calls somatic base substitutions from matched tumour-normal whole genome pileups.

## Getting Started

Pip install
#### Required

### Prerequisites
Python 3.6+

samtools/1.10
htslib/1.10.2
tabix/0.2.6
## Install

Pileups from samtools
bgzip pileup_name
tabix -b 2 -e 2 pileup_name.gz
Install into a virtualenv is recommended, _e.g._:

#### Required
python3 -m venv SBSC
source SBSC/bin/activate
tempdir=$(mktemp -d)
git clone https://github.com/shimbalama/SBSC $tempdir
cd $tempdir
pip3 install -r requirements.txt .

Python 3

#### Optional
### Prerequisites

NA
Tabix-indexed pileups from samtools

### Installing
bgzip pileup_name
tabix -b 2 -e 2 pileup_name.gz

pip install SBSC
When the tool runs `.tbi` index files are presumed to exist adjacent to input pileup files.

## Running the program

SBSC.py -h
# help
SBSCall.py --help

# basic example
SBSCall.py \
-r /path/to/reference \
-o /path/to/output \
-c /path/to/cancer_pileup.gz \
-n /path/to/normal_pileup.gz

## Authors

Expand All @@ -42,4 +48,4 @@ This project is licensed under the MIT License. See LICENSE

## Acknowledgments

QMIR medical genomics team
QIMR Berghofer medical genomics team
Empty file added SBSC/output/__init__.py
Empty file.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.12
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[build-system]
requires = [
"pip",
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
biopython==1.79
pandas==1.3.3
pysam==0.16.0.1
scipy==1.7.1
20 changes: 20 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[metadata]
name = SBSC
version = file: VERSION
description = A simple somatic SNV and MNV caller
long_description = file: README.md, LICENSE
author = Liam McIntyre
author_email = [email protected]
license = MIT License
classifiers:
Programming Language :: Python :: 3.6
License :: OSI Approved :: MIT License
Operating System :: OS Independent

[options]
include_package_data = True
packages = find:
python_requires = >=3.6
scripts =
bin/SBSCall.py
zip_safe = False
32 changes: 0 additions & 32 deletions setup.py

This file was deleted.

Empty file added tests/__init__.py
Empty file.
16 changes: 16 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from unittest import TestCase
import shlex
import subprocess


class TestMain(TestCase):
"""
Integration tests
"""
def test_help(self):
"""
Test that the script can be called by the documented name
"""
result = subprocess.run(shlex.split('python3 bin/SBSCall.py --help'),
capture_output=True, text=True)
self.assertTrue(result.stdout.startswith('usage: SBSCall.py'))
7 changes: 7 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[tox]
envlist = py39
isolated_build = True

[testenv]
commands = python3 -m unittest discover tests
deps = -rrequirements.txt