OpenBEL / openbel-framework

An open platform for capturing, integrating, storing, and sharing biological knowledge in and across organizations.
http://openbel.org
Apache License 2.0
22 stars 7 forks source link

Loss of statement support backing equal edges #10

Open nbargnesi opened 12 years ago

nbargnesi commented 12 years ago

A problem was identified where a loss of statement support could occur when the framework sees equal (not equivalent) statements. Given the following two statements:

tscript(p(HGNC:A1BG)) => r(HGNC:A1CF) # 9606

<bel:statement bel:relationship="directlyIncreases">
    <bel:annotationGroup>
        <bel:annotation bel:refID="Species">9606</bel:annotation>
    </bel:annotationGroup>
    <bel:subject>
        <bel:term bel:function="transcriptionalActivity">
            <bel:term bel:function="proteinAbundance">
                <bel:parameter bel:ns="HGNC">A1BG</bel:parameter>
            </bel:term>
        </bel:term>
    </bel:subject>
    <bel:object>
        <bel:term bel:function="rnaAbundance">
            <bel:parameter bel:ns="HGNC">A1CF</bel:parameter>
        </bel:term>
    </bel:object>
</bel:statement>

tscript(p(HGNC:A1BG)) => r(HGNC:A1CF) # 10090

<bel:statement bel:relationship="directlyIncreases">
    <bel:annotationGroup>
        <bel:annotation bel:refID="Species">10090</bel:annotation>
    </bel:annotationGroup>
    <bel:subject>
        <bel:term bel:function="transcriptionalActivity">
            <bel:term bel:function="proteinAbundance">
                <bel:parameter bel:ns="HGNC">A1BG</bel:parameter>
            </bel:term>
        </bel:term>
    </bel:subject>
    <bel:object>
        <bel:term bel:function="rnaAbundance">
            <bel:parameter bel:ns="HGNC">A1CF</bel:parameter>
        </bel:term>
    </bel:object>
</bel:statement>

The second species annotation, 10090, is lost in the compiled KAM. Querying the supporting evidence for the resulting directlyIncreases or actsIn edges show them to be backed by one statement only. The problem most likely exists in phase IV of the compiler.

nbargnesi commented 12 years ago

Added test case: https://gist.github.com/2919455

abargnesi commented 12 years ago

We need to allow both statements to come through to the proto network. The proto network should store both Statement objects with different annotation sets. The proto edge should have both statements as support. This should be inspected from the KAM API to ensure that both statements are evidence for that edge.

JamesMcMahon commented 12 years ago

@abargnesi could you review the fix in my fork?

abargnesi commented 12 years ago

The unit test looks good to me although the issue still persists. When I compiled the above gist with your changes I saw the following database values:

ij> select * from kam2.statement; STATEMENT_&|DOCUMENT_ID|SUBJECT_TE&|RELATIONSH&|OBJECT_TER&|NESTED_SUB&|NESTED_REL&|NESTED_OBJ& 1 |1 |1 |2 |2 |NULL |NULL |NULL
2 |1 |1 |2 |2 |NULL |NULL |NULL

2 rows selected ij> select * from kam2.kam_edge_statement_map; KAM_EDGE_S&|KAM_EDGEID|STATEMENT& 1 |1 |1
2 |3 |1

2 rows selected ij> select * from kam2.kam_edge; KAM_EDGE_ID|KAM_SOURCE&|KAM_TARGET&|RELATIONSH& 1 |1 |2 |2
3 |3 |1 |21

2 rows selected

The gene scaffolding for phase III was not included in the KAM.

Interestingly I reverted back to my branch (compatible with upstream/experimental) and I have seen the issue go away. The database has the following correct values:

ij> select * from kam3.statement; STATEMENT_&|DOCUMENT_ID|SUBJECT_TE&|RELATIONSH&|OBJECT_TER&|NESTED_SUB&|NESTED_REL&|NESTED_OBJ& 1 |1 |1 |2 |2 |NULL |NULL |NULL
2 |1 |1 |2 |2 |NULL |NULL |NULL
3 |2 |4 |8 |5 |NULL |NULL |NULL
4 |2 |5 |7 |6 |NULL |NULL |NULL
5 |2 |7 |8 |8 |NULL |NULL |NULL
6 |2 |8 |7 |9 |NULL |NULL |NULL

6 rows selected ij> select * from kam3.kam_edge; KAM_EDGE_ID|KAM_SOURCE&|KAM_TARGET&|RELATIONSH& 1 |1 |2 |2
2 |3 |1 |21
3 |4 |5 |8
4 |5 |3 |7
5 |6 |2 |8
6 |2 |7 |7

6 rows selected ij> select * from kam3.kam_edge_statement_map where _kam_edgeid = 1; KAM_EDGE_S&|KAM_EDGEID|STATEMENT& 1 |1 |1
2 |1 |2

2 rows selected