%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%% KNOWLEDGEBASE FOR "CLEANING" DATA ON %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%% PROTEIN DOMAINS %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%% Version of: 28/8/2003 %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%% Author: Rupert Summerton %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%% File name: proteindomain.pl %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% Note: %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% All atoms/schema variables in queries that %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% originate DIRECTLY from the Fusion Proto- %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% type must be elements of a LIST. This is %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% because the Java code should be %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% application independent, and so it has %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% no way of knowing if a given goal %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% requires only one atom or variable, or %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% whether it requires many. %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Proteins in knowledge base %CATH Superfamily: 3.30.559.10 allowedprotein('1nocB0'). allowedprotein('1dpb00'). allowedprotein('1dpc00'). allowedprotein('1dpd00'). allowedprotein('1eaa00'). allowedprotein('1eab00'). allowedprotein('1eac00'). allowedprotein('1ead00'). allowedprotein('1eae00'). allowedprotein('1eaf00'). allowedprotein('1c4tA0'). allowedprotein('1c4tB0'). allowedprotein('1c4tC0'). allowedprotein('1e2o00'). allowedprotein('1cia00'). allowedprotein('1cla00'). allowedprotein('1qca00'). allowedprotein('2cla00'). allowedprotein('3cla00'). allowedprotein('4cla00'). %CATH Superfamily: 3.40.50.1900 allowedprotein('1qoqB2'). allowedprotein('1a5aB2'). allowedprotein('1beuB2'). allowedprotein('1ubsB2'). allowedprotein('2tysB2'). allowedprotein('1a5bB2'). allowedprotein('1ttqB2'). allowedprotein('2trsB2'). allowedprotein('1bksB2'). allowedprotein('1fuyB2'). allowedprotein('1a50B2'). allowedprotein('1ttpB2'). allowedprotein('2tsyB2'). allowedprotein('1wsyB2'). allowedprotein('1cw2B2'). allowedprotein('1c8vB2'). allowedprotein('1a5sB2'). allowedprotein('1c29B2'). allowedprotein('1c9dB2'). allowedprotein('1cx9B2'). allowedprotein('2wsyB2'). allowedprotein('1qopB2'). allowedprotein('1tdj01'). allowedprotein('1oasA1'). allowedprotein('1oasB1'). allowedprotein('1d6sA1'). allowedprotein('1d6sB1'). allowedprotein('1fcjA1'). allowedprotein('1fcjD1'). allowedprotein('1fcjB1'). allowedprotein('1fcjC1'). allowedprotein('1jbqA1'). allowedprotein('1jbqB1'). allowedprotein('1jbqC1'). allowedprotein('1jbqD1'). allowedprotein('1jbqE1'). allowedprotein('1jbqF1'). allowedprotein('1f2dA1'). allowedprotein('1f2dB1'). allowedprotein('1f2dC1'). allowedprotein('1f2dD1'). %sameproteindomain(Proteins) :- succeeds if all protein domains in list Proteins are the same. sameproteindomain([X]). sameproteindomain([X,Y | T]) :- allowedprotein(X), !, X == Y, sameproteindomain([Y | T]). %Terms in the heirarchy are the GO ID numbers. Some Fusion Rules %will need to output the name of the GO term as well. %functionalannotation(GOID,NameAndID) :- NameAndID is the name and ID corresponding to the GOID number. functionalannotation('GO:0003673','Gene_Ontology (GO:0003673)'). functionalannotation('GO:0003674','molecular_function (GO:0003674)'). functionalannotation('GO:0003824','catalytic activity (GO:0003824)'). functionalannotation('GO:0016491','oxidoreductase activity (GO:0016491)'). functionalannotation('GO:0016705','oxidoreductase activity, acting on paired donors, with incorporation or reduction of molecular oxygen (GO:0016705)'). functionalannotation('GO:0016709','oxidoreductase activity, acting on paired donors, with incorporation or reduction of molecular oxygen, NAD or NADH as one donor, and incorporation of one atom of oxygen (GO:0016709)'). functionalannotation('GO:0004517','nitric oxide synthase activity (GO:0004517)'). functionalannotation('GO:0016740','transferase activity (GO:0016740)'). functionalannotation('GO:0016746','transferase activity, transferring acyl groups (GO:0016746)'). functionalannotation('GO:0016747','transferase activity, transferring groups other than amino-acyl groups (GO:0016747)'). functionalannotation('GO:0008415','acyltransferase activity (GO:0008415)'). functionalannotation('GO:0016417','S-acyltransferase activity (GO:0016417)'). functionalannotation('GO:0030523','dihydrolipoamide S-acyltransferase activity (GO:0030523)'). functionalannotation('GO:0008374','O-acyltransferase activity (GO:0008374)'). functionalannotation('GO:0016407','acetyltransferase activity (GO:0016407)'). functionalannotation('GO:0016413','O-acetyltransferase activity (GO:0016413)'). functionalannotation('GO:0008811','chloramphenicol O-acetyltransferase activity (GO:0008811)'). functionalannotation('GO:0016748','succinyltransferase activity (GO:0016748)'). functionalannotation('GO:0016751','S-succinyltransferase activity (GO:0016751)'). functionalannotation('GO:0004149','dihydrolipoamide S-succinyltransferase activity (GO:0004149)'). %For new case study. functionalannotation('GO:0016829','lyase activity (GO:0016829)'). functionalannotation('GO:0016835','carbon-oxygen lyase activity (GO:0016835)'). functionalannotation('GO:0016836','hydro-lyase activity (GO:0016836)'). functionalannotation('GO:0004122','cystathione beta-synthase activity (GO:0004122)'). functionalannotation('GO:0016839','other carbon-oxygen lyase activity (GO:0016839)'). functionalannotation('GO:0004124','cysteine synthase activity (GO:0004124)'). functionalannotation('GO:0004794','threonine dehydratase activity (GO:0004794)'). functionalannotation('GO:0004834','tryptophan synthase activity (GO:0004834)'). %These are in the cellular_component hierarchy. functionalannotation('GO:0005575','cellular_component (GO:0005575)'). functionalannotation('GO:0005623','cell (GO:0005623)'). functionalannotation('GO:0005622','intracellular (GO:0005622)'). functionalannotation('GO:0005737','cytoplasm (GO:0005737)'). %sameproteindomain(Proteins) :- succeeds if all protein domains in list Proteins are the same. sameGO_IDnumbers([X]). sameGO_IDnumbers([X,Y | T]) :- functionalannotation(X,Z), !, X == Y, sameGO_IDnumbers([Y | T]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%% Code for resolving conflicts by preferences over sources %%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %One way to deal with conflicts is not to merge the text entries, or to take a vote, but to %select the textentry from the report with the most preferred source. The trickiest problem %in implementing this idea in Prolog is the fact that we cannot assume that the number of %input reports is the same as the number of reports containing a text entry of the kind in %question. To get around this problem, when the fusion engine grounds a set variable, we have %it insert a null value if a report has no textentry of the required kind. % This gives rise to a further problem: suppose there is a conflict between the textentries %in several reports for a given element, and suppose further that the most preferred report %does not in fact have a textentry for this element. Unless this method is ammended, a null %value will be returned for this element. Clearly, in such cases we need to find those reports %which do have a text entry for this element, then determine the most preferred source from %amongst those reports, and finally select the text entry for the element from this report. %usepreferredsource(Sources,TextEntries,TextEntry) :- TextEntry is the text entry from amongst %TextEntries that comes from the report with the preferred source from amongst sources. (Sources is %a list of sources of all the input reports. TextEntries is a list of the text entries for a %particular report element from all the reports, or a null value if a given report has no such element.) usepreferredsource(Sources,TextEntries,TextEntry) :- correctfornulls(Sources,TextEntries,CorrectedSources,CorrectedTextEntries), preferredsource(CorrectedSources,Source), findtextentry(CorrectedSources,CorrectedTextEntries,Source,TextEntry). %We've found the preferred source and so the textentry. findtextentry([Source|T1],[TextEntry|T2],Source,TextEntry). %Not found the preferred source, so keep looking. findtextentry([H1|T1],[H2|T2],Source,TextEntry) :- findtextentry(T1,T2,Source,TextEntry). %preferredsource(ListOfSources,Source) :- Source is the preferred source from amongst the list of sources ListOfSources. preferredsource([H|T],Source) :- preferredsource(T,H,Source). preferredsource([H|T],S,Source) :- preferred(S,H), preferredsource(T,S,Source). preferredsource([H|T],S,Source) :- preferred(H,S), preferredsource(T,H,Source). preferredsource([],Source,Source). %preferred(PreferredTerm,UnPreferredTerm) :- PreferredTerm is preferred to UnPreferredTerm. preferred(Term1,Term2) :- sourcepreference(Term1,Term2). preferred(Term1,Term2) :- sourcepreference(Term1,Term3), preferred(Term3,Term2). %Define the following preference ordering (most preferred first): EC, MSD. %sourcepreference(PreferredTerm,UnPreferredTerm). sourcepreference('EC','MSD'). %correctfornulls(Sources,TextEntries,CorrectedSources,CorrectedTextEntries) :- CorrectedTextEntries is the list %TextEntries with any nulls removed. CorrectedSources is the list Sources with any sources removed if the reports %for which they are the sources have a null textentry. For example: % ?- correctfornulls(['BBCi','CNN','The Weather Channel','BBC London'],[rain,null,sun,null],L1,L2). % L1 = ['BBCi','The Weather Channel'] % L2 = [rain,sun] %the textentry is a null, so remove it and the corresponding source from the lists. correctfornulls([Source|T1],[null|T2],CorrectedSources,CorrectedTextEntries) :- correctfornulls(T1,T2,CorrectedSources,CorrectedTextEntries). %The text entry is not a null, so add it and the corresponding source to the lists. correctfornulls([Source|T1],[TextEntry|T2],[Source|T3],[TextEntry|T4]) :- not TextEntry == null, correctfornulls(T1,T2,T3,T4). correctfornulls([],[],[],[]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%% %%%%%%%%%%%%%%% %%%%%%%%%%% Code for checking that all GOID#s belong to MOLECULAR FUNCTION HIERARCHY %%%%%%%%%%%%%%% %%%%%%%%%%% %%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %molecularfunction(GO_IDNums) :- succeeds if all the GOID numbers in list GOID#s belong to the GO MOLECULAR FUNCTION hierarchy molecularfunctions(GO_IDNums) :- getlineages(GO_IDNums,Lineages), sameroot(Lineages), gethead(Lineages,Head), ismolecularfunction(Head). %getlineages(TextEntries,Lineages) :- Lineages is a list of all the lineages of the members of TextEntries. %Lineages is thus a list of lists. %For example: ?- getlineages([andy,jack,fred],X). % X = [[tom,bob],[tom,bob,jim],[tom,bob,jim,jane]] %The lineages are reversed so that the root memeber (in this case tom) comes first. getlineages([H|T1],[ReversedLineage|T2]) :- lineage(H,Lineage), reverse(Lineage,ReversedLineage), getlineages(T1,T2). getlineages([],[]). %lineage(Person,Lineage) :- Lineage is a list of the ancestors of Person. %For example: ?- lineage(jane,X). % X = [jane,jim,bob,tom] %This rule makes sure person herself is included in lineage. If this isn't done, rule %getleastupperbound will not give the parent as answer to a parent child pair, but instead, %will return the parent of the parent. (i.e. without this rule, leastupperbound([fred,jane],X) %would return jim, when it should return jane.) %We also want to check first to make sure that Person is a member of the hierarchy. lineage(Person,[Person|Rest]) :- auxlineage(Person,Rest). auxlineage(Person,[X|Rest]) :- parent(X,Person), auxlineage(X,Rest),!. auxlineage(Person,[]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %parent(Parent,Child). %tree hierarchy for functional annotations of proteins from GO database. %First two nodes are common to functional annotations %Note: we wish to treat molecular_function, biological_process and cellular_component as %hierarchies, so we supress the parent relationship of Gene_Ontology to these three nodes. %parent('GO:0003673','GO:0003674'). parent('GO:0003674','GO:0003824'). %Leaf is 0030523 parent('GO:0003824','GO:0016740'). parent('GO:0016740','GO:0016746'). parent('GO:0016746','GO:0016747'). parent('GO:0016747','GO:0008415'). parent('GO:0008415','GO:0016417'). parent('GO:0016417','GO:0030523'). %Leaf is 0004517 parent('GO:0003824','GO:0016491'). parent('GO:0016491','GO:0016705'). parent('GO:0016705','GO:0016709'). parent('GO:0016709','GO:0004517'). %Leaf is 0008811 parent('GO:0008415','GO:0008374'). parent('GO:0008415','GO:0016407'). parent('GO:0008374','GO:0016413'). parent('GO:0016407','GO:0016413'). %Note: this violates tree structure. parent('GO:0016413','GO:0008811'). %Leaf is 0004149 parent('GO:0008415','GO:0016748'). parent('GO:0016417','GO:0016751'). parent('GO:0016748','GO:0016751'). %Note: this violates tree structure. parent('GO:0016751','GO:0004149'). %For new case study. parent('GO:0003824','GO:0016829'). parent('GO:0016829','GO:0016835'). parent('GO:0016835','GO:0016836'). parent('GO:0016836','GO:0004122'). parent('GO:0016835','GO:0016839'). parent('GO:0016839','GO:0004124'). parent('GO:0016836','GO:0004794'). parent('GO:0016836','GO:0004834'). %These are in the cellular_component hierarchy. parent('GO:0005575','GO:0005623'). parent('GO:0005623','GO:0005622'). parent('GO:0005622','GO:0005737'). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %sameroot(Lineages) :- succeeds if all lineages in list Lineages share a root. If this test fails, we do not want %to return a least upper bound. sameroot(Lineages) :- getheads(Lineages,Heads), testheads(Heads). %getheads(Lineages,Heads) :- Lineages is a list of lineages of the textentries whose least upper bound we are searching for. %Lineages is thus a list of lists. Heads is a list of the heads of each of those lists in Lineages. getheads([[H|T1]|T2],[H|T3]) :- getheads(T2,T3). getheads([],[]). %testheads(Heads) :- Heads is a list of the heads of all the lists in Lineages. Succeeds if all heads are the same. testheads([H1,H2|T]) :- H1 == H2, testheads([H2|T]). testheads([H|[]]). %gethead(Lineages,Head) :- In this case we already know that all the lineages in Lineages DO have the same %root, or head. Head is the root of the first lineage, and so should be the root of all of them. gethead([[H|T1]|T2],H). %ismolecularfunction(Head) :- succeeds if Head is GO annotation molecular_function. ismolecularfunction(Head) :- Head = 'GO:0003674'.