commit e52c18a09cabd374093b06ef0f521767cd228ba6 Author: Navan Chauhan Date: Wed Jun 24 23:39:05 2020 +0530 make it better diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0a3bad0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +# Files to ignore when adding and committing files to a repository +.DS_Store +Thumbs.db + +*.py[cod] +*$py.class + +# virtualenv +.venv/ +venv/ + +# PyCharm +.idea + +# VS Code +.vscode \ No newline at end of file diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..2ac01f7 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: gunicorn -w 4 -b "0.0.0.0:$PORT" app:app \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f28b951 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Forms in Flask + +In this Flask app we will demonstrate the basics of processing forms and also using a form library called WT Forms. \ No newline at end of file diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..d2b7088 --- /dev/null +++ b/app/__init__.py @@ -0,0 +1,13 @@ +from flask import Flask + +# Config Values +# location where file uploads will be stored +UPLOAD_FOLDER = './app/static/uploads' +# needed for session security, the flash() method in this case stores the message +# in a session +SECRET_KEY = 'Sup3r$3cretkey' + +app = Flask(__name__) +app.config.from_object(__name__) + +from app import views \ No newline at end of file diff --git a/app/forms.py b/app/forms.py new file mode 100644 index 0000000..5d64507 --- /dev/null +++ b/app/forms.py @@ -0,0 +1,30 @@ +from flask_wtf import FlaskForm +from flask_wtf.file import FileField, FileRequired, FileAllowed +from wtforms import StringField, DecimalField +from wtforms.validators import DataRequired, Email + + +class MyForm(FlaskForm): + firstname = StringField('First Name', validators=[DataRequired()]) + lastname = StringField('Last Name', validators=[DataRequired()]) + email = StringField('Email', validators=[DataRequired(), Email()]) + + +class curieForm(FlaskForm): + ligand = FileField('Ligand', validators=[ + FileRequired(), + FileAllowed(['pdbqt', 'PDBQT only!']) + ]) + target = FileField('Receptor / Target', validators=[ + FileRequired(), + FileAllowed(['pdbqt', 'PDBQT only!']) + ]) + description = StringField('Description',default="Curie Web Task") + + size_x = DecimalField('Size X',default=25.0) + size_y = DecimalField('Size Y',default=25.0) + size_z = DecimalField('Size Z',default=25.0) + + center_x = DecimalField('Center X',default=0) + center_y = DecimalField('Center Y',default=0) + center_z = DecimalField('Center Z',default=0) \ No newline at end of file diff --git a/app/static/css/styles.css b/app/static/css/styles.css new file mode 100644 index 0000000..76f93ca --- /dev/null +++ b/app/static/css/styles.css @@ -0,0 +1,21 @@ +:root { + +} + +html { + position: relative; + min-height: 100%; +} + +body { + margin-bottom: 60px; /* Margin bottom by footer height */ +} + +footer { + position: absolute; + bottom: 0; + width: 100%; + height: 60px; + line-height: 60px; + background-color: #f5f5f5; +} \ No newline at end of file diff --git a/app/static/uploads/.gitkeep b/app/static/uploads/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/static/uploads/3-Chloro-5-hydroxy-2-methylnaphthalene-14-dione.pdbqt b/app/static/uploads/3-Chloro-5-hydroxy-2-methylnaphthalene-14-dione.pdbqt new file mode 100644 index 0000000..f6ac4d3 --- /dev/null +++ b/app/static/uploads/3-Chloro-5-hydroxy-2-methylnaphthalene-14-dione.pdbqt @@ -0,0 +1,28 @@ +REMARK Name = 338719 +REMARK 2 active torsions: +REMARK status: ('A' for Active; 'I' for Inactive) +REMARK 1 A between atoms: O_2 and C_11 +REMARK 2 A between atoms: C_7 and C_14 +REMARK x y z vdW Elec q Type +REMARK _______ _______ _______ _____ _____ ______ ____ +ROOT +ATOM 1 CL UNL 1 2.000 -0.825 0.000 0.00 0.00 +0.000 Cl +ATOM 2 O UNL 1 3.732 2.175 0.000 0.00 0.00 +0.000 OA +ATOM 3 O UNL 1 3.732 -1.825 0.000 0.00 0.00 +0.000 OA +ATOM 4 C UNL 1 4.598 0.675 0.000 0.00 0.00 +0.000 A +ATOM 5 C UNL 1 4.598 -0.325 0.000 0.00 0.00 +0.000 A +ATOM 6 C UNL 1 2.866 0.675 0.000 0.00 0.00 +0.000 C +ATOM 7 C UNL 1 3.732 1.175 0.000 0.00 0.00 +0.000 C +ATOM 8 C UNL 1 3.732 -0.825 0.000 0.00 0.00 +0.000 C +ATOM 9 C UNL 1 2.866 -0.325 0.000 0.00 0.00 +0.000 C +ATOM 10 C UNL 1 5.492 -0.859 0.000 0.00 0.00 +0.000 A +ATOM 11 C UNL 1 5.492 1.210 0.000 0.00 0.00 +0.000 A +ATOM 12 C UNL 1 6.398 -0.345 0.000 0.00 0.00 +0.000 A +ATOM 13 C UNL 1 2.000 1.175 0.000 0.00 0.00 +0.000 C +ATOM 14 C UNL 1 6.398 0.696 0.000 0.00 0.00 +0.000 A +ENDROOT +BRANCH 10 15 +ATOM 15 O UNL 1 5.480 -1.859 0.000 0.00 0.00 +0.000 OA +ATOM 16 H UNL 1 6.014 -2.175 0.000 0.00 0.00 +0.000 HD +ENDBRANCH 10 15 +TORSDOF 1 diff --git a/app/static/uploads/aloe_out.pdbqt b/app/static/uploads/aloe_out.pdbqt new file mode 100644 index 0000000..e78e371 --- /dev/null +++ b/app/static/uploads/aloe_out.pdbqt @@ -0,0 +1,414 @@ +MODEL 1 +REMARK VINA RESULT: -7.4 0.000 0.000 +REMARK Name = 10207 +REMARK 4 active torsions: +REMARK status: ('A' for Active; 'I' for Inactive) +REMARK 1 A between atoms: O_1 and C_13 +REMARK 2 A between atoms: O_4 and C_16 +REMARK 3 A between atoms: O_5 and C_18 +REMARK 4 A between atoms: C_14 and C_18 +REMARK x y z vdW Elec q Type +REMARK _______ _______ _______ _____ _____ ______ ____ +ROOT +ATOM 1 O UNL 1 -10.956 18.153 64.952 0.00 0.00 +0.000 OA +ATOM 2 O UNL 1 -9.566 16.383 68.259 0.00 0.00 +0.000 OA +ATOM 3 C UNL 1 -10.178 16.272 66.643 0.00 0.00 +0.000 A +ATOM 4 C UNL 1 -10.526 16.715 65.816 0.00 0.00 +0.000 A +ATOM 5 C UNL 1 -10.343 18.264 66.569 0.00 0.00 +0.000 A +ATOM 6 C UNL 1 -9.995 17.821 67.395 0.00 0.00 +0.000 A +ATOM 7 C UNL 1 -10.608 17.711 65.779 0.00 0.00 +0.000 C +ATOM 8 C UNL 1 -9.913 16.825 67.432 0.00 0.00 +0.000 C +ATOM 9 C UNL 1 -10.087 15.236 66.696 0.00 0.00 +0.000 A +ATOM 10 C UNL 1 -10.806 16.151 64.986 0.00 0.00 +0.000 A +ATOM 11 C UNL 1 -10.361 14.653 65.878 0.00 0.00 +0.000 A +ATOM 12 C UNL 1 -10.723 15.114 65.017 0.00 0.00 +0.000 A +ATOM 13 C UNL 1 -10.434 19.300 66.516 0.00 0.00 +0.000 A +ATOM 14 C UNL 1 -9.715 18.384 68.226 0.00 0.00 +0.000 A +ATOM 15 C UNL 1 -10.159 19.883 67.334 0.00 0.00 +0.000 A +ATOM 16 C UNL 1 -9.798 19.422 68.195 0.00 0.00 +0.000 A +ENDROOT +BRANCH 10 17 +ATOM 17 O UNL 1 -11.152 16.605 64.165 0.00 0.00 +0.000 OA +ATOM 18 H UNL 1 -11.758 16.582 64.030 0.00 0.00 +0.000 HD +ENDBRANCH 10 17 +BRANCH 13 19 +ATOM 19 O UNL 1 -10.783 19.732 65.684 0.00 0.00 +0.000 OA +ATOM 20 H UNL 1 -11.330 20.023 65.693 0.00 0.00 +0.000 HD +ENDBRANCH 13 19 +BRANCH 11 21 +ATOM 21 C UNL 1 -10.278 13.657 65.919 0.00 0.00 +0.000 C +BRANCH 21 22 +ATOM 22 O UNL 1 -9.491 13.204 65.498 0.00 0.00 +0.000 OA +ATOM 23 H UNL 1 -9.096 13.530 65.149 0.00 0.00 +0.000 HD +ENDBRANCH 21 22 +ENDBRANCH 11 21 +TORSDOF 4 +ENDMDL +MODEL 2 +REMARK VINA RESULT: -7.4 1.459 2.074 +REMARK Name = 10207 +REMARK 4 active torsions: +REMARK status: ('A' for Active; 'I' for Inactive) +REMARK 1 A between atoms: O_1 and C_13 +REMARK 2 A between atoms: O_4 and C_16 +REMARK 3 A between atoms: O_5 and C_18 +REMARK 4 A between atoms: C_14 and C_18 +REMARK x y z vdW Elec q Type +REMARK _______ _______ _______ _____ _____ ______ ____ +ROOT +ATOM 1 O UNL 1 -11.038 17.179 64.704 0.00 0.00 +0.000 OA +ATOM 2 O UNL 1 -10.093 14.217 67.221 0.00 0.00 +0.000 OA +ATOM 3 C UNL 1 -10.911 14.774 65.799 0.00 0.00 +0.000 A +ATOM 4 C UNL 1 -11.147 15.514 65.170 0.00 0.00 +0.000 A +ATOM 5 C UNL 1 -10.220 16.622 66.125 0.00 0.00 +0.000 A +ATOM 6 C UNL 1 -9.983 15.881 66.754 0.00 0.00 +0.000 A +ATOM 7 C UNL 1 -10.801 16.438 65.333 0.00 0.00 +0.000 C +ATOM 8 C UNL 1 -10.329 14.957 66.591 0.00 0.00 +0.000 C +ATOM 9 C UNL 1 -11.263 13.806 65.643 0.00 0.00 +0.000 A +ATOM 10 C UNL 1 -11.752 15.338 64.341 0.00 0.00 +0.000 A +ATOM 11 C UNL 1 -11.870 13.607 64.820 0.00 0.00 +0.000 A +ATOM 12 C UNL 1 -12.116 14.378 64.165 0.00 0.00 +0.000 A +ATOM 13 C UNL 1 -9.867 17.589 66.282 0.00 0.00 +0.000 A +ATOM 14 C UNL 1 -9.378 16.057 67.584 0.00 0.00 +0.000 A +ATOM 15 C UNL 1 -9.260 17.788 67.105 0.00 0.00 +0.000 A +ATOM 16 C UNL 1 -9.014 17.017 67.760 0.00 0.00 +0.000 A +ENDROOT +BRANCH 10 17 +ATOM 17 O UNL 1 -11.982 16.086 63.718 0.00 0.00 +0.000 OA +ATOM 18 H UNL 1 -11.942 16.001 63.105 0.00 0.00 +0.000 HD +ENDBRANCH 10 17 +BRANCH 13 19 +ATOM 19 O UNL 1 -10.110 18.322 65.646 0.00 0.00 +0.000 OA +ATOM 20 H UNL 1 -9.793 18.855 65.653 0.00 0.00 +0.000 HD +ENDBRANCH 13 19 +BRANCH 11 21 +ATOM 21 C UNL 1 -12.214 12.681 64.660 0.00 0.00 +0.000 C +BRANCH 21 22 +ATOM 22 O UNL 1 -13.192 12.490 64.744 0.00 0.00 +0.000 OA +ATOM 23 H UNL 1 -13.520 12.748 65.203 0.00 0.00 +0.000 HD +ENDBRANCH 21 22 +ENDBRANCH 11 21 +TORSDOF 4 +ENDMDL +MODEL 3 +REMARK VINA RESULT: -7.1 0.944 3.863 +REMARK Name = 10207 +REMARK 4 active torsions: +REMARK status: ('A' for Active; 'I' for Inactive) +REMARK 1 A between atoms: O_1 and C_13 +REMARK 2 A between atoms: O_4 and C_16 +REMARK 3 A between atoms: O_5 and C_18 +REMARK 4 A between atoms: C_14 and C_18 +REMARK x y z vdW Elec q Type +REMARK _______ _______ _______ _____ _____ ______ ____ +ROOT +ATOM 1 O UNL 1 -11.053 17.886 64.882 0.00 0.00 +0.000 OA +ATOM 2 O UNL 1 -9.289 15.847 67.837 0.00 0.00 +0.000 OA +ATOM 3 C UNL 1 -9.781 17.355 67.140 0.00 0.00 +0.000 A +ATOM 4 C UNL 1 -10.222 17.865 66.402 0.00 0.00 +0.000 A +ATOM 5 C UNL 1 -10.561 16.379 65.579 0.00 0.00 +0.000 A +ATOM 6 C UNL 1 -10.120 15.869 66.317 0.00 0.00 +0.000 A +ATOM 7 C UNL 1 -10.612 17.377 65.621 0.00 0.00 +0.000 C +ATOM 8 C UNL 1 -9.730 16.357 67.098 0.00 0.00 +0.000 C +ATOM 9 C UNL 1 -9.369 17.849 67.960 0.00 0.00 +0.000 A +ATOM 10 C UNL 1 -10.282 18.904 66.432 0.00 0.00 +0.000 A +ATOM 11 C UNL 1 -9.419 18.888 68.011 0.00 0.00 +0.000 A +ATOM 12 C UNL 1 -9.878 19.419 67.242 0.00 0.00 +0.000 A +ATOM 13 C UNL 1 -10.972 15.884 64.759 0.00 0.00 +0.000 A +ATOM 14 C UNL 1 -10.059 14.829 66.288 0.00 0.00 +0.000 A +ATOM 15 C UNL 1 -10.922 14.845 64.709 0.00 0.00 +0.000 A +ATOM 16 C UNL 1 -10.463 14.314 65.478 0.00 0.00 +0.000 A +ENDROOT +BRANCH 10 17 +ATOM 17 O UNL 1 -10.725 19.403 65.688 0.00 0.00 +0.000 OA +ATOM 18 H UNL 1 -10.861 19.112 65.157 0.00 0.00 +0.000 HD +ENDBRANCH 10 17 +BRANCH 13 19 +ATOM 19 O UNL 1 -11.410 16.404 64.027 0.00 0.00 +0.000 OA +ATOM 20 H UNL 1 -12.014 16.542 64.063 0.00 0.00 +0.000 HD +ENDBRANCH 13 19 +BRANCH 11 21 +ATOM 21 C UNL 1 -9.027 19.372 68.794 0.00 0.00 +0.000 C +BRANCH 21 22 +ATOM 22 O UNL 1 -8.034 19.455 68.884 0.00 0.00 +0.000 OA +ATOM 23 H UNL 1 -7.742 19.181 69.357 0.00 0.00 +0.000 HD +ENDBRANCH 21 22 +ENDBRANCH 11 21 +TORSDOF 4 +ENDMDL +MODEL 4 +REMARK VINA RESULT: -7.0 1.458 4.437 +REMARK Name = 10207 +REMARK 4 active torsions: +REMARK status: ('A' for Active; 'I' for Inactive) +REMARK 1 A between atoms: O_1 and C_13 +REMARK 2 A between atoms: O_4 and C_16 +REMARK 3 A between atoms: O_5 and C_18 +REMARK 4 A between atoms: C_14 and C_18 +REMARK x y z vdW Elec q Type +REMARK _______ _______ _______ _____ _____ ______ ____ +ROOT +ATOM 1 O UNL 1 -11.835 15.582 63.966 0.00 0.00 +0.000 OA +ATOM 2 O UNL 1 -10.198 13.689 67.086 0.00 0.00 +0.000 OA +ATOM 3 C UNL 1 -10.474 15.147 66.193 0.00 0.00 +0.000 A +ATOM 4 C UNL 1 -10.883 15.620 65.413 0.00 0.00 +0.000 A +ATOM 5 C UNL 1 -11.558 14.124 64.859 0.00 0.00 +0.000 A +ATOM 6 C UNL 1 -11.149 13.651 65.639 0.00 0.00 +0.000 A +ATOM 7 C UNL 1 -11.425 15.109 64.746 0.00 0.00 +0.000 C +ATOM 8 C UNL 1 -10.607 14.163 66.306 0.00 0.00 +0.000 C +ATOM 9 C UNL 1 -9.907 15.666 66.896 0.00 0.00 +0.000 A +ATOM 10 C UNL 1 -10.754 16.645 65.282 0.00 0.00 +0.000 A +ATOM 11 C UNL 1 -9.764 16.692 66.784 0.00 0.00 +0.000 A +ATOM 12 C UNL 1 -10.190 17.185 65.972 0.00 0.00 +0.000 A +ATOM 13 C UNL 1 -12.125 13.605 64.157 0.00 0.00 +0.000 A +ATOM 14 C UNL 1 -11.279 12.626 65.771 0.00 0.00 +0.000 A +ATOM 15 C UNL 1 -12.268 12.579 64.269 0.00 0.00 +0.000 A +ATOM 16 C UNL 1 -11.842 12.086 65.081 0.00 0.00 +0.000 A +ENDROOT +BRANCH 10 17 +ATOM 17 O UNL 1 -11.167 17.108 64.498 0.00 0.00 +0.000 OA +ATOM 18 H UNL 1 -11.374 16.776 64.016 0.00 0.00 +0.000 HD +ENDBRANCH 10 17 +BRANCH 13 19 +ATOM 19 O UNL 1 -12.530 14.088 63.381 0.00 0.00 +0.000 OA +ATOM 20 H UNL 1 -12.559 13.813 62.825 0.00 0.00 +0.000 HD +ENDBRANCH 13 19 +BRANCH 11 21 +ATOM 21 C UNL 1 -9.221 17.200 67.453 0.00 0.00 +0.000 C +BRANCH 21 22 +ATOM 22 O UNL 1 -9.673 17.658 68.219 0.00 0.00 +0.000 OA +ATOM 23 H UNL 1 -9.996 18.178 68.123 0.00 0.00 +0.000 HD +ENDBRANCH 21 22 +ENDBRANCH 11 21 +TORSDOF 4 +ENDMDL +MODEL 5 +REMARK VINA RESULT: -6.9 2.672 3.778 +REMARK Name = 10207 +REMARK 4 active torsions: +REMARK status: ('A' for Active; 'I' for Inactive) +REMARK 1 A between atoms: O_1 and C_13 +REMARK 2 A between atoms: O_4 and C_16 +REMARK 3 A between atoms: O_5 and C_18 +REMARK 4 A between atoms: C_14 and C_18 +REMARK x y z vdW Elec q Type +REMARK _______ _______ _______ _____ _____ ______ ____ +ROOT +ATOM 1 O UNL 1 -11.295 15.819 65.633 0.00 0.00 +0.000 OA +ATOM 2 O UNL 1 -11.967 12.146 67.067 0.00 0.00 +0.000 OA +ATOM 3 C UNL 1 -11.897 13.245 65.730 0.00 0.00 +0.000 A +ATOM 4 C UNL 1 -11.728 14.163 65.371 0.00 0.00 +0.000 A +ATOM 5 C UNL 1 -11.365 14.721 66.970 0.00 0.00 +0.000 A +ATOM 6 C UNL 1 -11.534 13.803 67.329 0.00 0.00 +0.000 A +ATOM 7 C UNL 1 -11.463 14.901 65.992 0.00 0.00 +0.000 C +ATOM 8 C UNL 1 -11.799 13.065 66.709 0.00 0.00 +0.000 C +ATOM 9 C UNL 1 -12.174 12.465 65.096 0.00 0.00 +0.000 A +ATOM 10 C UNL 1 -11.826 14.365 64.355 0.00 0.00 +0.000 A +ATOM 11 C UNL 1 -12.277 12.646 64.076 0.00 0.00 +0.000 A +ATOM 12 C UNL 1 -12.102 13.602 63.702 0.00 0.00 +0.000 A +ATOM 13 C UNL 1 -11.088 15.499 67.604 0.00 0.00 +0.000 A +ATOM 14 C UNL 1 -11.436 13.599 68.346 0.00 0.00 +0.000 A +ATOM 15 C UNL 1 -10.985 15.319 68.625 0.00 0.00 +0.000 A +ATOM 16 C UNL 1 -11.160 14.363 68.998 0.00 0.00 +0.000 A +ENDROOT +BRANCH 10 17 +ATOM 17 O UNL 1 -11.656 15.287 64.007 0.00 0.00 +0.000 OA +ATOM 18 H UNL 1 -11.290 15.675 64.325 0.00 0.00 +0.000 HD +ENDBRANCH 10 17 +BRANCH 13 19 +ATOM 19 O UNL 1 -10.923 16.414 67.235 0.00 0.00 +0.000 OA +ATOM 20 H UNL 1 -11.399 16.800 67.139 0.00 0.00 +0.000 HD +ENDBRANCH 13 19 +BRANCH 11 21 +ATOM 21 C UNL 1 -12.543 11.905 63.459 0.00 0.00 +0.000 C +BRANCH 21 22 +ATOM 22 O UNL 1 -11.969 11.089 63.381 0.00 0.00 +0.000 OA +ATOM 23 H UNL 1 -11.547 11.049 62.928 0.00 0.00 +0.000 HD +ENDBRANCH 21 22 +ENDBRANCH 11 21 +TORSDOF 4 +ENDMDL +MODEL 6 +REMARK VINA RESULT: -6.8 1.985 3.555 +REMARK Name = 10207 +REMARK 4 active torsions: +REMARK status: ('A' for Active; 'I' for Inactive) +REMARK 1 A between atoms: O_1 and C_13 +REMARK 2 A between atoms: O_4 and C_16 +REMARK 3 A between atoms: O_5 and C_18 +REMARK 4 A between atoms: C_14 and C_18 +REMARK x y z vdW Elec q Type +REMARK _______ _______ _______ _____ _____ ______ ____ +ROOT +ATOM 1 O UNL 1 -11.564 13.884 68.019 0.00 0.00 +0.000 OA +ATOM 2 O UNL 1 -10.718 15.881 64.658 0.00 0.00 +0.000 OA +ATOM 3 C UNL 1 -11.315 14.460 65.449 0.00 0.00 +0.000 A +ATOM 4 C UNL 1 -11.526 13.961 66.289 0.00 0.00 +0.000 A +ATOM 5 C UNL 1 -10.968 15.305 67.228 0.00 0.00 +0.000 A +ATOM 6 C UNL 1 -10.756 15.804 66.388 0.00 0.00 +0.000 A +ATOM 7 C UNL 1 -11.353 14.383 67.179 0.00 0.00 +0.000 C +ATOM 8 C UNL 1 -10.930 15.382 65.498 0.00 0.00 +0.000 C +ATOM 9 C UNL 1 -11.490 14.034 64.514 0.00 0.00 +0.000 A +ATOM 10 C UNL 1 -11.927 13.000 66.253 0.00 0.00 +0.000 A +ATOM 11 C UNL 1 -11.890 13.074 64.455 0.00 0.00 +0.000 A +ATOM 12 C UNL 1 -12.110 12.554 65.330 0.00 0.00 +0.000 A +ATOM 13 C UNL 1 -10.793 15.732 68.162 0.00 0.00 +0.000 A +ATOM 14 C UNL 1 -10.355 16.765 66.423 0.00 0.00 +0.000 A +ATOM 15 C UNL 1 -10.392 16.691 68.221 0.00 0.00 +0.000 A +ATOM 16 C UNL 1 -10.172 17.211 67.346 0.00 0.00 +0.000 A +ENDROOT +BRANCH 10 17 +ATOM 17 O UNL 1 -12.135 12.510 67.099 0.00 0.00 +0.000 OA +ATOM 18 H UNL 1 -12.191 12.823 67.632 0.00 0.00 +0.000 HD +ENDBRANCH 10 17 +BRANCH 13 19 +ATOM 19 O UNL 1 -11.008 15.223 68.995 0.00 0.00 +0.000 OA +ATOM 20 H UNL 1 -11.447 15.432 69.380 0.00 0.00 +0.000 HD +ENDBRANCH 13 19 +BRANCH 11 21 +ATOM 21 C UNL 1 -12.062 12.655 63.563 0.00 0.00 +0.000 C +BRANCH 21 22 +ATOM 22 O UNL 1 -12.927 12.182 63.392 0.00 0.00 +0.000 OA +ATOM 23 H UNL 1 -12.967 11.569 63.477 0.00 0.00 +0.000 HD +ENDBRANCH 21 22 +ENDBRANCH 11 21 +TORSDOF 4 +ENDMDL +MODEL 7 +REMARK VINA RESULT: -6.8 1.904 4.994 +REMARK Name = 10207 +REMARK 4 active torsions: +REMARK status: ('A' for Active; 'I' for Inactive) +REMARK 1 A between atoms: O_1 and C_13 +REMARK 2 A between atoms: O_4 and C_16 +REMARK 3 A between atoms: O_5 and C_18 +REMARK 4 A between atoms: C_14 and C_18 +REMARK x y z vdW Elec q Type +REMARK _______ _______ _______ _____ _____ ______ ____ +ROOT +ATOM 1 O UNL 1 -12.181 13.358 67.639 0.00 0.00 +0.000 OA +ATOM 2 O UNL 1 -9.929 15.645 65.252 0.00 0.00 +0.000 OA +ATOM 3 C UNL 1 -10.777 15.414 66.745 0.00 0.00 +0.000 A +ATOM 4 C UNL 1 -11.340 14.842 67.341 0.00 0.00 +0.000 A +ATOM 5 C UNL 1 -11.333 13.588 66.147 0.00 0.00 +0.000 A +ATOM 6 C UNL 1 -10.770 14.160 65.550 0.00 0.00 +0.000 A +ATOM 7 C UNL 1 -11.618 13.929 67.042 0.00 0.00 +0.000 C +ATOM 8 C UNL 1 -10.492 15.073 65.849 0.00 0.00 +0.000 C +ATOM 9 C UNL 1 -10.480 16.367 67.042 0.00 0.00 +0.000 A +ATOM 10 C UNL 1 -11.644 15.184 68.277 0.00 0.00 +0.000 A +ATOM 11 C UNL 1 -10.773 16.729 67.974 0.00 0.00 +0.000 A +ATOM 12 C UNL 1 -11.359 16.134 68.595 0.00 0.00 +0.000 A +ATOM 13 C UNL 1 -11.630 12.636 65.849 0.00 0.00 +0.000 A +ATOM 14 C UNL 1 -10.465 13.819 64.614 0.00 0.00 +0.000 A +ATOM 15 C UNL 1 -11.336 12.274 64.917 0.00 0.00 +0.000 A +ATOM 16 C UNL 1 -10.750 12.869 64.296 0.00 0.00 +0.000 A +ENDROOT +BRANCH 10 17 +ATOM 17 O UNL 1 -12.207 14.604 68.865 0.00 0.00 +0.000 OA +ATOM 18 H UNL 1 -12.800 14.753 68.971 0.00 0.00 +0.000 HD +ENDBRANCH 10 17 +BRANCH 13 19 +ATOM 19 O UNL 1 -12.193 12.073 66.454 0.00 0.00 +0.000 OA +ATOM 20 H UNL 1 -12.017 11.979 67.041 0.00 0.00 +0.000 HD +ENDBRANCH 13 19 +BRANCH 11 21 +ATOM 21 C UNL 1 -10.493 17.643 68.269 0.00 0.00 +0.000 C +BRANCH 21 22 +ATOM 22 O UNL 1 -10.819 18.449 67.775 0.00 0.00 +0.000 OA +ATOM 23 H UNL 1 -10.418 18.802 67.459 0.00 0.00 +0.000 HD +ENDBRANCH 21 22 +ENDBRANCH 11 21 +TORSDOF 4 +ENDMDL +MODEL 8 +REMARK VINA RESULT: -6.7 2.738 5.186 +REMARK Name = 10207 +REMARK 4 active torsions: +REMARK status: ('A' for Active; 'I' for Inactive) +REMARK 1 A between atoms: O_1 and C_13 +REMARK 2 A between atoms: O_4 and C_16 +REMARK 3 A between atoms: O_5 and C_18 +REMARK 4 A between atoms: C_14 and C_18 +REMARK x y z vdW Elec q Type +REMARK _______ _______ _______ _____ _____ ______ ____ +ROOT +ATOM 1 O UNL 1 -12.362 12.151 66.385 0.00 0.00 +0.000 OA +ATOM 2 O UNL 1 -8.961 14.214 66.799 0.00 0.00 +0.000 OA +ATOM 3 C UNL 1 -10.542 14.051 66.111 0.00 0.00 +0.000 A +ATOM 4 C UNL 1 -11.392 13.536 66.008 0.00 0.00 +0.000 A +ATOM 5 C UNL 1 -10.781 12.314 67.073 0.00 0.00 +0.000 A +ATOM 6 C UNL 1 -9.931 12.830 67.176 0.00 0.00 +0.000 A +ATOM 7 C UNL 1 -11.512 12.667 66.488 0.00 0.00 +0.000 C +ATOM 8 C UNL 1 -9.811 13.698 66.695 0.00 0.00 +0.000 C +ATOM 9 C UNL 1 -10.402 14.958 65.617 0.00 0.00 +0.000 A +ATOM 10 C UNL 1 -12.162 13.891 65.403 0.00 0.00 +0.000 A +ATOM 11 C UNL 1 -11.159 15.332 65.007 0.00 0.00 +0.000 A +ATOM 12 C UNL 1 -12.045 14.795 64.899 0.00 0.00 +0.000 A +ATOM 13 C UNL 1 -10.920 11.408 67.567 0.00 0.00 +0.000 A +ATOM 14 C UNL 1 -9.160 12.475 67.781 0.00 0.00 +0.000 A +ATOM 15 C UNL 1 -10.163 11.034 68.177 0.00 0.00 +0.000 A +ATOM 16 C UNL 1 -9.277 11.571 68.285 0.00 0.00 +0.000 A +ENDROOT +BRANCH 10 17 +ATOM 17 O UNL 1 -13.008 13.367 65.307 0.00 0.00 +0.000 OA +ATOM 18 H UNL 1 -13.394 13.485 64.835 0.00 0.00 +0.000 HD +ENDBRANCH 10 17 +BRANCH 13 19 +ATOM 19 O UNL 1 -11.774 10.901 67.456 0.00 0.00 +0.000 OA +ATOM 20 H UNL 1 -12.144 10.806 67.946 0.00 0.00 +0.000 HD +ENDBRANCH 13 19 +BRANCH 11 21 +ATOM 21 C UNL 1 -11.036 16.201 64.528 0.00 0.00 +0.000 C +BRANCH 21 22 +ATOM 22 O UNL 1 -11.636 16.441 63.765 0.00 0.00 +0.000 OA +ATOM 23 H UNL 1 -12.224 16.607 63.873 0.00 0.00 +0.000 HD +ENDBRANCH 21 22 +ENDBRANCH 11 21 +TORSDOF 4 +ENDMDL +MODEL 9 +REMARK VINA RESULT: -6.7 3.569 5.637 +REMARK Name = 10207 +REMARK 4 active torsions: +REMARK status: ('A' for Active; 'I' for Inactive) +REMARK 1 A between atoms: O_1 and C_13 +REMARK 2 A between atoms: O_4 and C_16 +REMARK 3 A between atoms: O_5 and C_18 +REMARK 4 A between atoms: C_14 and C_18 +REMARK x y z vdW Elec q Type +REMARK _______ _______ _______ _____ _____ ______ ____ +ROOT +ATOM 1 O UNL 1 -9.479 12.463 65.968 0.00 0.00 +0.000 OA +ATOM 2 O UNL 1 -13.191 13.918 65.653 0.00 0.00 +0.000 OA +ATOM 3 C UNL 1 -11.717 13.748 66.547 0.00 0.00 +0.000 A +ATOM 4 C UNL 1 -10.789 13.384 66.626 0.00 0.00 +0.000 A +ATOM 5 C UNL 1 -10.952 12.633 65.074 0.00 0.00 +0.000 A +ATOM 6 C UNL 1 -11.880 12.996 64.995 0.00 0.00 +0.000 A +ATOM 7 C UNL 1 -10.407 12.827 65.889 0.00 0.00 +0.000 C +ATOM 8 C UNL 1 -12.263 13.554 65.732 0.00 0.00 +0.000 C +ATOM 9 C UNL 1 -12.130 14.331 67.306 0.00 0.00 +0.000 A +ATOM 10 C UNL 1 -10.210 13.578 67.469 0.00 0.00 +0.000 A +ATOM 11 C UNL 1 -11.568 14.537 68.158 0.00 0.00 +0.000 A +ATOM 12 C UNL 1 -10.601 14.158 68.240 0.00 0.00 +0.000 A +ATOM 13 C UNL 1 -10.541 12.050 64.315 0.00 0.00 +0.000 A +ATOM 14 C UNL 1 -12.461 12.803 64.152 0.00 0.00 +0.000 A +ATOM 15 C UNL 1 -11.103 11.844 63.463 0.00 0.00 +0.000 A +ATOM 16 C UNL 1 -12.069 12.223 63.381 0.00 0.00 +0.000 A +ENDROOT +BRANCH 10 17 +ATOM 17 O UNL 1 -9.283 13.209 67.537 0.00 0.00 +0.000 OA +ATOM 18 H UNL 1 -8.796 13.594 67.544 0.00 0.00 +0.000 HD +ENDBRANCH 10 17 +BRANCH 13 19 +ATOM 19 O UNL 1 -9.611 11.692 64.405 0.00 0.00 +0.000 OA +ATOM 20 H UNL 1 -9.190 11.811 63.965 0.00 0.00 +0.000 HD +ENDBRANCH 13 19 +BRANCH 11 21 +ATOM 21 C UNL 1 -11.954 15.095 68.893 0.00 0.00 +0.000 C +BRANCH 21 22 +ATOM 22 O UNL 1 -12.181 16.055 68.724 0.00 0.00 +0.000 OA +ATOM 23 H UNL 1 -11.729 16.478 68.689 0.00 0.00 +0.000 HD +ENDBRANCH 21 22 +ENDBRANCH 11 21 +TORSDOF 4 +ENDMDL diff --git a/app/templates/base.html b/app/templates/base.html new file mode 100644 index 0000000..68fe61b --- /dev/null +++ b/app/templates/base.html @@ -0,0 +1,51 @@ + + + + + Curie Web + + + + + +
+
+

