Skip to content

Commit

Permalink
Merge pull request #62 from zakandrewking/populate
Browse files Browse the repository at this point in the history
Populate maps
  • Loading branch information
zakandrewking committed Sep 12, 2014
2 parents 95f6ea4 + af826fb commit 79b79da
Show file tree
Hide file tree
Showing 44 changed files with 5,294 additions and 2,812 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ Escher.egg-info/
.ipynb_checkpoints/
build/*
env/*
envset/*
envset/*
builder.html
builder_not_minified.html
viewer.html
viewer_not_minified.html
index.html
130 changes: 113 additions & 17 deletions docs/notebooks/development.ipynb

Large diffs are not rendered by default.

23 changes: 14 additions & 9 deletions docs/notebooks/json_models_in_cobrapy.ipynb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
"signature": "sha256:78a516c98e9979feee6bcc52100d8bbb8d855994bca7d4b074c18e132e9f30a4"
"signature": "sha256:beee6ea53eaa629f0dd6a9a4b09cf5cec6ab287a550f5c3e9348ca15129537c7"
},
"nbformat": 3,
"nbformat_minor": 0,
Expand All @@ -24,22 +24,27 @@
"cell_type": "code",
"collapsed": false,
"input": [
"# Load a cobra model from anywhere you like\n",
"model = cobra.io.read_sbml_model('e-coli-core.xml')"
"print cobra.__version__"
],
"language": "python",
"metadata": {},
"outputs": [],
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"v1.0.0b2.post29-g31d9339\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Exclude the following attributes so the final json file will be smaller\n",
"EXCLUDE = ['notes', 'charge', 'compartment', 'annotation',\n",
" 'subsystem', 'reaction', 'objective_coefficient',\n",
" 'notes', 'genes', 'description']"
"# Load a cobra model from anywhere you like\n",
"model = cobra.io.read_sbml_model('e-coli-core.xml')"
],
"language": "python",
"metadata": {},
Expand All @@ -51,7 +56,7 @@
"collapsed": false,
"input": [
"# generate a json file to load into Escher\n",
"cobra.io.save_json_model(model, 'e-coli-core.json', exclude_attributes=EXCLUDE)"
"cobra.io.save_json_model(model, 'e-coli-core.json')"
],
"language": "python",
"metadata": {},
Expand Down
276 changes: 159 additions & 117 deletions docs/notebooks/multiple_maps.ipynb

Large diffs are not rendered by default.

28 changes: 19 additions & 9 deletions escher/css/builder-embed.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,44 @@
fill: black;
stroke: none;
text-rendering: optimizelegibility;
cursor: default;
}
.reaction-label {
fill: rgb(32, 32, 120);
text-rendering: optimizelegibility;
}
.text-label {
.text-label .label {
font-size: 50px;
}
.text-label-input {
font-size: 50px;
}
.node-circle {
stroke-width: 2px;
fill: none;
stroke: rgb(50, 50, 50);
}
.selected .node-circle{
g.selected .node-circle{
stroke-width: 3px;
stroke: rgb(20, 113, 199);
}
.selected.text-label {
g.selected .label {
fill: rgb(20, 113, 199);
}
.metabolite-circle {
stroke: rgb(162, 69, 16);
}
.selected .metabolite-circle {
g.selected .metabolite-circle {
stroke: rgb(5, 2, 0);
}
.segment {
stroke: grey;
stroke-width: 3px;
stroke: #334E75;
stroke-width: 6px;
fill: none;
}
.arrowhead {
fill: #334E75;
}
.membrane {
fill: none;
stroke: rgb(255, 187, 0);
Expand All @@ -60,13 +67,13 @@
stroke: #fff;
shape-rendering: crispEdges;
}
.bezier {
.bezier-circle {
fill: rgb(255,255,255);
}
.bezier1 {
.bezier-circle.b1 {
stroke: red;
}
.bezier2 {
.bezier-circle.b2 {
stroke: blue;
}
.connect-line{
Expand Down Expand Up @@ -100,4 +107,7 @@
.cursor-grabbing {
cursor: grabbing;
cursor: -webkit-grabbing;
}
.edit-text-cursor {
cursor: text;
}
10 changes: 10 additions & 0 deletions escher/css/builder.css
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@
width: 100%;
text-align: left;
}
.no-data-input {
width: 23%;
margin: 0 4px 0 4px;
}
.style-span {
margin: 0 4px;
}
Expand Down Expand Up @@ -190,4 +194,10 @@
.input-close-button:hover {
color: #ff3333;
font-weight: bold;
}
/* text edit input */
#text-edit-input input {
width: 500px;
border: none;
font-size: 22px;
}
47 changes: 36 additions & 11 deletions escher/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ body {
/* The html and body elements cannot have any padding or margin. */
}

