Skip to content

Commit

Permalink
general clean up, fixing imports, removing template comments
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanDietzMorris committed Nov 26, 2024
1 parent 56e8b5b commit 46f8117
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions parsers/LINCS/src/loadLINCS.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@

from Common.extractor import Extractor
from Common.loader_interface import SourceDataLoader
from Common.kgxmodel import kgxnode, kgxedge
from Common.neo4j_tools import Neo4jTools
from Common.biolink_constants import *
from Common.prefixes import PUBCHEM_COMPOUND, KNOWLEDGE_LEVEL, KNOWLEDGE_ASSERTION, AGENT_TYPE, DATA_PIPELINE
from Common.prefixes import PUBCHEM_COMPOUND
from Common.utils import GetData


# if parsing a tsv or csv type file with columns, use a enum to represent each field
class GENERICDATACOLS(enum.IntEnum):
SOURCE_ID = 2
SOURCE_LABEL = 3
Expand All @@ -19,22 +15,24 @@ class GENERICDATACOLS(enum.IntEnum):
PREDICATE = 7

PREDICATE_MAPPING = {
"in_similarity_relationship_with": "biolink:chemically_similar_to",
"negatively_regulates": {
"RO:0002448": {
OBJECT_DIRECTION_QUALIFIER: "downregulated"}},
"positively_regulates": {
"RO:0002448": {
OBJECT_DIRECTION_QUALIFIER: "upregulated"}}
}
"in_similarity_relationship_with": "biolink:chemically_similar_to",
"negatively_regulates": {
"RO:0002448": {
OBJECT_DIRECTION_QUALIFIER: "downregulated"}
},
"positively_regulates": {
"RO:0002448": {
OBJECT_DIRECTION_QUALIFIER: "upregulated"}
}
}



##############
# Class: LINCS loader
#
# By: James Chung
# Date: 10/30/2023
# Date: 10/30/2024
# Desc: Class that loads/parses the data in Library of Integrated Network-Based Cellular Signatures.
#
##############
Expand All @@ -43,9 +41,7 @@ class GENERICDATACOLS(enum.IntEnum):
class LINCSLoader(SourceDataLoader):

source_id: str = 'LINCS'
# this should be a valid infores curie from the biolink infores catalog
provenance_id: str = 'infores:lincs'
# increment parsing_version whenever changes are made to the parser that would result in changes to parsing output
parsing_version: str = '1.0'

def __init__(self, test_mode: bool = False, source_data_dir: str = None):
Expand Down Expand Up @@ -79,10 +75,6 @@ def parse_data(self) -> dict:
:return: ret_val: load_metadata
"""
# This is a made up example of how one might extract nodes and edges from a tsv file
# In this case it's taking the subject ID from column 1 and the object ID from column 3,
# prepending them with a curie prefix. The predicate comes from column 3. The value in column 4
# is set as a property on the edge.
extractor = Extractor(file_writer=self.output_file_writer)
lincs_file: str = os.path.join(self.lincs_url, self.edge_file)
with open(lincs_file, 'rt') as fp:
Expand Down

0 comments on commit 46f8117

Please sign in to comment.