Curie Web Demo

+
+
+
+
+ {% block main %} + {% endblock %} +
+
+ + + + + + + \ No newline at end of file diff --git a/app/templates/display_photo.html b/app/templates/display_photo.html new file mode 100644 index 0000000..413e2e1 --- /dev/null +++ b/app/templates/display_photo.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} + +{% block main %} +

Description: {{ description }}

+

Succesfuly Submitted

+ +{% endblock %} \ No newline at end of file diff --git a/app/templates/dock_upload.html b/app/templates/dock_upload.html new file mode 100644 index 0000000..3fc8419 --- /dev/null +++ b/app/templates/dock_upload.html @@ -0,0 +1,53 @@ +{% extends 'base.html' %} + +{% block main %} +

Enter Your Configuration

+
+ {% include 'flash_messages.html' %} + {{ form.csrf_token }} +
+ {{ form.description.label }} + {{ form.description(class="form-control") }} +
+
+
+ {{ form.size_x.label }} + {{ form.size_x(class="form-control")}} +
+
+ {{ form.size_y.label }} + {{ form.size_y(class="form-control")}} +
+
+ {{ form.size_z.label }} + {{ form.size_z(class="form-control")}} +
+
+
+
+ {{ form.center_x.label }} + {{ form.center_x(class="form-control")}} +
+
+ {{ form.center_y.label }} + {{ form.center_y(class="form-control")}} +
+
+ {{ form.center_z.label }} + {{ form.center_z(class="form-control")}} +
+
+
+
+ {{ form.target.label }} + {{ form.target(class="form-control") }} +
+
+ {{ form.ligand.label }} + {{ form.ligand(class="form-control")}} +
+
+ + +
+{% endblock %} \ No newline at end of file diff --git a/app/templates/flash_messages.html b/app/templates/flash_messages.html new file mode 100644 index 0000000..b524c24 --- /dev/null +++ b/app/templates/flash_messages.html @@ -0,0 +1,7 @@ +{% with messages = get_flashed_messages(with_categories=true) %} + {% if messages %} + {% for category, message in messages %} +
{{ message }}
+ {% endfor %} + {% endif %} +{% endwith %} \ No newline at end of file diff --git a/app/templates/form.html b/app/templates/form.html new file mode 100644 index 0000000..ae30dd5 --- /dev/null +++ b/app/templates/form.html @@ -0,0 +1,23 @@ +{% extends 'base.html' %} + +{% block main %} +

