@@ -0,0 +1,2218 @@
+from __future__ import absolute_import, print_function, unicode_literals%0Afrom builtins import dict, str%0A%0A__all__ = %5B'LincsProcessor'%5D%0A%0Aimport re%0A%0Afrom indra.statements import Agent, Inhibition, Evidence%0A%0A%0Aclass LincsProcessor(object):%0A    %22%22%22Processor for the HMS LINCS drug target dataset.%0A%0A    Parameters%0A    ----------%0A    lincs_csv : str%0A        A csv of the lincs data.%0A%0A    Attributes%0A    ----------%0A    statements : list%5Bindra.statements.Statement%5D%0A        A list of indra statements extracted from the CSV file.%0A    %22%22%22%0A%0A    def __init__(self, lincs_data):%0A        self._data = lincs_data%0A%0A        # Process all the lines (skipping the header)%0A        self.statements = %5B%5D%0A        for line in self._data:%0A            self._process_line(line)%0A        return%0A%0A    def _process_line(self, line):%0A        drug = self._extract_drug(line)%0A        prot = self._extract_protein(line)%0A        evidence = self._make_evidence(line)%0A        self.statements.append(Inhibition(drug, prot, evidence=evidence))%0A        return%0A%0A    def _extract_drug(self, line):%0A        drug_name = line%5B'Small Molecule Name'%5D%0A        lincs_id = line%5B'Small Molecule HMS LINCS ID'%5D%0A        return Agent(drug_name, db_refs=%7B'LINCS': lincs_id%7D)%0A%0A    def _extract_protein(self, line):%0A        prot_name = line%5B'Protein Name'%5D%0A        lincs_id = line%5B'Protein HMS LINCS ID'%5D%0A        return Agent(prot_name, db_refs=%7B'LINCS': lincs_id%7D)%0A%0A    def _make_evidence(self, line):%0A        ev_list = %5B%5D%0A        key_refs = line%5B'Key References'%5D.split(';')%0A        generic_notes = %7B%0A            'is_nominal': line%5B'Is Nominal'%5D,%0A            'effective_concentration': line%5B'Effective Concentration'%5D%0A            %7D%0A        patt = re.compile('(?:pmid%7Cpubmed%5Cs+id):%5Cs+(%5Cd+)', re.IGNORECASE)%0A        for ref in key_refs:%0A            # Only extracting pmids, but there is generally more info available.%0A            m = patt.search(ref)%0A            if m is None:%0A                pmid = None%0A            else:%0A                pmid = m.groups()%5B0%5D%0A            annotations = %7B'reference': ref%7D%0A            annotations.update(generic_notes)%0A            ev = Evidence('lincs', pmid=pmid, annotations=annotations)%0A            ev_list.append(ev)%0A        return ev_list%0A%0A

Implement basic LINCS processor.