Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
Merge ef6e63e into 5d855ea
Browse files Browse the repository at this point in the history
  • Loading branch information
CunliangGeng committed Oct 29, 2019
2 parents 5d855ea + ef6e63e commit a3a349c
Show file tree
Hide file tree
Showing 24 changed files with 150 additions and 3,058 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ example/*.hdf5
example/*.pdb

# some test file
test/out_2d
test/out_3d
test/out_3d_class
test/out_2d*
test/out_3d*
test/out_test
test/*.pckl
test/*.hdf5
Expand Down
14 changes: 13 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,19 @@ before_install:
# pytest
- conda install -c anaconda pytest
- conda install -c conda-forge pytest-cov
- conda install python=3.6
- conda install python=3.7

# install freesasa
- conda install cython
- sudo apt-get install -y libxml2 libxml2-dev libjson0 libjson0-dev
- wget http://github.com/mittinatten/freesasa/releases/download/2.0.2/freesasa-2.0.2.tar.gz
- mkdir freesasa
- tar -xvf freesasa-2.0.2.tar.gz -C freesasa --strip-components=1
- cd freesasa
- ./configure --disable-xml --disable-json --enable-python-bindings --with-python=python3.7 CFLAGS="-fPIC" --prefix=$HOME
- make
- make install
- cd ../

# codacy-coverage
- pip install -q --upgrade pip
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,20 @@ Minimal information to install the module
* clone the repository `git clone https://github.com/DeepRank/deeprank.git`
* go there `cd deeprank`
* install the module `pip install -e ./`
* install freesasa `https://github.com/freesasa/freesasa-python`
* go int the test dir `cd test`
* run the test suite `pytest`


## 2 . Tutorial

We give here the tutorial like introduction to the DeepRank machinery. More informatoin can be found in the documentation http://deeprank.readthedocs.io/en/latest/. We quickly illsutrate here the two main steps of Deeprank :
* the generation of the data
* running deep leaning experiments.
* the generation of the data
* running deep leaning experiments.

### A . Generate the data set (using MPI)

The generation of the data require only require PDBs files of decoys and their native and the PSSM if needed. All the features/targets and mapped features onto grid points will be auomatically calculated and store in a HDF5 file.
The generation of the data require only require PDBs files of decoys and their native and the PSSM if needed. All the features/targets and mapped features onto grid points will be auomatically calculated and store in a HDF5 file.

```python
from deeprank.generate import *
Expand Down Expand Up @@ -150,4 +151,3 @@ model.train(nepoch = 50,divide_trainset=0.8, train_batch_size = 5,num_workers=0)
In the first part of the script we create a Torch database from the HDF5 file. We can specify one or several HDF5 files and even select some conformations using the `dict_filter` argument. Other options of `DataSet` can be used to specify the features/targets the normalization, etc ...

We then create a `NeuralNet` instance that takes the dataset as input argument. Several options are available to specify the task to do, the GPU use, etc ... We then have simply to train the model. Simple !

4 changes: 2 additions & 2 deletions deeprank/features/AtomicFeature.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import warnings

import numpy as np
import pdb2sql

from deeprank.features import FeatureClass
from deeprank.tools import pdb2sql


class AtomicFeature(FeatureClass):
Expand Down Expand Up @@ -81,7 +81,7 @@ def __init__(self, pdbfile, param_charge=None, param_vdw=None,
self.atom_key = 'chainID, resSeq, resName, name'

# read the pdb as an sql
self.sqldb = pdb2sql(self.pdbfile)
self.sqldb = pdb2sql.pdb2sql(self.pdbfile)

# read the force field
self.read_charge_file()
Expand Down
10 changes: 5 additions & 5 deletions deeprank/features/BSA.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import warnings

import pdb2sql

from deeprank.features import FeatureClass
from deeprank.tools import pdb2sql

try:
import freesasa
Expand Down Expand Up @@ -33,7 +34,7 @@ def __init__(self, pdb_data, chainA='A', chainB='B'):
>>> bsa.sql.close()
"""
self.pdb_data = pdb_data
self.sql = pdb2sql(pdb_data)
self.sql = pdb2sql.interface(pdb_data)
self.chains_label = [chainA, chainB]

self.feature_data = {}
Expand Down Expand Up @@ -83,9 +84,8 @@ def get_contact_residue_sasa(self, cutoff=5.5):
self.bsa_data = {}
self.bsa_data_xyz = {}

# res = ([chain1 residues], [chain2 residues])
ctc_res = self.sql.get_contact_residue(cutoff=cutoff)
ctc_res = ctc_res[0] + ctc_res[1]
ctc_res = self.sql.get_contact_residues(cutoff=cutoff)
ctc_res = ctc_res["A"] + ctc_res["B"]

# handle with small interface or no interface
total_res = len(ctc_res)
Expand Down
10 changes: 5 additions & 5 deletions deeprank/features/FullPSSM.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import warnings

import numpy as np
import pdb2sql

from deeprank import config
from deeprank.features import FeatureClass
from deeprank.tools import pdb2sql

########################################################################
#
Expand Down Expand Up @@ -163,7 +163,7 @@ def read_PSSM_data(self):
def get_feature_value(self, cutoff=5.5):
"""get the feature value."""

sql = pdb2sql(self.pdb_file)
sql = pdb2sql.interface(self.pdb_file)

# set achors for all residues and get their xyz
xyz_info = sql.get('chainID,resSeq,resName', name='CB')
Expand All @@ -178,10 +178,10 @@ def get_feature_value(self, cutoff=5.5):
xyz_dict[tuple(info)] = pos

# get interface contact residues
# ctc_res = ([chain 1 residues], [chain2 residues])
ctc_res = sql.get_contact_residue(cutoff=cutoff)
# ctc_res = {"A":[chain 1 residues], "B": [chain2 residues]}
ctc_res = sql.get_contact_residues(cutoff=cutoff)
sql.close()
ctc_res = ctc_res[0] + ctc_res[1]
ctc_res = ctc_res["A"] + ctc_res["B"]

# handle with small interface or no interface
total_res = len(ctc_res)
Expand Down
7 changes: 4 additions & 3 deletions deeprank/features/NaivePSSM.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from time import time

import numpy as np
import pdb2sql

from deeprank.features import FeatureClass
from deeprank.tools import SASA, pdb2sql
from deeprank.tools import SASA


def printif(string, cond): return print(string) if cond else None
Expand Down Expand Up @@ -148,7 +149,7 @@ def _smooth_pssm(pssm_data, msmooth=3):
def get_feature_value(self, contact_only=True):
"""get the feature value."""

sql = pdb2sql(self.pdbfile)
sql = pdb2sql.interface(self.pdbfile)
xyz_info = sql.get('chainID,resSeq,resName', name='CB')
xyz = sql.get('x,y,z', name='CB')

Expand All @@ -157,7 +158,7 @@ def get_feature_value(self, contact_only=True):
xyz_dict[tuple(info)] = pos

contact_residue = sql.get_contact_residue(cutoff=5.5)
contact_residue = contact_residue[0] + contact_residue[1]
contact_residue = contact_residue["A"] + contact_residue["B"]
sql.close()

pssm_data_xyz = {}
Expand Down
6 changes: 3 additions & 3 deletions deeprank/features/ResidueDensity.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import itertools
import warnings
import pdb2sql

from deeprank.features import FeatureClass
from deeprank.tools import pdb2sql
from deeprank import config


Expand All @@ -23,7 +23,7 @@ def __init__(self, pdb_data, chainA='A', chainB='B'):
"""

self.pdb_data = pdb_data
self.sql = pdb2sql(pdb_data)
self.sql = pdb2sql.interface(pdb_data)
self.chains_label = [chainA, chainB]

self.feature_data = {}
Expand All @@ -40,7 +40,7 @@ def get(self, cutoff=5.5):
# res = {('chainA,resSeq,resName'): set(
# ('chainB,res1Seq,res1Name),
# ('chainB,res2Seq,res2Name'))}
res = self.sql.get_contact_residue(chain1=self.chains_label[0],
res = self.sql.get_contact_residues(chain1=self.chains_label[0],
chain2=self.chains_label[1],
cutoff=cutoff,
return_contact_pairs=True)
Expand Down
Loading

0 comments on commit a3a349c

Please sign in to comment.