Basic Form in Flask

+ +
+ {% include 'flash_messages.html' %} +
+ + +
+
+ + +
+
+ + +
+ + +
+{% endblock %} \ No newline at end of file diff --git a/app/templates/home.html b/app/templates/home.html new file mode 100644 index 0000000..f7a7c78 --- /dev/null +++ b/app/templates/home.html @@ -0,0 +1,9 @@ +{% extends 'base.html' %} + +{% block main %} +

Curie Web Demo

+

The dock and report demo performs molecular docking using AutoDock Vina and then finds protein-ligand interactions using PLIP

+ +{% endblock %} \ No newline at end of file diff --git a/app/templates/result.html b/app/templates/result.html new file mode 100644 index 0000000..ca7db1c --- /dev/null +++ b/app/templates/result.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} + +{% block main %} +

Successful Form Submission

+ {% include 'flash_messages.html' %} +

My name is {{ firstname + ' ' + lastname }} and my email address is {{ email }}.

+{% endblock %} \ No newline at end of file diff --git a/app/templates/wtform.html b/app/templates/wtform.html new file mode 100644 index 0000000..6d9add5 --- /dev/null +++ b/app/templates/wtform.html @@ -0,0 +1,20 @@ +{% extends 'base.html' %} + +{% block main %} +

