|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | + |
| 3 | +"""Tests for the ExTRI processor.""" |
| 4 | + |
| 5 | +import pandas as pd |
| 6 | + |
| 7 | +from indra.sources.extri import process_dataframe |
| 8 | +from indra.statements import RegulateAmount |
| 9 | + |
| 10 | + |
| 11 | +def test_extri_process_dataframe_minimal(): |
| 12 | + sentence_df = pd.DataFrame([ |
| 13 | + { |
| 14 | + 'PMID:Sentence ID:TF:TG': '123456:1:TP53:CDKN1A', |
| 15 | + 'Transcription Factor (Associated Gene Name)': 'TP53', |
| 16 | + 'Target Gene (Associated Gene Name)': 'CDKN1A', |
| 17 | + 'Sentence': 'TP53 increases CDKN1A expression.', |
| 18 | + } |
| 19 | + ]) |
| 20 | + pairs_df = pd.DataFrame([ |
| 21 | + { |
| 22 | + 'TF:TG': 'TP53:CDKN1A', |
| 23 | + '[ExTRI] present': 'ExTRI', |
| 24 | + } |
| 25 | + ]) |
| 26 | + |
| 27 | + processor = process_dataframe(sentence_df, pairs_df) |
| 28 | + |
| 29 | + assert len(processor.statements) == 1 |
| 30 | + stmt = processor.statements[0] |
| 31 | + assert isinstance(stmt, RegulateAmount) |
| 32 | + assert stmt.subj.name == 'TP53' |
| 33 | + assert stmt.obj.name == 'CDKN1A' |
| 34 | + |
| 35 | + assert len(stmt.evidence) == 1 |
| 36 | + ev = stmt.evidence[0] |
| 37 | + assert ev.source_api == 'extri' |
| 38 | + assert ev.source_id == '123456:1:TP53:CDKN1A' |
| 39 | + assert ev.pmid == '123456' |
| 40 | + assert ev.text == 'TP53 increases CDKN1A expression.' |
| 41 | + assert ev.annotations['sentence_id'] == '1' |
| 42 | + assert ev.annotations['pair_key'] == 'TP53:CDKN1A' |
0 commit comments