Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSERV-537-variants-genomic-elements #369

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions data/adapters/AFGR_caqtl_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class AFGRCAQtl:
CLASS_NAME = 'accessible_dna_element'
ONTOLOGY_TERM_ID = 'EFO_0005292' # lymphoblastoid cell line
ONTOLOGY_TERM_NAME = 'lymphoblastoid cell line'
EDGE_COLLECTION_NAME = 'modulates accessibility of'
EDGE_COLLECTION_INVERSR_NAME = 'accessibility modulated by'
EDGE_COLLECTION_METHOD = 'BAO_0040027' # chromatin acessibility method

def __init__(self, filepath, label, dry_run=True, writer: Optional[Writer] = None, **kwargs):
if label not in AFGRCAQtl.ALLOWED_LABELS:
Expand Down Expand Up @@ -90,8 +93,9 @@ def process_file(self):
'source_url': AFGRCAQtl.SOURCE_URL,
'biosample_term': 'ontology_terms/' + AFGRCAQtl.ONTOLOGY_TERM_ID,
'biological_context': AFGRCAQtl.ONTOLOGY_TERM_NAME,
'name': 'associated with',
'inverse_name': 'associated with'
'name': AFGRCAQtl.EDGE_COLLECTION_NAME,
'inverse_name': AFGRCAQtl.EDGE_COLLECTION_INVERSR_NAME,
'method': 'ontology_terms/' + AFGRCAQtl.EDGE_COLLECTION_METHOD
}

self.writer.write(json.dumps(_props))
Expand Down
8 changes: 6 additions & 2 deletions data/adapters/encode_caqtl_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class CAQtl:
'term_name': 'liver'
}
}
EDGE_COLLECTION_NAME = 'modulates accessibility of'
EDGE_COLLECTION_INVERSR_NAME = 'accessibility modulated by'
EDGE_COLLECTION_METHOD = 'BAO_0040027' # chromatin acessibility method

def __init__(self, filepath, source, label, dry_run=True, writer: Optional[Writer] = None, **kwargs):
if label not in CAQtl.ALLOWED_LABELS:
Expand Down Expand Up @@ -89,8 +92,9 @@ def process_file(self):
'source_url': 'https://www.encodeproject.org/files/' + os.path.basename(self.filepath).split('.')[0],
'biological_context': CAQtl.CELL_ONTOLOGY[cell_name]['term_name'],
'biosample_term': 'ontology_terms/' + CAQtl.CELL_ONTOLOGY[cell_name]['term_id'],
'name': 'associated with',
'inverse_name': 'associated with'
'name': CAQtl.EDGE_COLLECTION_NAME,
'inverse_name': CAQtl.EDGE_COLLECTION_INVERSR_NAME,
'method': 'ontology_terms/' + CAQtl.EDGE_COLLECTION_METHOD,
}

self.writer.write(json.dumps(_props))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"_key":"BAO_0040027","uri":"http://www.bioassayontology.org/bao#BAO_0040027","term_id":"BAO_0040027","name":"chromatin acessibility method","synonyms":[],"description":"A method that is used to identify open / accessible genomic sites of remodeled chromatin","source":"BAO","subontology":null}
2 changes: 1 addition & 1 deletion data/db/schema/clickhouse_import.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ mm_genomic_elements: |

variants_genomic_elements: |
INSERT INTO variants_genomic_elements
SELECT label, log10pvalue, p_value, beta, source, source_url, biological_context, biosample_term, name, inverse_name, _key as id, splitByString('/', assumeNotNull(_from))[2] as variants_id, splitByString('/', assumeNotNull(_to))[2] as genomic_elements_id
SELECT label, log10pvalue, p_value, beta, source, source_url, biological_context, biosample_term, name, method, inverse_name, _key as id, splitByString('/', assumeNotNull(_from))[2] as variants_id, splitByString('/', assumeNotNull(_to))[2] as genomic_elements_id
FROM s3('s3://igvf-catalog-parsed-collections/variants_genomic_elements/*.jsonl', 'JSONEachRow')

genomic_elements_genes: |
Expand Down
1 change: 1 addition & 0 deletions data/db/schema/clickhouse_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,7 @@ CREATE TABLE IF NOT EXISTS variants_genomic_elements (
biological_context String,
biosample_term String,
name String,
method String,
inverse_name String,
id String PRIMARY KEY,
variants_id String,
Expand Down
1 change: 1 addition & 0 deletions data/schema-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ AFGR variant to genomic element:
biosample_term: str
name: str
inverse_name: str
method: str

encode variant to genomic element:
description: >-
Expand Down
2 changes: 1 addition & 1 deletion data/tests/test_AFGR_caqtl_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ def test_AFGR_caqtl_adapter_AFGR_caqtl():
adapter.process_file()
first_item = json.loads(writer.contents[0])
assert len(writer.contents) == 200
assert len(first_item) == 13
assert len(first_item) == 14
assert '_from' in first_item
assert first_item['_key'] == '701f175a69d51e1e7c526f8c8ca2b2165ba7a58aadfa797dfa737916120b8ce5_accessible_dna_element_1_906596_907043_GRCh38_AFGR'
4 changes: 2 additions & 2 deletions data/tests/test_encode_caqtl_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def test_caqtl_adapter_encode_caqtl():
assert '_from' in first_item
assert '_to' in first_item
assert first_item['label'] == 'caQTL'
assert first_item['name'] == 'associated with'
assert first_item['inverse_name'] == 'associated with'
assert first_item['name'] == 'modulates accessibility of'
assert first_item['inverse_name'] == 'accessibility modulated by'


def test_caqtl_adapter_invalid_label():
Expand Down