Skip to content

Commit

Permalink
Merge pull request #17 from ljvmiranda921/update-readme
Browse files Browse the repository at this point in the history
Update readme using LaTeX assets
  • Loading branch information
Lj Miranda committed Apr 18, 2018
2 parents 748f0b4 + b0fd7d3 commit e4a9cc5
Show file tree
Hide file tree
Showing 13 changed files with 283 additions and 2,041 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ __pycache__/
*.py[cod]
*$py.class

# TeX files
*.aux
*.fdb_latexmk
*.fls
*.pdf
*.synctex.gz

# Ipython notebooks
.ipynb_checkpoints

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Given a sequence of *H* and *P* molecules, find a configuration with the
highest number of adjacent **H-H** pairs. Your base score is determined by
the number of **H-H** pairs you can create.

<img src="/assets/pfolding_problem.svg" width="700">
<img src="./assets/overview.png" width="600">


### Folding Rules
Expand All @@ -64,7 +64,7 @@ protein conformation. For our purposes, here it is in its simplest form:
3. Assigning a molecule to an occupied space will incur a penalty.
4. Trapping yourself and running out of moves will give you a heavy deduction.

<img src="/assets/pfolding_rules.svg" width="700">
<img src="./assets/rules.png" width="700">

## Basic Usage

Expand Down
31 changes: 31 additions & 0 deletions assets/figures/actions_adjacent.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
% ==================================================
% Asset file for gym-lattice
% Author: Lester James V. Miranda

\begin{tikzpicture}[
latticegrid/.style={very thin,gray!40,step=10mm},
container/.style={draw,white,minimum width=30mm, minimum height=24mm},
hydrophobic/.style={circle,fill=black,text=white},
polar/.style={circle,fill=white,text=black},
unknown/.style={circle,red,thick,text=red,dashed},
new/.style={circle,thick,text=black,dashed},
hbonds/.style={very thick,red},
bonds/.style={->,thick,black}
]

% Draw grid
\node[container] (lattice) {};
\draw[latticegrid] (lattice.south west) grid (lattice.north east);

% Draw molecules
\draw[hydrophobic] ($(lattice.center)+(0,0)$) circle (4mm) node (s0) {H};
\draw[hydrophobic] ($(lattice.center)+(-10mm,0mm)$) circle (4mm) node (s1) {H};
\draw[polar] ($(lattice.center)+(-10mm,10mm)$) circle (4mm) node (s2) {P};
\draw[bonds] (s0) -- (s1);
\draw[bonds] (s1) -- (s2);

% Draw new and unknown
\draw[new] ($(lattice.center)+(0mm,10mm)$) circle (4mm) node (legal) {\checkmark};
\draw[unknown] ($(lattice.center)+(10mm,-10mm)$) circle (4mm) node (unk) {X};

\end{tikzpicture}
41 changes: 41 additions & 0 deletions assets/figures/actions_collision.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
% ==================================================
% Asset file for gym-lattice
% Author: Lester James V. Miranda

\begin{tikzpicture}[
latticegrid/.style={very thin,gray!40,step=10mm},
container/.style={draw,white,minimum width=30mm, minimum height=24mm},
hydrophobic/.style={circle,fill=black,text=white},
polar/.style={circle,fill=white,text=black},
unknown/.style={circle,red,thick,text=black,dashed},
new/.style={circle,thick,text=black,dashed},
hbonds/.style={very thick,red},
bonds/.style={->,thick,black},
collision/.style={->,very thick, red}
]

% Draw grid
\node[container] (lattice) {};
\draw[latticegrid] (lattice.south west) grid (lattice.north east);

% Draw molecules
\draw[hydrophobic] ($(lattice.center)+(0,0)$) circle (4mm) node (s0) {H};
\draw[hydrophobic] ($(lattice.center)+(-10mm,0mm)$) circle (4mm) node (s1) {H};
\draw[polar] ($(lattice.center)+(-10mm,10mm)$) circle (4mm) node (s3) {P};
\draw[hydrophobic] ($(lattice.center)+(0mm,10mm)$) circle (4mm) node (s4) {H};
\draw[polar] ($(lattice.center)+(10mm,10mm)$) circle (4mm) node (s5) {P};
\draw[polar] ($(lattice.center)+(10mm,0mm)$) circle (4mm) node (s6) {P};