body {
font-size: 15px;
color: #585858;
}

/* Wrapper for page content to push down footer */
main {
/* Negative indent footer by it's height */
Expand Down Expand Up @@ -42,22 +47,36 @@ footer a, a:hover, a:focus, a:visited {
}
.container .more {
margin: 20px 0;
float: left;
}
.container .version {
margin: 20px 0;
float: right;
}
.column-button {
width: 100%;
margin-top: 35px;
}
#title-box {
display: inline-block;
}
#title {
color: #291E1E;
font-size: 160px;
font-family: tulpen-one, serif;
font-family: tulpen-one, Futura, serif;
font-weight: 400;
/* font-style: italic; */
text-align: center;
}
#logo {
display: none;
width: 250px;
vertical-align: inherit;
}
@media (max-width: 768px) {
#title-box {
width: 100%;
text-align: center;
}
#logo {
display: none;
}
}
@media (min-width: 768px) { /*@screen-sm-min) { */
.column-button {
Expand All @@ -66,16 +85,22 @@ footer a, a:hover, a:focus, a:visited {
header {
margin-bottom: 50px;
}
#title-box {
max-width: 400px;
overflow: hidden;
}
#title {
position: relative;
top: 45px;
font-size: 230px;
text-align: left;
display: inline;
top: 100px;
position: relative;
}
#logo {
position: relative;
left: -20px;
display: inline;
width: 250px;
display: inline-block;
overflow: hidden;
}
#faq {
margin-top: 50px;
}
}
49 changes: 49 additions & 0 deletions escher/generate_index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import json
from os import listdir
from os.path import join, dirname, realpath, exists, isdir, relpath

directory = realpath(join(dirname(realpath(__file__)), '..'))

index_directories = ['maps/v1', 'models/v1']
ignore_files = ['index.json', 'README']

for index_dir in index_directories:
index = []
if not exists(join(directory, index_dir)):
print '%s does not exist' % index_dir
continue
for filename in listdir(join(directory, index_dir)):
if filename.endswith('.json') and filename not in ignore_files:
index.append(filename.replace('.json', ''))
with open(join(directory, index_dir, 'index.json'), 'w') as f:
json.dump(index, f)

# organism index
org_dir = join(directory, 'organisms')
org_index = []
model_index = []
map_index = []
# for all organisms
for d in listdir(org_dir):
org_file = join(org_dir, d)
if isdir(org_file):
org_index.append(relpath(org_file, directory))
# for nested models
model_dir = join(org_file, 'models')
if isdir(model_dir):
for e in listdir(model_dir):
model_file = join(model_dir, e)
if model_file.endswith('.json') and model_file not in ignore_files:
model_index.append(relpath(model_file, directory).replace('.json', ''))
map_dir = join(model_file, 'maps')
if isdir(map_dir):
for f in listdir(map_dir):
map_file = join(map_dir, f)
if map_file.endswith('.json') and map_file not in ignore_files:
map_index.append(relpath(map_file, directory).replace('.json', ''))

with open(join(directory, 'index.json'), 'w') as f:
index = {'organisms': org_index,
'models': model_index,
'maps': map_index}
json.dump(index, f)
Loading

0 comments on commit 79b79da

Please sign in to comment.