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

Commit

Permalink
Merge 60d4197 into 4026caf
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoRenaud committed Mar 14, 2019
2 parents 4026caf + 60d4197 commit 3c132f4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
4 changes: 4 additions & 0 deletions deeprank/features/FullPSSM.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,12 @@ def get_feature_value(self,contact_only=True):
"""get the feature value."""

sql = pdb2sql(self.pdbfile)

xyz_info = sql.get('chainID,resSeq,resName',name='CB')
xyz_info += sql.get('chainID,resSeq,resName',name='CA',resName='GLY')

xyz = sql.get('x,y,z',name='CB')
xyz += sql.get('x,y,z',name='CA',resName='GLY')

xyz_dict = {}
for pos,info in zip(xyz,xyz_info):
Expand Down
14 changes: 13 additions & 1 deletion deeprank/tools/pdb2sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ def get(self,atnames,**kwargs):

# check that all the keys exists
for k in keys:

if k.startswith('no_'):
k = k[3:]

try:
self.c.execute("SELECT EXISTS(SELECT {an} FROM ATOM)".format(an=k))
except:
Expand All @@ -396,6 +400,14 @@ def get(self,atnames,**kwargs):
# iterate through the kwargs
for ik,(k,v) in enumerate(kwargs.items()):


# deals with negative conditions
if k.startswith('no_'):
k = k[3:]
neg = ' NOT'
else:
neg = ''

# get if we have an array or a scalar
# and build the value tuple for the sql query
# deal with the indexing issue if rowID is required
Expand Down Expand Up @@ -438,7 +450,7 @@ def get(self,atnames,**kwargs):
vals = vals + (v,)

# create the condition for that key
conditions.append(k + ' in (' + ','.join('?'*nv) + ')')
conditions.append(k + neg + ' in (' + ','.join('?'*nv) + ')')

# stitch the conditions and append to the query
query += ' AND '.join(conditions)
Expand Down
2 changes: 1 addition & 1 deletion test/test_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test_4_add_feature(self):
for h5 in self.h5file:

#init the data assembler
database = DataGenerator(pdb_source=None,pdb_native=None,data_augmentation=None,
database = DataGenerator(pdb_source=None, pdb_native=None, data_augmentation=None,
pssm_source='./1AK4/pssm_new/',
compute_features = ['deeprank.features.FullPSSM'], hdf5=h5)

Expand Down
5 changes: 3 additions & 2 deletions test/test_learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ def test_learn_2d_reg():
select_feature={'AtomicDensities_ind' : 'all',
'Feature_ind' : ['coulomb','vdwaals','charge','PSSM_*'] },
select_target='DOCKQ',tqdm=True,
normalize_features = True, normalize_targets=True,
normalize_features = True,
normalize_targets=True,
clip_features=False,
pair_chain_feature=np.add,
dict_filter={'IRMSD':'<4. or >10.'})
Expand Down Expand Up @@ -222,7 +223,7 @@ def test_transfer():

if __name__ == "__main__":

TestLearn.test_learn_3d_reg_mapfly()
#TestLearn.test_learn_3d_reg_mapfly()
#TestLearn.test_learn_3d_reg()
TestLearn.test_learn_3d_class()
#TestLearn.test_learn_2d_reg()
Expand Down

0 comments on commit 3c132f4

Please sign in to comment.