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

Develop #52

Closed
wants to merge 16 commits into from
Closed
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
64 changes: 64 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Publish Docker image to ghcr.io
on:
push:
tags:
- "*"
jobs:
push_to_registries:
name: Build and publish Docker image
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Prepare
# In this preparation step, a few configurations are made
# according to tags that will be used to export the image
# for Docker Hub, as well as the name of the image itself
id: prep
run: |
DOCKER_IMAGE=ghcr.io/rhshah/iAnnotateSV
VERSION=noop
if [ "${{ github.event_name }}" = "schedule" ]; then
VERSION=nightly
elif [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
MINOR=${VERSION%.*}
MAJOR=${MINOR%.*}
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
elif [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
VERSION=$(echo ${VERSION#v})
TAGS="${DOCKER_IMAGE}:${VERSION}"
elif [ "${{ github.event_name }}" = "push" ]; then
TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}"
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
- name: Login to GitHub Container Registry
#if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.RS_PAT }}
- name: Push to GitHub Packages
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.prep.outputs.tags }}
build-args: |
iAnnotateSV_VERSION=${{ steps.prep.outputs.version }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.version=${{ steps.prep.outputs.version }}
6 changes: 3 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7.18]
python-version: [3.10.14]

steps:
- name: Checkout github repo (+ download lfs dependencies)
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout LFS objects
run: git lfs checkout
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Publish package to PyPI

on:
push:
tags:
- "*.*.*"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,7 @@ ENV/

# IDE settings
.vscode/
.idea/
.idea/
.DS_Store
iAnnotateSV/.DS_Store
iAnnotateSV/data/.DS_Store
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
################## Base Image ##########
ARG PYTHON_VERSION="3.10.14"
FROM --platform=linux/amd64 python:${PYTHON_VERSION}

################## ARGUMENTS/Environments ##########
ARG BUILD_DATE
ARG BUILD_VERSION
ARG LICENSE="Apache-2.0"
ARG iAnnotateSV_VERSION
ARG VCS_REF

################## METADATA ########################
LABEL org.opencontainers.image.vendor="MSKCC"
LABEL org.opencontainers.image.authors="Ronak Shah ([email protected])"

LABEL org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.version=${BUILD_VERSION} \
org.opencontainers.image.licenses=${LICENSE} \
org.opencontainers.image.version.pvs=${iAnnotateSV_VERSION} \
org.opencontainers.image.source.pv="https://pypi.org/project/iAnnotateSV" \
org.opencontainers.image.vcs-url="https://github.com/rhshah/iAnnotateSV.git" \
org.opencontainers.image.vcs-ref=${VCS_REF}

LABEL org.opencontainers.image.description="This container uses python 3.10.14 as the base image to build \
iAnnotateSV version ${iAnnotateSV_VERSION}"

################## INSTALL ##########################

WORKDIR /app
ADD . /app

# install iAnnotateSV

RUN apt-get update && apt-get install --no-install-recommends -y gcc g++ zlib1g-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& make deps-install \
&& poetry build \
&& pip install dist/iAnnotateSV-*-py3-none-any.whl
17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
init:
pip install -r requirements.txt
# options
.ONESHELL:

test:
nosetests -v --with-coverage --cover-tests tests

.PHONY: deps-install
deps-install: ## install dependencies
pip install poetry
poetry install

requirements.txt: poetry.lock
poetry export --format requirements.txt --output requirements.txt --without-hashes

requirements-dev.txt: poetry.lock
poetry export --with dev --format requirements.txt --output requirements-dev.txt --without-hashes
28 changes: 7 additions & 21 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,9 @@ iAnnotateSV: Annotation of structural variants detected from NGS
.. image:: https://img.shields.io/pypi/v/iAnnotateSV.svg
:target: https://pypi.python.org/pypi/iAnnotateSV

.. image:: https://landscape.io/github/rhshah/iAnnotateSV/master/landscape.svg?style=flat
:target: https://landscape.io/github/rhshah/iAnnotateSV/master
:alt: Code Health


.. image:: https://zenodo.org/badge/18929/rhshah/iAnnotateSV.svg
:target: https://zenodo.org/badge/latestdoi/18929/rhshah/iAnnotateSV


.. image:: https://travis-ci.org/rhshah/iAnnotateSV.svg?branch=master
:target: https://travis-ci.org/rhshah/iAnnotateSV


.. image:: https://codecov.io/gh/rhshah/iAnnotateSV/branch/master/graph/badge.svg
:target: https://codecov.io/gh/rhshah/iAnnotateSV


iAnnotateSV is a Python library and command-line software toolkit to annotate and
visualize structural variants detected from Next Generation DNA sequencing data. This works for majority is just re-writing of a tool called dRanger_annotate written in matlab by Mike Lawrence at Broad Institue.
But it also has some additional functionality and control over the annotation w.r.t the what transcripts to be used for annotation.
Expand All @@ -48,13 +34,13 @@ Required Packages
=================
We require that you install:

:python: `v2.7.15 <https://www.python.org/downloads/release/python-2715/>`_
:pandas: `v0.24.2 <http://pandas.pydata.org/>`_
:biopython: `v1.76 <http://biopython.org/wiki/Main_Page>`_
:Pillow: `v6.2.1 <https://pypi.python.org/pypi/Pillow/3.4.2>`_
:openpyxl: `v2.6.4 <https://pypi.python.org/pypi/openpyxl/2.6.4>`_
:reportlab: `v3.5.2 <https://pypi.python.org/pypi/reportlab/3.5.2>`_
:coloredlogs: `v14.0 <https://pypi.python.org/pypi/coloredlogs>`_
:python: `v3.10.14 <https://www.python.org/downloads/release/>`_
:pandas: `v2.2.2 <http://pandas.pydata.org/>`_
:biopython: `v1.84 <http://biopython.org/wiki/Main_Page>`_
:Pillow: `v10.4.0 <https://pypi.python.org/pypi/Pillow/>`_
:openpyxl: `v3.1.5 <https://pypi.python.org/pypi/openpyxl/>`_
:reportlab: `v3.6.13 <https://pypi.python.org/pypi/reportlab/>`_
:coloredlogs: `v15.0.1 <https://pypi.python.org/pypi/coloredlogs>`_

Quick Usage
===========
Expand Down
14 changes: 7 additions & 7 deletions docs/iAnnotateSV.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ Required Packages

We require that you install:

:python: `v2.7.15 <https://www.python.org/downloads/release/python-2715/>`_
:pandas: `v0.24.2 <http://pandas.pydata.org/>`_
:biopython: `v1.76 <http://biopython.org/wiki/Main_Page>`_
:Pillow: `v6.2.1 <https://pypi.python.org/pypi/Pillow/3.4.2>`_
:openpyxl: `v2.6.4 <https://pypi.python.org/pypi/openpyxl/2.6.4>`_
:reportlab: `v3.5.2 <https://pypi.python.org/pypi/reportlab/3.5.2>`_
:coloredlogs: `v14.0 <https://pypi.python.org/pypi/coloredlogs>`_
:python: `v3.10.14 <https://www.python.org/downloads/release/>`_
:pandas: `v2.2.2 <http://pandas.pydata.org/>`_
:biopython: `v1.84 <http://biopython.org/wiki/Main_Page>`_
:Pillow: `v10.4.0 <https://pypi.python.org/pypi/Pillow/>`_
:openpyxl: `v3.1.5 <https://pypi.python.org/pypi/openpyxl/>`_
:reportlab: `v3.6.13 <https://pypi.python.org/pypi/reportlab/>`_
:coloredlogs: `v15.0.1 <https://pypi.python.org/pypi/coloredlogs>`_

Quick Usage
===========
Expand Down
14 changes: 0 additions & 14 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,8 @@ short-read sequencing platforms such as Illumina.
.. image:: https://img.shields.io/pypi/v/iAnnotateSV.svg
:target: https://pypi.python.org/pypi/iAnnotateSV


.. image:: https://landscape.io/github/rhshah/iAnnotateSV/master/landscape.svg?style=flat
:target: https://landscape.io/github/rhshah/iAnnotateSV/master
:alt: Code Health


.. image:: https://zenodo.org/badge/18929/rhshah/iAnnotateSV.svg
:target: https://zenodo.org/badge/latestdoi/18929/rhshah/iAnnotateSV


.. image:: https://travis-ci.org/rhshah/iAnnotateSV.svg?branch=master
:target: https://travis-ci.org/rhshah/iAnnotateSV


.. image:: https://codecov.io/gh/rhshah/iAnnotateSV/branch/master/graph/badge.svg
:target: https://codecov.io/gh/rhshah/iAnnotateSV


Contents:
Expand Down
40 changes: 20 additions & 20 deletions iAnnotateSV/AddExternalAnnotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ def main(command=None):
# Repeat Region Data
(rr_loc1, rr_loc2) = afr.AnnotateRepeatRegion(
args.verbose, count, row.copy(), repeatRegionDict)
data.ix[count, 'repName-repClass-repFamily:-site1'] = "<=>".join(rr_loc1)
data.ix[count, 'repName-repClass-repFamily:-site2'] = "<=>".join(rr_loc2)
data.loc[count, 'repName-repClass-repFamily:-site1'] = "<=>".join(rr_loc1)
data.loc[count, "repName-repClass-repFamily:-site2"] = "<=>".join(rr_loc2)
# Cosmic Consensus Data
cc_SV = afc.AnnotateFromCosmicCensusFile(args.ccFilename, args.verbose, count, row.copy())
cct_SV = afc.AnnotateFromCosmicFusionCountsFile(args.cctFilename, args.verbose, count, row.copy())
Expand All @@ -136,16 +136,16 @@ def main(command=None):
ccC.append(ccData[2])
ccD.append(ccData[3])
ccE.append(ccData[4])
data.ix[count, 'Cosmic_Fusion_Counts'] = cct_SV
data.ix[count, 'CC_Chr_Band'] = "<=>".join(ccA)
data.ix[count, 'CC_Tumour_Types(Somatic)'] = "<=>".join(ccB)
data.ix[count, 'CC_Cancer_Syndrome'] = "<=>".join(ccC)
data.ix[count, 'CC_Mutation_Type'] = "<=>".join(ccD)
data.ix[count, 'CC_Translocation_Partner'] = "<=>".join(ccE)
data.loc[count, 'Cosmic_Fusion_Counts'] = cct_SV
data.loc[count, 'CC_Chr_Band'] = "<=>".join(ccA)
data.loc[count, 'CC_Tumour_Types(Somatic)'] = "<=>".join(ccB)
data.loc[count, 'CC_Cancer_Syndrome'] = "<=>".join(ccC)
data.loc[count, 'CC_Mutation_Type'] = "<=>".join(ccD)
data.loc[count, 'CC_Translocation_Partner'] = "<=>".join(ccE)
# DGvData
(dgv_loc1, dgv_loc2) = afd.AnnotateDGv(args.verbose, count, row.copy(), dgvDict)
data.ix[count, 'DGv_Name-DGv_VarType-site1'] = "<=>".join(dgv_loc1)
data.ix[count, 'DGv_Name-DGv_VarType-site2'] = "<=>".join(dgv_loc2)
data.loc[count, 'DGv_Name-DGv_VarType-site1'] = "<=>".join(dgv_loc1)
data.loc[count, 'DGv_Name-DGv_VarType-site2'] = "<=>".join(dgv_loc2)
else:
data = ReadSVFile(args)
repeatRegionDict = afr.ReadRepeatFile(args.rrFilename, args.verbose)
Expand All @@ -156,23 +156,23 @@ def main(command=None):
cc_SV = afc.AnnotateFromCosmicCensusFile(args.ccFilename, args.verbose, count, row.copy())
cct_SV = afc.AnnotateFromCosmicFusionCountsFile(args.cctFilename, args.verbose, count, row.copy())
(dgv_loc1, dgv_loc2) = afd.AnnotateDGv(args.verbose, count, row.copy(), dgvDict)
data.ix[count, 'repName-repClass-repFamily:-site1'] = "<=>".join(rr_loc1)
data.ix[count, 'repName-repClass-repFamily:-site2'] = "<=>".join(rr_loc2)
data.loc[count, "repName-repClass-repFamily:-site1"] = "<=>".join(rr_loc1)
data.loc[count, "repName-repClass-repFamily:-site2"] = "<=>".join(rr_loc2)
ccA, ccB, ccC, ccD = ([] for i in range(4))
for cc in cc_SV:
ccData = cc.split('\t')
ccA.append(ccData[0])
ccB.append(ccData[1])
ccC.append(ccData[2])
ccD.append(ccData[3])
data.ix[count, 'Cosmic_Fusion_Counts'] = cct_SV
data.ix[count, 'CC_Chr_Band'] = "<=>".join(ccA)
data.ix[count, 'CC_Tumour_Types(Somatic)'] = "<=>".join(ccB)
data.ix[count, 'CC_Cancer_Syndrome'] = "<=>".join(ccC)
data.ix[count, 'CC_Mutation_Type'] = "<=>".join(ccD)
data.ix[count, 'CC_Translocation_Partner'] = "<=>".join(ccE)
data.ix[count, 'DGv_Name-DGv_VarType-site1'] = "<=>".join(dgv_loc1)
data.ix[count, 'DGv_Name-DGv_VarType-site2'] = "<=>".join(dgv_loc2)
data.loc[count, "Cosmic_Fusion_Counts"] = cct_SV
data.loc[count, "CC_Chr_Band"] = "<=>".join(ccA)
data.loc[count, "CC_Tumour_Types(Somatic)"] = "<=>".join(ccB)
data.loc[count, "CC_Cancer_Syndrome"] = "<=>".join(ccC)
data.loc[count, "CC_Mutation_Type"] = "<=>".join(ccD)
data.loc[count, "CC_Translocation_Partner"] = "<=>".join(ccE)
data.loc[count, "DGv_Name-DGv_VarType-site1"] = "<=>".join(dgv_loc1)
data.loc[count, "DGv_Name-DGv_VarType-site2"] = "<=>".join(dgv_loc2)

# Print to TSV file
data.to_csv(outFileTxt, sep='\t', index=False)
Expand Down
8 changes: 4 additions & 4 deletions iAnnotateSV/AnnotateEachBreakpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ def AnnotateEachBreakpoint(chromosome,position,strand,df,autoSelect):
c = None
d = None
#In exonic region
exonStarts = filter(None,df.iloc[tindex]['exonStarts'].split(","))
exonEnds = filter(None,df.iloc[tindex]['exonEnds'].split(","))
exonStarts = list(filter(None,df.iloc[tindex]['exonStarts'].split(",")))
exonEnds = list(filter(None,df.iloc[tindex]['exonEnds'].split(",")))
in_exon = None
for k in range(len(exonStarts)):
if(int(exonStarts[k])<= int(position) and int(exonEnds[k]) >= int(position)):
Expand All @@ -131,7 +131,7 @@ def AnnotateEachBreakpoint(chromosome,position,strand,df,autoSelect):
#In Intronic Region
c = 2
exonCount = df.iloc[tindex]['exonCount']
exonFrames = filter(None,df.iloc[tindex]['exonFrames'].split(","))
exonFrames = list(filter(None,df.iloc[tindex]['exonFrames'].split(",")))
for k in range(exonCount):
if(int(exonEnds[k]) < int(position) and int(exonStarts[k+1]) > position ):
if(df.iloc[tindex]['strand'] == '+'):
Expand All @@ -158,7 +158,7 @@ def AnnotateEachBreakpoint(chromosome,position,strand,df,autoSelect):
for y in 1000.0 ** (np.arange(1,4,0.3)):
cmpDB = distBefore[distBefore <= y]
if(not cmpDB.empty):
beforeIdx = cmpDB.idxmin(axis=1)
beforeIdx = cmpDB.idxmin()
geneName = df.iloc[beforeIdx]['name2']
strandDirection = df.iloc[beforeIdx]['strand']
transcript = df.iloc[beforeIdx]['#name']
Expand Down
Loading
Loading