Louis BECQUEY

Take puckering into account when detecting ligands

...@@ -256,7 +256,8 @@ class Chain: ...@@ -256,7 +256,8 @@ class Chain:
256 # Drop ligands detected as residues by DSSR, by detecting several markers 256 # Drop ligands detected as residues by DSSR, by detecting several markers
257 df = df.drop_duplicates("index_chain", keep="first") # drop doublons in index_chain 257 df = df.drop_duplicates("index_chain", keep="first") # drop doublons in index_chain
258 while (df.iloc[[-1]].nt_name.tolist()[0] not in ["A", "C", "G", "U"] and 258 while (df.iloc[[-1]].nt_name.tolist()[0] not in ["A", "C", "G", "U"] and
259 - (df.iloc[[-1]][["alpha","beta","gamma","delta","epsilon","zeta","v0","v1","v2","v3","v4"]].isna().values).all()): 259 + (df.iloc[[-1]][["alpha", "beta", "gamma", "delta", "epsilon", "zeta", "v0", "v1", "v2", "v3", "v4"]].isna().values).all()
260 + or (df.iloc[[-1]].puckering=='').any()):
260 df = df.head(-1) 261 df = df.head(-1)
261 262
262 # If, for some reason, index_chain does not start at one (e.g. 6boh, chain GB), make it start at one 263 # If, for some reason, index_chain does not start at one (e.g. 6boh, chain GB), make it start at one
...@@ -415,11 +416,11 @@ class Chain: ...@@ -415,11 +416,11 @@ class Chain:
415 VALUES 416 VALUES
416 (?, ?, ?, ?, ?, ?, ?, ?);""", 417 (?, ?, ?, ?, ?, ?, ?, ?);""",
417 data=(str(self.pdb_id), str(self.pdb_chain_id), int(self.pdb_start), int(self.pdb_end), int(self.reversed), str(self.rfam_fam), int(self.inferred), int(self.delete_me))) 418 data=(str(self.pdb_id), str(self.pdb_chain_id), int(self.pdb_start), int(self.pdb_end), int(self.reversed), str(self.rfam_fam), int(self.inferred), int(self.delete_me)))
419 + # get the chain id
420 + self.db_chain_id = sql_ask_database(conn, f"SELECT (chain_id) FROM chain WHERE structure_id='{self.pdb_id}' AND chain_name='{self.pdb_chain_id}' AND rfam_acc='{self.rfam_fam}';")[0][0]
418 else: 421 else:
419 sql_execute(conn, "INSERT OR REPLACE INTO chain (structure_id, chain_name, issue) VALUES (?, ?, ?);", data=(str(self.pdb_id), int(self.pdb_chain_id), int(self.delete_me))) 422 sql_execute(conn, "INSERT OR REPLACE INTO chain (structure_id, chain_name, issue) VALUES (?, ?, ?);", data=(str(self.pdb_id), int(self.pdb_chain_id), int(self.delete_me)))
420 - 423 + self.db_chain_id = sql_ask_database(conn, f"SELECT (chain_id) FROM chain WHERE structure_id='{self.pdb_id}' AND chain_name='{self.pdb_chain_id}' AND rfam_acc IS NULL;")[0][0]
421 - # get the chain id
422 - self.db_chain_id = sql_ask_database(conn, f"SELECT (chain_id) FROM chain WHERE structure_id='{self.pdb_id}' AND chain_name='{self.pdb_chain_id}';")[0][0]
423 424
424 # Add the nucleotides 425 # Add the nucleotides
425 sql_execute(conn, f""" 426 sql_execute(conn, f"""
...@@ -430,9 +431,8 @@ class Chain: ...@@ -430,9 +431,8 @@ class Chain:
430 paired, pair_type_LW, pair_type_DSSR, nb_interact) 431 paired, pair_type_LW, pair_type_DSSR, nb_interact)
431 VALUES ({self.db_chain_id}, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 432 VALUES ({self.db_chain_id}, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
432 ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 433 ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
433 - ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 434 + ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);""",
434 - ;""", many=True, data=list(df.to_records(index=False)), warn_every=10 435 + many=True, data=list(df.to_records(index=False)), warn_every=10)
435 - )
436 436
437 # Now load data from the database 437 # Now load data from the database
438 self.seq = "".join(df.nt_code) 438 self.seq = "".join(df.nt_code)
......