From 61332462e20fa70f956a847bff60a1040a984e17 Mon Sep 17 00:00:00 2001 From: Everaldo Date: Wed, 29 May 2024 17:52:22 -0700 Subject: [PATCH 1/6] Update data url. --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 14f7414..655cd3d 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ "url" : "https://github.com/rjawesome" }, "dumper" : { - "data_url" : ["https://www.bindingdb.org/bind/downloads/BindingDB_All_2022m5.tsv.zip"], + "data_url" : ["https://www.bindingdb.org/bind/downloads/BindingDB_All_202405_tsv.zip"], "uncompress" : true }, "uploader" : { From f5f3716572b61f94f991716c678870686d2b2f05 Mon Sep 17 00:00:00 2001 From: Everaldo Date: Wed, 29 May 2024 17:59:23 -0700 Subject: [PATCH 2/6] Update parser to the new data file. --- parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser.py b/parser.py index 384e3ee..5b6207d 100644 --- a/parser.py +++ b/parser.py @@ -499,7 +499,7 @@ def merge(main: Dict[str, any], other: Dict[str, any]): def load_data(data_folder): docs = {} row_num = 0 - for row in read_csv(os.path.join(data_folder, './BindingDB_All.tsv'), '\t'): + for row in read_csv(os.path.join(data_folder, './BindingDB_All_202405.tsv'), '\t'): # print(row['subject']['uniprot']) try: entry_name = row['subject']['uniprot']['id'] From 274b9c0f0de47ec3b822428af12160e7ba29a90c Mon Sep 17 00:00:00 2001 From: Everaldo Date: Thu, 30 May 2024 16:35:16 -0700 Subject: [PATCH 3/6] Add new columns. --- parser.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/parser.py b/parser.py index 5b6207d..af2de86 100644 --- a/parser.py +++ b/parser.py @@ -1,5 +1,4 @@ import csv -import json import os from typing import Dict @@ -30,7 +29,7 @@ 'Ligand InChI Key', 'BindingDB MonomerID', 'BindingDB Ligand Name', - 'Target Name Assigned by Curator or DataSource', + 'Target Name', 'Target Source Organism According to Curator or DataSource', 'Ki (nM)', 'IC50 (nM)', @@ -42,6 +41,7 @@ 'Temp (C)', 'Curation/DataSource', 'Article DOI', + 'BindingDB Entry DOI', 'PMID', 'PubChem AID', 'Patent Number', @@ -109,7 +109,7 @@ "uniprot_type": "all", "relation": False }, - "Target Name Assigned by Curator or DataSource": { + "Target Name": { "location": "subject.name", "type": "split_colon", "uniprot_type": "all", @@ -181,6 +181,12 @@ "uniprot_type": "all", "relation": True }, + "BindingDB Entry DOI": { + "location": "relation.bindingdb_entry_doi", + "type": "string", + "uniprot_type": "all", + "relation": True + }, "PMID": { "location": "relation.pmid", "type": "string", @@ -451,7 +457,8 @@ def read_csv(file: str, delim: str): val = process_field(BASE_COLS[j], row[j]) set_field(base, BASE_COLS[j], val) - repeats = int(row[36]) # Number of Protein Chains in Target + # repeats = int(row[36]) # Number of Protein Chains in Target + repeats = int(row[36]) if row[36].isdigit() else 0 pos = 37 for j in range(repeats): info_1 = special_copy(base) @@ -531,7 +538,7 @@ def load_data(data_folder): yield docs[doc_id] -# def main(): +# type: ignore # def main(): # from time import time # cnt = 0 From a7535ba9e85bc392d5fc936c979d365bd798df64 Mon Sep 17 00:00:00 2001 From: Everaldo Date: Thu, 30 May 2024 17:20:25 -0700 Subject: [PATCH 4/6] Add new columns. --- parser.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/parser.py b/parser.py index af2de86..1937d49 100644 --- a/parser.py +++ b/parser.py @@ -452,14 +452,13 @@ def read_csv(file: str, delim: str): continue else: base = {'object': {}, 'subject': {}, 'relation': {}} - for j in range(37): + for j in range(38): if row[j] is not None and row[j] != '' and row[j] != 'NULL': val = process_field(BASE_COLS[j], row[j]) set_field(base, BASE_COLS[j], val) - # repeats = int(row[36]) # Number of Protein Chains in Target - repeats = int(row[36]) if row[36].isdigit() else 0 - pos = 37 + repeats = int(row[37]) # Number of Protein Chains in Target + pos = 38 for j in range(repeats): info_1 = special_copy(base) info_2 = special_copy(base) @@ -507,7 +506,6 @@ def load_data(data_folder): docs = {} row_num = 0 for row in read_csv(os.path.join(data_folder, './BindingDB_All_202405.tsv'), '\t'): - # print(row['subject']['uniprot']) try: entry_name = row['subject']['uniprot']['id'] primary_id = row['subject']['uniprot']['accession'] From 67e2a749839dacbe57bb9ef804f8818edd320689 Mon Sep 17 00:00:00 2001 From: Everaldo Date: Thu, 30 May 2024 17:33:13 -0700 Subject: [PATCH 5/6] Add reference to documentation. --- parser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/parser.py b/parser.py index 1937d49..3c9d5e3 100644 --- a/parser.py +++ b/parser.py @@ -7,6 +7,8 @@ - The array BASE_COLS defines the first columns in each row with data mainly pertaining to the compound. - A sequence of columns is repeated which creates the data for each protein in the row, which is stored in REPEAT_SUBJECT_COLS. + +- Reference: https://www.bindingdb.org/bind/chemsearch/marvin/BindingDB-TSV-Format.pdf """ REPEAT_SUBJECT_COLS = [ 'BindingDB Target Chain Sequence', From b4c2219a2fd81094b216481de8cc3e68cf260527 Mon Sep 17 00:00:00 2001 From: Everaldo Date: Tue, 25 Jun 2024 17:17:12 -0700 Subject: [PATCH 6/6] Split uniprot accession by space. --- parser.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/parser.py b/parser.py index 3c9d5e3..3d23c47 100644 --- a/parser.py +++ b/parser.py @@ -2,6 +2,13 @@ import os from typing import Dict + +""" +Dumped file name +""" +DATA_FILE_NAME = 'BindingDB_All_202405.tsv' + + """ Fields of the Imported CSV: @@ -335,13 +342,13 @@ }, "UniProt (SwissProt) Secondary ID(s) of Target Chain": { "location": "subject.uniprot.secondary_accession", - "type": "split_comma", + "type": "split_space", "uniprot_type": "swissprot", "relation": False }, "UniProt (SwissProt) Alternative ID(s) of Target Chain": { "location": "subject.uniprot.alternative_accession", - "type": "split_comma", + "type": "split_space", "uniprot_type": "swissprot", "relation": False }, @@ -365,13 +372,13 @@ }, "UniProt (TrEMBL) Secondary ID(s) of Target Chain": { "location": "subject.uniprot.secondary_accession", - "type": "split_comma", + "type": "split_space", "uniprot_type": "trembl", "relation": False }, "UniProt (TrEMBL) Alternative ID(s) of Target Chain": { "location": "subject.uniprot.alternative_accession", - "type": "split_comma", + "type": "split_space", "uniprot_type": "trembl", "relation": False } @@ -431,6 +438,8 @@ def process_field(field_name: str, value: str): field_type = COLUMN_DATA[field_name]['type'] if field_type == "int": return int(value) + if field_type == "split_space": + return value.split(' ') if field_type == "split_comma": return value.split(',') if field_type == "split_semicolon": @@ -507,7 +516,7 @@ def merge(main: Dict[str, any], other: Dict[str, any]): def load_data(data_folder): docs = {} row_num = 0 - for row in read_csv(os.path.join(data_folder, './BindingDB_All_202405.tsv'), '\t'): + for row in read_csv(os.path.join(data_folder, './' + DATA_FILE_NAME), '\t'): try: entry_name = row['subject']['uniprot']['id'] primary_id = row['subject']['uniprot']['accession']