Skip to content

Commit

Permalink
ClusterCAD 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerBackman committed Sep 20, 2017
0 parents commit d0a0ed6
Show file tree
Hide file tree
Showing 214 changed files with 26,741 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
static/* linguist-vendored
notebooks/* linguist-documentation
pipeline/data/* linguist-documentation
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
pipeline/data/aa_sequence_analysis/plotcache.p
*.pyc
*~
*.swp
.ipynb_checkpoints
notebooks/mibig/*
screenlog.*
clusterCAD/settings.py
notebooks/*
39 changes: 39 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
clusterCAD Copyright (C) 2016-2017, The Regents of the University of California, through
Lawrence Berkeley National Laboratory (subject to receipt of any required
approvals from the U.S. Dept. of Energy). All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

(1) Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

(2) Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

(3) Neither the name of the University of California, Lawrence Berkeley National
Laboratory, U.S. Dept. of Energy nor the names of its contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

You are under no obligation whatsoever to provide any bug fixes, patches, or
upgrades to the features, functionality or performance of the source code
("Enhancements") to anyone; however, if you choose to make your Enhancements
available either publicly, or directly to Lawrence Berkeley National Laboratory,
without imposing a separate written license agreement for such Enhancements,
then you hereby grant the following license: a non-exclusive, royalty-free
perpetual license to install, use, modify, prepare derivative works, incorporate
into other computer software, distribute, and sublicense such enhancements or
derivative works thereof, in binary and source code form.
32 changes: 32 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
ClusterCAD: a computational platform for type I modular polyketide synthase design

Copyright (c) 2017, The Regents of the University of California, through
Lawrence Berkeley National Laboratory (subject to receipt of any required
approvals from the U.S. Dept. of Energy). All rights reserved.

Starting service (connect to HTTP on port 8000 with username and password 'pkscluster'):
docker-compose up -d

Loading PKS data into database:
docker-compose exec web /bin/bash -c 'cd pipeline && make clean && make all'

Shutting down (restart possible with up -d):
docker-compose stop

Shut down and delete all containers:
docker-compose down

Building images:
docker-compose build

Running commands inside running web container:
docker-compose exec web /bin/bash

Creating a superuser for /admin:
docker-compose exec web python3 manage.py createsuperuser

Obtaining a Django shell:
docker-compose exec web python3 manage.py shell

Running jupyter notebook for development:
docker-compose exec web jupyter notebook --no-browser --ip=* --allow-root
20 changes: 20 additions & 0 deletions admin_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# create a new app
python3 manage.py startapp pks

# create database tables for new app
python3 manage.py migrate

# update app migrations
python3 manage.py makemigrations pks
python3 manage.py migrate


# example to create and save a cluster object
from pks.models import Cluster
a = Cluster(description="ok")
a.save()

Cluster.objects.all()

# flush redis cache
docker-compose exec redis redis-cli flushall
20 changes: 20 additions & 0 deletions awsLaunch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# this script launches this service on an aws container, after manually adding the servers ssh key to bitbucket
# make sure to enable port 80 in Security groups for this container as well
# also make sure you are using DEBUG = False, and settings ALLOWED_HOSTS to the correct server name
# for production

sudo yum update -y
sudo yum install -y docker git
sudo pip install docker-compose
sudo service docker start

# create ssh key and add to bitbucket before running this
git clone https://github.com/JBEI/clusterCAD
cd clusterCAD
sudo /usr/local/bin/docker-compose build
sudo /usr/local/bin/docker-compose up -d

# example to forward ports back for devel
ssh -L 80:localhost:80 8888:localhost:8888 ec2-user@<remote hostname>
Empty file added clusterCAD/__init__.py
Empty file.
155 changes: 155 additions & 0 deletions clusterCAD/example_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
"""
Django settings for clusterCAD project.
Generated by 'django-admin startproject' using Django 1.10.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '28$$942hz#kd1c7c-!jkxu*#e+2stjy69v7$p)4mo2kh&q-97r'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['*']

# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'bootstrap3',
'pks',
'compounddb',
'structureSearch',
'sequenceSearch',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'clusterCAD.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'clusterCAD.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'clustercad',
'USER': 'clustercad',
'PASSWORD': 'clustercad',
'HOST': 'db',
'PORT': 5432,
}
}


# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = "/www/static/"

MEDIA_ROOT = '/www/static/media/'
MEDIA_URL = '/static/media/'

STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]

# Default settings
BOOTSTRAP3 = {
# The URL to the jQuery JavaScript file
'jquery_url': '/static/js/jquery.min.js',

# The Bootstrap base URL
'base_url': '/static/',
}

CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://redis:6379/1",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
}
}
}
28 changes: 28 additions & 0 deletions clusterCAD/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""clusterCAD URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin
from django.views.generic import TemplateView

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^pks/', include('pks.urls')),
url(r'^compounddb/', include('compounddb.urls')),
url(r'^structureSearch/', include('structureSearch.urls')),
url(r'^sequenceSearch/', include('sequenceSearch.urls')),
url(r'^$', TemplateView.as_view(template_name='home.html')),
url(r'^about/$', TemplateView.as_view(template_name='about.html')),
]
16 changes: 16 additions & 0 deletions clusterCAD/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for clusterCAD project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "clusterCAD.settings")

application = get_wsgi_application()
Empty file added compounddb/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions compounddb/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions compounddb/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class CompounddbConfig(AppConfig):
name = 'compounddb'
24 changes: 24 additions & 0 deletions compounddb/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-23 22:43
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Compound',
fields=[
('inchiKey', models.CharField(max_length=27, primary_key=True, serialize=False)),
('name', models.CharField(max_length=256)),
('smiles', models.TextField()),
],
),
]
Loading

0 comments on commit d0a0ed6

Please sign in to comment.