% Bonds
\draw[bonds] (s0) -- (s1);
\draw[bonds] (s1) -- (s3);
\draw[bonds] (s3) -- (s4);
\draw[bonds] (s4) -- (s5);
\draw[bonds] (s5) -- (s6);
\draw[hbonds] (s0) -- (s4);

% Draw Collision
\draw[collision] (s6) -- (s0) node[below=0.50 and -0.6] {Collision!};

\end{tikzpicture}

29 changes: 29 additions & 0 deletions assets/figures/actions_ldur.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
% ==================================================
% Asset file for gym-lattice
% Author: Lester James V. Miranda

\begin{tikzpicture}[
latticegrid/.style={very thin,gray!40,step=10mm},
container/.style={draw,white,minimum width=30mm, minimum height=24mm},
hydrophobic/.style={circle,fill=black,text=white},
polar/.style={circle,fill=white,text=black},
unknown/.style={circle,red,thick,text=black,dashed},
new/.style={circle,thick,text=black,dashed},
hbonds/.style={very thick,red},
bonds/.style={->,thick,black}
]

% Draw grid
\node[container] (lattice) {};
\draw[latticegrid] (lattice.south west) grid (lattice.north east);

% Draw molecules
\draw[hydrophobic] ($(lattice.center)+(0,0)$) circle (4mm) node (h0) {H};

% Possible actions
\draw[new] ($(lattice.center)+(10mm,0mm)$) circle (4mm) node (h0) {\checkmark};
\draw[new] ($(lattice.center)+(-10mm,0mm)$) circle (4mm) node (h0) {\checkmark};
\draw[new] ($(lattice.center)+(0mm,10mm)$) circle (4mm) node (h0) {\checkmark};
\draw[new] ($(lattice.center)+(0mm,-10mm)$) circle (4mm) node (h0) {\checkmark};

\end{tikzpicture}
43 changes: 43 additions & 0 deletions assets/figures/actions_trap.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
% ==================================================
% Asset file for gym-lattice
% Author: Lester James V. Miranda

\begin{tikzpicture}[
latticegrid/.style={very thin,gray!40,step=10mm},
container/.style={draw,white,minimum width=30mm, minimum height=24mm},
hydrophobic/.style={circle,fill=black,text=white},
polar/.style={circle,fill=white,text=black},
unknown/.style={circle,red,thick,text=black,dashed},
new/.style={circle,thick,text=black,dashed},
hbonds/.style={very thick,red},
bonds/.style={->,thick,black},
collision/.style={->,very thick, red}
]

% Draw grid
\node[container] (lattice) {};
\draw[latticegrid] (lattice.south west) grid (lattice.north east);

% Draw molecules
\draw[hydrophobic] ($(lattice.center)+(-10mm,-10mm)$) circle (4mm) node (s0) {H};
\draw[hydrophobic] ($(lattice.center)+(-10mm,0mm)$) circle (4mm) node (s1) {H};
\draw[polar] ($(lattice.center)+(-10mm,10mm)$) circle (4mm) node (s2) {P};
\draw[hydrophobic] ($(lattice.center)+(0mm,10mm)$) circle (4mm) node (s3) {H};
\draw[hydrophobic] ($(lattice.center)+(10mm,10mm)$) circle (4mm) node (s4) {H};
\draw[hydrophobic] ($(lattice.center)+(10mm,0mm)$) circle (4mm) node (s5) {H};
\draw[polar] ($(lattice.center)+(10mm,-10mm)$) circle (4mm) node (s6) {P};
\draw[hydrophobic] ($(lattice.center)+(0mm,-10mm)$) circle (4mm) node (s7) {H};
\draw[polar] ($(lattice.center)+(0mm,0mm)$) circle (4mm) node (s8) {P};

