
%:-['day14_1500_kegg_no_equ.xml-Original.pl'].
:-['2010_9_1/kegg_rno.pl'].
%:-['2010_9_6/kegg_day14_mappedProbe_2010_9_6'].
%:-['2010_9_25/25sep2010_cancer_ver1'].



:- use_module(library(lists)).

checkCompoundName([]).
checkCompoundName([CName|CompoundList]):-	
	checkCompoundName(CompoundList),
	((concept_name(CID,CName,true);concept_accession(CID,_,CName,false))->
		Foo=1;
		nl,write(CName)
	).


gatherFoundableID([],[]).
gatherFoundableID([CName|CompoundList],NewCID_List):-
	gatherFoundableID(CompoundList,CID_List),
	((concept_name(CID,CName,true);concept_accession(CID,_,CName,false))->
		NewCID_List=[CID|CID_List];
		NewCID_List=CID_List
	).


forAll(P,Q):- \+ (P, \+Q).


t:-
	%tell('kegg_rno_cp.pl'),
	tell('2010_9_1/cp.pl'),
	UbiquitousCompoundList=['2\'-deoxyguanosine-5\'-diphosphate','2\'-deoxyguanosine-5\'-diphosphate','2\'-deoxyguanosine-5\'-monophosphate','2\'-deoxyguanosine-5\'-triphosphate','2\'-deoxyuridine-5\'-diphosphate','AMP','ADP','ATP','acetyl-CoA','CO2','bicarbonate','CoA-SH','CO-A','CMP','CDP','CTP','cytidylic acid','Deoxyadenosine monophosphate','formic acid','GMP','GDP','GTP','dGMP','dGDP','dGMP','glyoxalate','guanosine-5\'-diphosphate','H+','|Donor-H2|','|Acceptor|','|Pi|','PPI','P+','H2O','H2O2','NADP+','ammonia','NAD','NADP','NADH','NADPH','NAD-P-OR-NOP','NADH-P-OR-NOP','O2-','|Oxidized-ferredoxins|','oxomethane','oxygen','propynoate','UMP','UDP','UTP','uridine-5\'-monophosphate','beta-Nicotinamide-ribonucleotide','dATP','dUMP','dUDP','dUTP','pyruvate','ADENOSYL-HOMO-CYS','|Some-tRNA|'],
	%UbiquitousCompoundList=['NH3','CO2','H+','|Donor-H2|','|Acceptor|','|Pi|','PPI','P+','H2O','H2O2','O2-','|Some-tRNA|'],
	%checkCompoundName(UbiquitousCompoundList).
	gatherFoundableID(UbiquitousCompoundList,CIDs),
	write('% These are removed:'),portray_clause(CIDs),
	forAll(consumed_by(CID1,RID1,IMPD1),writeConsumed(consumed_by(CID1,RID1,IMPD1),CIDs)),
	forAll(produced_by(CID2,RID2,IMPD2),writeProduced(produced_by(CID2,RID2,IMPD2),CIDs)),
	told.
	%forAll(member(CID,CIDs),writeProduced(CID)).
	
writeConsumed(consumed_by(CID,RID,IMPD),CIDs):-
	(member(CID,CIDs)->
		write('%'),portray_clause(consumed_by(CID,RID,IMPD));
		portray_clause(consumed_by(CID,RID,IMPD))
	).
writeProduced(produced_by(CID,RID,IMPD),CIDs):-
	(member(CID,CIDs)->
		write('%'),portray_clause(produced_by(CID,RID,IMPD));
		portray_clause(produced_by(CID,RID,IMPD))
	).
