Skip to content

Commit

Permalink
Merge pull request #2 from CUT-Labs/development
Browse files Browse the repository at this point in the history
DNA Computing
  • Loading branch information
jphuse authored Oct 30, 2024
2 parents 31887c4 + 1b2873f commit 81b5f9b
Show file tree
Hide file tree
Showing 17 changed files with 812 additions and 196 deletions.
13 changes: 9 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ RUN apt-get update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*

# Set environment variables to use Clang as the default compiler
ENV CC=clang
ENV CXX=clang++
ENV CC=gcc
ENV CXX=g++

# Copy the requirements files into the container
COPY requirements.txt /app/
Expand All @@ -28,12 +28,17 @@ RUN pip install --upgrade pip && \

# NUPACK Installation (manual process due to external dependency)
RUN echo "Installing NUPACK" && \
wget https://jacksonhuse.com/wp-content/uploads/2024/10/nupack3.0.6.zip && \
unzip nupack3.0.6.zip && \
wget https://jacksonhuse.com/wp-content/uploads/2024/10/nupack3.0.6.tar && \
tar -xvf nupack3.0.6.tar && \
cd nupack3.0.6 && \
make clean && \
make || true && \
export NUPACKHOME="/app/nupack3.0.6" && \
cd /app

# Set nupackhome variable
RUN export NUPACKHOME="/app/nupack3.0.6"

# Install Piperine-specific dependencies and uninstall conflicting ones (numpy, scipy)
RUN pip uninstall -y numpy scipy && \
pip install --no-cache-dir -r piperine_requirements.txt
Expand Down
3 changes: 1 addition & 2 deletions gui/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@


class GuiConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'todelete'
name = 'gui'
160 changes: 160 additions & 0 deletions gui/classes/PiperineObjects.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
class Sequence:
def __init__(self, name, seq):
self.Name = name
self.Sequence = seq


class Strand:
def __init__(self, name, strand, issignal):
self.Name = name
self.Strand = strand
self.IsSignal = issignal


class Structure:
def __init__(self, name, struct):
self.Name = name
self.Structure = struct


class Complex:
def __init__(self, name, strands, isfuel):
self.Name = name
self.Strands = strands
self.IsFuel = isfuel


class Design:
def __init__(self, name):
self.Name = name
self.SignalStrands = [] # from my[i]_strands.txt
self.Complexes = [] # from my[i]_strands.txt
self.Sequences = [] # from my[i].seqs
self.Strands = [] # from my[i].seqs
self.Structures = [] # from my[i].seqs

self.RawScores = ScoresArray()
self.RankArray = ScoresArray()
self.FractionalExcessArray = ScoresArray()
self.PercentBadnessArray = ScoresArray()


class ScoresArray:
def __init__(self):
self.TSI_avg = None
self.TSI_avg_weight = 5
self.TSI_max = None
self.TSI_max_weight = 20
self.TO_avg = None
self.TO_avg_weight = 10
self.TO_max = None
self.TO_max_weight = 30
self.WS_BM = None
self.WS_BM_weight = 2
self.Max_BM = None
self.Max_BM_weight = 3
self.SSU_min = None
self.SSU_min_weight = 30
self.SSU_avg = None
self.SSU_avg_weight = 10
self.SSTU_min = None
self.SSTU_min_weight = 50
self.SSTU_avg = None
self.SSTU_avg_weight = 20
self.BN_percent_max = None
self.BN_percent_max_weight = 10
self.BN_percent_avg = None
self.BN_percent_avg_weight = 5
self.WSAS = None
self.WSAS_weight = 6
self.WSIS = None
self.WSIS_weight = 4
self.WSAS_M = None
self.WSAS_M_weight = 5
self.WSIS_M = None
self.WSIS_M_weight = 3
self.Verboten = None
self.Verboten_weight = 2
self.Spurious = None
self.Spurious_weight = 8
self.dG_Error = None
self.dG_Error_weight = 10
self.dG_Range = None
self.dG_Range_weight = 20

def ToDict(self):
return {
"TSI avg": (self.TSI_avg, self.TSI_avg_weight),
"TSI max": (self.TSI_max, self.TSI_max_weight),
"TO avg": (self.TO_avg, self.TO_avg_weight),
"TO max": (self.TO_max, self.TO_max_weight),
"WS-BM": (self.WS_BM, self.WS_BM_weight),
"Max-BM": (self.Max_BM, self.Max_BM_weight),
"SSU min": (self.SSU_min, self.SSU_min_weight),
"SSU avg": (self.SSU_avg, self.SSU_avg_weight),
"SSTU min": (self.SSTU_min, self.SSTU_min_weight),
"SSTU avg": (self.SSTU_avg, self.SSTU_avg_weight),
"BN% max": (self.BN_percent_max, self.BN_percent_max_weight),
"BN% avg": (self.BN_percent_avg, self.BN_percent_avg_weight),
"WSAS": (self.WSAS, self.WSAS_weight),
"WSIS": (self.WSIS, self.WSIS_weight),
"WSAS-M": (self.WSAS_M, self.WSAS_M_weight),
"WSIS-M": (self.WSIS_M, self.WSIS_M_weight),
"Verboten": (self.Verboten, self.Verboten_weight),
"Spurious": (self.Spurious, self.Spurious_weight),
"dG Error": (self.dG_Error, self.dG_Error_weight),
"dG Range": (self.dG_Range, self.dG_Range_weight)
}

def from_list(self, values_list):
keys = [
"TSI_avg", "TSI_max", "TO_avg", "TO_max", "WS_BM", "Max_BM",
"SSU_min", "SSU_avg", "SSTU_min", "SSTU_avg", "BN_percent_max",
"BN_percent_avg", "WSAS", "WSIS", "WSAS_M", "WSIS_M",
"Verboten", "Spurious", "dG_Error", "dG_Range"
]
for key, value in zip(keys, values_list):
setattr(self, key, value)

def Sum(self):
# Sum of all scores that are not None
total = 0
for key, value in self.ToDict().items():
score, _ = value
if score is not None:
total += score
return total

def WeightedSum(self):
# Weighted sum of all scores that are not None
total = 0
for key, value in self.ToDict().items():
score, weight = value
if score is not None:
total += score * (weight / 100)
return total


class PiperineOutput:
def __init__(self):
self.Designs = []

def rank_values(self, values, reversed=False):
# Rank the values, lower is better by default unless reversed is True
array = np.array(values)
if reversed:
array = -array
unique_values = np.unique(array)
rank_dict = {val: rank for rank, val in enumerate(unique_values)}
return [rank_dict[v] for v in array]

# Worst-rank
# (weighted)
# Sum-of-ranks
# (weighted)
# Fractional-excess
# (weighted)
# Percent-badness
# (weighted)
def MetaRanksArray(self):
rank_arrays = [design.RankArray.ToDict() for design in self.Designs]
1 change: 1 addition & 0 deletions gui/classes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
from .GateTypes import *
from .NotGateTypes import *
from .RearrangeType import *
from .PiperineObjects import *
Loading

0 comments on commit 81b5f9b

Please sign in to comment.