WTForms in Flask

+

Here we are using the Flask-WTF library to create and process a form. Flask-WTF also comes with CSRF protection and validation classes.

+
+ {% include 'flash_messages.html' %} + {{ form.csrf_token }} +
+ {{ form.firstname.label }} {{ form.firstname(class="form-control") }} +
+
+ {{ form.lastname.label }} {{ form.lastname(class="form-control") }} +
+
+ {{ form.email.label }} {{ form.email(class="form-control", placeholder="jdoe@example.com") }} +
+ +
+{% endblock %} \ No newline at end of file diff --git a/app/views.py b/app/views.py new file mode 100644 index 0000000..78d606f --- /dev/null +++ b/app/views.py @@ -0,0 +1,122 @@ +""" +Flask Documentation: http://flask.pocoo.org/docs/ +Jinja2 Documentation: http://jinja.pocoo.org/2/documentation/ +Werkzeug Documentation: http://werkzeug.pocoo.org/documentation/ +This file creates your application. +""" +import os +from app import app +from flask import render_template, request, redirect, url_for, flash, session, abort +from werkzeug.utils import secure_filename + +# Note: that when using Flask-WTF we need to import the Form Class that we created +# in forms.py +from .forms import MyForm, curieForm + + +### +# Routing for your application. +### + +@app.route('/') +def home(): + """Render website's home page.""" + return render_template('home.html') + + +@app.route('/basic-form', methods=['GET', 'POST']) +def basic_form(): + if request.method == 'POST': + firstname = request.form['firstname'] + lastname = request.form['lastname'] + email = request.form['email'] + + return render_template('result.html', + firstname=firstname, + lastname=lastname, + email=email) + + return render_template('form.html') + + +@app.route('/wtform', methods=['GET', 'POST']) +def wtform(): + myform = MyForm() + + if request.method == 'POST': + if myform.validate_on_submit(): + # Note the difference when retrieving form data using Flask-WTF + # Here we use myform.firstname.data instead of request.form['firstname'] + firstname = myform.firstname.data + lastname = myform.lastname.data + email = myform.email.data + + flash('You have successfully filled out the form', 'success') + return render_template('result.html', firstname=firstname, lastname=lastname, email=email) + + flash_errors(myform) + return render_template('wtform.html', form=myform) + + +@app.route('/dock', methods=['GET', 'POST']) +def dock_upload(): + form = curieForm() + + if request.method == 'POST' and form.validate_on_submit(): + + #photo = photoform.photo.data # we could also use request.files['photo'] + description = form.description.data + target = form.target.data + print(description) + print(secure_filename(target.filename)) + target.save(os.path.join( + app.config['UPLOAD_FOLDER'], secure_filename(target.filename) + )) + #photo.save(os.path.join( + # app.config['UPLOAD_FOLDER'], filename + #)) + + return render_template('display_photo.html', filename="OwO", description=description) + + flash_errors(form) + return render_template('dock_upload.html', form=form) + +### +# The functions below should be applicable to all Flask apps. +### + +# Flash errors from the form if validation fails +def flash_errors(form): + for field, errors in form.errors.items(): + for error in errors: + flash(u"Error in the %s field - %s" % ( + getattr(form, field).label.text, + error + ), 'danger') + +@app.route('/.txt') +def send_text_file(file_name): + """Send your static text file.""" + file_dot_text = file_name + '.txt' + return app.send_static_file(file_dot_text) + + +@app.after_request +def add_header(response): + """ + Add headers to both force latest IE rendering engine or Chrome Frame, + and also to cache the rendered page for 10 minutes. + """ + response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1' + response.headers['Cache-Control'] = 'public, max-age=0' + return response + + +@app.errorhandler(404) +def page_not_found(error): + """Custom 404 page.""" + return render_template('404.html'), 404 + + +if __name__ == '__main__': + app.run(debug=True, host="0.0.0.0", port="8080") \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..815d681 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,9 @@ +Click==7.0 +Flask==1.1.1 +Flask-WTF==0.14.2 +gunicorn==20.0.4 +itsdangerous==1.1.0 +Jinja2==2.11.0 +MarkupSafe==1.1.1 +Werkzeug==0.16.1 +WTForms==2.2.1 diff --git a/run.py b/run.py new file mode 100644 index 0000000..a9ae0b4 --- /dev/null +++ b/run.py @@ -0,0 +1,3 @@ +#! /usr/bin/env python +from app import app +app.run(debug=True, host="0.0.0.0", port=8080) diff --git a/runtime.txt b/runtime.txt new file mode 100644 index 0000000..7847419 --- /dev/null +++ b/runtime.txt @@ -0,0 +1 @@ +python-3.7.1 \ No newline at end of file