% Bonds
\draw[bonds] (s0) -- (s1);
\draw[bonds] (s1) -- (s2);
\draw[bonds] (s2) -- (s3);
\draw[bonds] (s3) -- (s4);
\draw[bonds] (s4) -- (s5);
\draw[bonds] (s5) -- (s6);
\draw[bonds] (s6) -- (s7);
\draw[bonds] (s7) -- (s8);

\end{tikzpicture}

59 changes: 59 additions & 0 deletions assets/figures/demo_lattice.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
% ==================================================
% Asset file for gym-lattice
% Author: Lester James V. Miranda

\begin{tikzpicture}[
node distance=20mm,
agent/.style={draw,rounded corners,thick,color=black,fill=white},
latticegrid/.style={very thin,gray!40,step=10mm},
container/.style={draw,white,minimum width=45mm, minimum height=45mm},
hydrophobic/.style={circle,fill=black,text=white},
polar/.style={circle,fill=white,text=black},
unknown/.style={circle,red,thick,text=black,dashed},
new/.style={circle,thick,text=black,dashed},
hbonds/.style={very thick,red},
bonds/.style={->,thick,black},
collision/.style={->,very thick, red}
]


% Draw grid
\node[container,label={[align=center,yshift=0.6cm]
Find a configuration\\
with the highest number\\
of H-H pairs (\textcolor{red}{red} line)}] (lattice) {};
\draw[latticegrid] (lattice.south west) grid (lattice.north east);

% Draw molecules
\draw[hydrophobic] ($(lattice.center)+(-10mm,10mm)$) circle (4mm) node (s1) {H};
\draw[hydrophobic] ($(lattice.center)+(-10mm,0mm)$) circle (4mm) node (s2) {H};
\draw[hydrophobic] ($(lattice.center)+(-10mm,-10mm)$) circle (4mm) node (s3) {H};
\draw[polar] ($(lattice.center)+(0mm,-10mm)$) circle (4mm) node (s4) {P};
\draw[hydrophobic] ($(lattice.center)+(0mm,0mm)$) circle (4mm) node (s5) {H};
\draw[polar] ($(lattice.center)+(10mm,0mm)$) circle (4mm) node (s6) {P};
\draw[polar] ($(lattice.center)+(10mm,10mm)$) circle (4mm) node (s7) {P};
\draw[hydrophobic] ($(lattice.center)+(0mm,10mm)$) circle (4mm) node (s8) {H};
\draw[hydrophobic] ($(lattice.center)+(0mm,20mm)$) circle (4mm) node (s9) {H};

% Draw bonds
\draw[bonds] (s1) -- (s2);
\draw[bonds] (s2) -- (s3);
\draw[bonds] (s3) -- (s4);
\draw[bonds] (s4) -- (s5);
\draw[bonds] (s5) -- (s6);
\draw[bonds] (s6) -- (s7);
\draw[bonds] (s7) -- (s8);
\draw[bonds] (s8) -- (s9);
\draw[hbonds] (s1) -- (s8);
\draw[hbonds] (s2) -- (s5);
\draw[hbonds] (s5) -- (s8);

% Add a node
\node[agent,text=black, align=center, label={[align=center,yshift=3.0cm]Given a protein sequence,}]
(textbox)[left= of lattice]{\Large $HHHPHPPHH$};

% Draw bonds
\draw[bonds] (textbox.east) -- (lattice.west);


\end{tikzpicture}
Binary file added assets/overview.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions assets/overview.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
% ==================================================
% Asset file for gym-lattice
% Author: Lester James V. Miranda
%
% To compile, simpy run:
% >>> pdflatex -shell-escape rules.tex
%
% This creates both .pdf and .svg files that you can
% see in the README.md

\documentclass[preview,convert={outfile=\jobname.png,density=300}]{standalone}

\usepackage{tikz}
\usepackage{color}
\usepackage{subfig}

\renewcommand\familydefault{\sfdefault}

\usetikzlibrary{
matrix,shapes,
arrows,positioning,
calc}

\def\checkmark{
\tikz\fill[scale=0.4]
(0,.35) -- (.25,0) -- (1,.7) -- (.25,.15) -- cycle;}

\begin{document}
\input{./figures/demo_lattice.tex}
\end{document}

0 comments on commit e4a9cc5

Please sign in to comment.