-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from J35P312/master
Tiddit 3.9.0
- Loading branch information
Showing
13 changed files
with
502 additions
and
174 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,27 @@ | ||
FROM python:3.8-slim | ||
|
||
RUN apt-get update && \ | ||
apt-get upgrade -y && \ | ||
apt-get install -y \ | ||
autoconf \ | ||
automake \ | ||
build-essential \ | ||
cmake \ | ||
libbz2-dev \ | ||
libcurl4-gnutls-dev \ | ||
liblzma-dev \ | ||
libncurses5-dev \ | ||
libssl-dev \ | ||
make \ | ||
unzip \ | ||
wget \ | ||
zlib1g-dev && \ | ||
apt-get clean && \ | ||
apt-get purge && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
FROM condaforge/mambaforge:24.9.2-0 | ||
|
||
WORKDIR /app | ||
|
||
## Install samtools for cram processing | ||
RUN wget --no-verbose https://github.com/samtools/samtools/releases/download/1.10/samtools-1.10.tar.bz2 && \ | ||
bunzip2 samtools-1.10.tar.bz2 && \ | ||
tar -xf samtools-1.10.tar && \ | ||
cd samtools-1.10 && \ | ||
./configure && \ | ||
make all all-htslib && \ | ||
make install install-htslib && \ | ||
rm /app/samtools-1.10.tar | ||
|
||
## Set TIDDIT version | ||
ARG TIDDIT_VERSION=2.12.1 | ||
ARG TIDDIT_VERSION=3.9.0 | ||
|
||
## Add some info | ||
LABEL base_image="python:3.8-slim" | ||
LABEL software="TIDDIT.py" | ||
LABEL software.version=${TIDDIT_VERSION} | ||
|
||
## Download and extract | ||
RUN conda install conda-forge::unzip | ||
RUN conda install -c conda-forge pip gcc joblib | ||
RUN conda install -c bioconda numpy cython pysam bwa | ||
|
||
RUN wget https://github.com/SciLifeLab/TIDDIT/archive/TIDDIT-${TIDDIT_VERSION}.zip && \ | ||
unzip TIDDIT-${TIDDIT_VERSION}.zip && \ | ||
rm TIDDIT-${TIDDIT_VERSION}.zip | ||
|
||
## Install | ||
RUN cd TIDDIT-TIDDIT-${TIDDIT_VERSION} && \ | ||
./INSTALL.sh && \ | ||
chmod +x /app/TIDDIT-TIDDIT-${TIDDIT_VERSION}/TIDDIT.py && \ | ||
ln -s /app/TIDDIT-TIDDIT-${TIDDIT_VERSION}/TIDDIT.py /usr/local/bin | ||
RUN cd TIDDIT-TIDDIT-${TIDDIT_VERSION} && \ | ||
pip install -e . | ||
|
||
ENTRYPOINT ["TIDDIT.py"] | ||
ENTRYPOINT ["tiddit"] | ||
CMD ["--help"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
class graph: | ||
|
||
def __init__(self): | ||
self.predecessors={} | ||
self.sucessors={} | ||
self.kmers={} | ||
self.vertices={} | ||
self.vertice_set=set([]) | ||
self.in_branch_points=set([]) | ||
self.out_branch_points=set([]) | ||
self.starting_points=set([]) | ||
self.end_points=set([]) | ||
|
||
#add node to the graph | ||
def add_kmer(self,kmer,read): | ||
|
||
if not kmer in self.kmers: | ||
self.kmers[kmer]=set([]) | ||
self.predecessors[kmer]=set([]) | ||
self.sucessors[kmer]=set([]) | ||
self.starting_points.add(kmer) | ||
self.end_points.add(kmer) | ||
|
||
self.kmers[kmer].add(read) | ||
|
||
#add vertices between nodes | ||
def add_vertice(self,kmer1,kmer2,read): | ||
|
||
self.add_kmer(kmer1,read) | ||
self.add_kmer(kmer2,read) | ||
|
||
if not kmer1 in self.vertices: | ||
self.vertices[kmer1]={} | ||
|
||
if kmer1 in self.end_points: | ||
self.end_points.remove(kmer1) | ||
|
||
if not kmer2 in self.vertices[kmer1]: | ||
self.vertices[kmer1][kmer2]=set([]) | ||
|
||
if kmer2 in self.starting_points: | ||
self.starting_points.remove(kmer2) | ||
|
||
self.vertices[kmer1][kmer2].add(read) | ||
|
||
self.vertice_set.add((kmer1,kmer2)) | ||
|
||
self.sucessors[kmer1].add(kmer2) | ||
if len(self.sucessors[kmer1]) > 1: | ||
self.in_branch_points.add(kmer1) | ||
|
||
self.predecessors[kmer2].add(kmer1) | ||
if len(self.predecessors[kmer2]) > 1: | ||
self.out_branch_points.add(kmer2) | ||
|
||
def delete_vertice(self,kmer1,kmer2): | ||
|
||
if kmer1 in self.vertices: | ||
if kmer2 in self.vertices[kmer1]: | ||
del self.vertices[kmer1][kmer2] | ||
|
||
if len(self.vertices[kmer1]) == 0: | ||
del self.vertices[kmer1] | ||
|
||
if kmer1 in self.in_branch_points: | ||
if len(self.sucessors[kmer1]) < 3: | ||
self.in_branch_points.remove(kmer1) | ||
|
||
if kmer1 in self.sucessors: | ||
if kmer2 in self.sucessors[kmer1]: | ||
self.sucessors[kmer1].remove(kmer2) | ||
|
||
if not self.sucessors[kmer1]: | ||
self.end_points.add(kmer1) | ||
|
||
if kmer2 in self.out_branch_points: | ||
if len(self.predecessors[kmer2]) < 3: | ||
self.out_branch_points.remove(kmer2) | ||
|
||
if kmer1 in self.predecessors[kmer2]: | ||
self.predecessors[kmer2].remove(kmer1) | ||
|
||
if not len(self.predecessors[kmer2]): | ||
self.starting_points.add(kmer2) | ||
|
||
if (kmer1,kmer2) in self.vertice_set: | ||
self.vertice_set.remove((kmer1,kmer2)) | ||
|
||
def delete_kmer(self,kmer): | ||
if kmer in self.kmers: | ||
del self.kmers[kmer] | ||
|
||
sucessors=set([]) | ||
for sucessor in self.sucessors[kmer]: | ||
sucessors.add(sucessor) | ||
|
||
predecessors=set([]) | ||
for predecessor in self.predecessors[kmer]: | ||
predecessors.add(predecessor) | ||
|
||
for predecessor in predecessors: | ||
self.delete_vertice(predecessor,kmer) | ||
|
||
for sucessor in sucessors: | ||
self.delete_vertice(kmer,sucessor) |
Oops, something went wrong.