[ <Examples> ]

Examples

This pages contains various examples auto-extracted from the blip module documentation, in no particular order

example1_bioseq

Extracted from module : bioseq



  :- use_module(bio(bioseq)).

  % demo: reverse complement a DNA sequence
  demo:-
    revcomp('TCAG',Seq1),
    format('revcomp(TCAG) = ~w~n',[Seq1]),
    translate_dna(atg,Seq2),
    format('translate(ATG) = ~w~n',[Seq2]).
  

Output:

revcomp(TCAG) = CTGA
translate(ATG) = M

example2_biotable

Extracted from module : biotable



  :- use_module(bio(biotable)).
  :- use_module(library(table)).
  
  demo:-
    % assumes we have run blast with -m8 option
    connect_biotable('hsinsulin.blastcl3.blastn.m8',blast_tbl,Tbh),
  
    % select all hit sequence IDs satisfying expect-value constraint
    setof(Name,
          Pos^E^(in_table(Tbh,[hit_name(Name),evalue(E)],Pos),E<1e-40),
          IDs),

    % show all IDs
    writeln(hit_ids = IDs).
  

Output:

hit_ids=[emb|AJ009655.1|HSA9655, emb|V00565.1|HSINSU, emb|X61089.1|PTPPINS, gb|AC130303.8|, gb|AC132217.15|, gb|AY137497.1|AY137496S2, gb|AY137500.1|AY137498S3, gb|AY137503.1|AY137501S3, gb|AY138590.1|AY138589S2, gb|J00265.1|HUMINS01, gb|J02989.1|ATRINS, gb|L15440.1|HUMINSTHIG, gb|M10039.1|HUMINSPR]

example3_dbmeta

Extracted from module : dbmeta



  :- use_module(bio(io)).
  :- use_module(bio(dbmeta),[write_db_summary/0]).

  demo:-
    load_bioresource(go),
    write_db_summary.
  

Output:

count(ontology/3, 0).
count(class/2, 18988).
count(subclass/2, 24505).
count(restriction/3, 3569).
count(belongs/2, 18989).
count(synonym/3, 16843).
count(class_xref/2, 12207).
count(def_xref/2, 0).
count(property/2, 1).
count(property_domain/2, 0).
count(property_range/2, 0).
count(slot/2, 0).
count(lexical_category/2, 0).
count(is_anonymous/1, 0).
count(inverse_of/2, 0).
count(is_transitive/1, 1).
count(is_symmetric/1, 0).
count(is_reflexive/1, 0).
count(is_anti_symmetric/1, 0).
count(obsolete/3, 991).
count(obsolete_class/2, 991).
count(idspace/2, 0).
count(inst_of/2, 0).
count(inst_rel/3, 0).
count(inst_sv/3, 0).
count(inst_sv/4, 0).
count(inst/2, 0).
count(genus/2, 0).
count(class_comment/2, 683).
count(def/2, 18026).
count(differentium/3, 0).

example4_dbmeta

Extracted from module : dbmeta



  :- use_module(bio(taxon_db)).
  :- use_module(bio(dbmeta)).

  demo:-
    format('The taxon module defines the following data predicates~n'),
    forall(datapred(taxon_db,P),
           format(' Data predicate: ~w~n',[P])).
  
  

Output:

The taxon module defines the following data predicates
 Data predicate: taxname/5
 Data predicate: taxnode/13

example5_fasta_db

Extracted from module : fasta_db



  :- use_module(bio(fasta_db)).
  :- use_module(bio(io)).

  demo:-
    load_biofile(fasta,'utr.fasta'),
    forall( (fastaseq(ID,_,Seq),sub_atom(Seq,Pos,_,_,'CGCATATC')),
            format('Subseq in ~w at ~w~n',[ID,Pos])).
  

Output:

Subseq in CG2671-RB_5_UTR at 42
Subseq in CG2671-RD_5_UTR at 42
Subseq in CG2671-RE_5_UTR at 42
Subseq in CG2671-RC_5_UTR at 58
Subseq in CG2671-RA_5_UTR at 58
Subseq in CG11924-RA_5_UTR at 225
Subseq in CG11924-RB_5_UTR at 225
Subseq in CG11924-RC_5_UTR at 249
Subseq in CG11924-RD_5_UTR at 225
Subseq in CG7239-RA_5_UTR at 80
Subseq in CG18783-RA_5_UTR at 687
Subseq in CG9261-RC_5_UTR at 573
Subseq in CG4567-RA_5_UTR at 12
Subseq in CG5686-RA_5_UTR at 130
Subseq in CG6495-RA_5_UTR at 94
Subseq in CG9339-RG_5_UTR at 539
Subseq in CG9339-RA_5_UTR at 505
Subseq in CG9339-RB_5_UTR at 759
Subseq in CG9339-RE_5_UTR at 759
Subseq in CG8213-RA_5_UTR at 320
Subseq in CG10149-RB_5_UTR at 30
Subseq in CG8183-RB_5_UTR at 257
Subseq in CG8183-RA_5_UTR at 257
Subseq in CG30463-RA_5_UTR at 662
Subseq in CG30463-RB_5_UTR at 604
Subseq in CG3800-RA_5_UTR at 84
Subseq in CG1212-RA_5_UTR at 410
Subseq in CG13893-RA_5_UTR at 445
Subseq in CG7971-RA_5_UTR at 18
Subseq in CG7971-RC_5_UTR at 18
Subseq in CG11594-RA_5_UTR at 723
Subseq in CG11594-RB_5_UTR at 723
Subseq in CG7018-RA_5_UTR at 135
Subseq in CG32048-RA_5_UTR at 152
Subseq in CG33048-RB_5_UTR at 1475
Subseq in CG1084-RA_5_UTR at 14
Subseq in CG31522-RD_5_UTR at 74
Subseq in CG31522-RA_5_UTR at 59
Subseq in CG5167-RA_5_UTR at 171
Subseq in CG7129-RA_5_UTR at 114
Subseq in CG5835-RA_5_UTR at 194
Subseq in CG6343-RB_5_UTR at 91
Subseq in CG5441-RA_5_UTR at 210
Subseq in CG5588-RB_5_UTR at 187
Subseq in CG12773-RA_5_UTR at 6
Subseq in CG7803-RA_5_UTR at 189
Subseq in CG32498-RB_5_UTR at 1283
Subseq in CG6824-RA_5_UTR at 519
Subseq in CG4165-RA_5_UTR at 195
Subseq in CG33080-RB_5_UTR at 34
Subseq in CG11284-RA_5_UTR at 495
Subseq in CG12106-RA_5_UTR at 12
Subseq in CG1664-RA_5_UTR at 459
Subseq in CG7122-RB_5_UTR at 641
Subseq in CG7122-RA_5_UTR at 726
Subseq in CG15064-RA_5_UTR at 28
Subseq in CG14228-RA_5_UTR at 12
Subseq in CG12679-RA_5_UTR at 63
Subseq in CG1829-RA_5_UTR at 571

example6_goa_db

Extracted from module : goa_db



  :- use_module(bio(io)).
  :- use_module(bio(goa_db)).
  :- use_module(bio(ontol_db)).

  demo:-
    load_biofile(go_assoc,'gene_assoc.fb.tbl'),
    load_bioresource(go),         % loads class/2, subclass/2 etc
    QN=membrane,
    class(QueryClassID,QN),        % fetch GO ID
    format('Querying "~w"~n',[QN]),
    forall(associationRT(AssocID,ClassID,FeatureID,Qual,QueryClassID),
           (   class(ClassID,ClassName),
               feature(ID,GeneName,_),
               format('  Gene: ~w [assigned directly to ~w ~w]~n',
                      [GeneName,ClassID,ClassName]),
               forall(evidence(AssocID,EvID),
                      format('    (evidence ~w)~n',[EvID])))).
  

Output:

Querying "membrane"

example7_google

Extracted from module : google



  % uncomment the following line and put your own key here:
  % user:google_apikey('sdkhjaskldj//aljdalsdsjsdk').

  :- use_module(bio(google)).

  demo:-
      google_search('google blip',Items),
      forall(member(Item,Items),
             show_result_item(Item)).

  show_result_item(item(URL,Tags)):-
             format('URL: ~w~n',[URL]),
             member(snippet=Snippet,Tags),
             format('  snippet: ~w~n~n',[Snippet]).
  

Output:

parsing(/tmp/pl_googleoutxml_7560_1)
[element(SOAP-ENV:Envelope, [xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/, xmlns:xsi=http://www.w3.org/1999/XMLSchema-instance, xmlns:xsd=http://www.w3.org/1999/XMLSchema], [element(SOAP-ENV:Body, [], [element(ns1:doGoogleSearchResponse, [xmlns:ns1=urn:GoogleSearch, SOAP-ENV:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/], [element(return, [xsi:type=ns1:GoogleSearchResult], [element(directoryCategories, [xmlns:ns2=http://schemas.xmlsoap.org/soap/encoding/, xsi:type=ns2:Array, ns2:arrayType=ns1:DirectoryCategory[0]], []), element(documentFiltering, [xsi:type=xsd:boolean], [true]), element(endIndex, [xsi:type=xsd:int], [10]), element(estimateIsExact, [xsi:type=xsd:boolean], [false]), element(estimatedTotalResultsCount, [xsi:type=xsd:int], [27300]), element(resultElements, [xmlns:ns3=http://schemas.xmlsoap.org/soap/encoding/, xsi:type=ns3:Array, ns3:arrayType=ns1:ResultElement[10]], [element(item, [xsi:type=ns1:ResultElement], [element(URL, [xsi:type=xsd:string], [http://searchenginewatch.com/sereport/article.php/2164611]), element(cachedSize, [xsi:type=xsd:string], [50k]), element(directoryCategory, [xsi:type=ns1:DirectoryCategory], [element(fullViewableName, [xsi:type=xsd:string], []), element(specialEncoding, [xsi:type=xsd:string], [])]), element(directoryTitle, [xsi:type=xsd:string], []), element(hostName, [xsi:type=xsd:string], []), element(relatedInformationPresent, [xsi:type=xsd:boolean], [true]), element(snippet, [xsi:type=xsd:string], [This <b>Google</b> <b>blip</b> wouldn&#39;t make Liv Tyler very happy, though it&#39;s still hard to<br> see which <b>...</b> The classic <b>Google</b> <b>blip</b>, that put Bill Gates on par with Satan. <b>...</b>]), element(summary, [xsi:type=xsd:string], []), element(title, [xsi:type=xsd:string], [<b>Google</b> Bombs Aren&#39;t So Scary])]), element(item, [xsi:type=ns1:ResultElement], [element(URL, [xsi:type=xsd:string], [http://google.blogspace.com/archives/000620.html]), element(cachedSize, [xsi:type=xsd:string], [3k]), element(directoryCategory, [xsi:type=ns1:DirectoryCategory], [element(fullViewableName, [xsi:type=xsd:string], []), element(specialEncoding, [xsi:type=xsd:string], [])]), element(directoryTitle, [xsi:type=xsd:string], []), element(hostName, [xsi:type=xsd:string], []), element(relatedInformationPresent, [xsi:type=xsd:boolean], [true]), element(snippet, [xsi:type=xsd:string], [September 30, 2002: A <b>Blip</b> on the Radar. Reuters: &#39;<b>Google</b> blips&#39;: Search not<br> always right covers the fact that Microsoft comes up first on a search for &quot;go <b>...</b>]), element(summary, [xsi:type=xsd:string], []), element(title, [xsi:type=xsd:string], [A <b>Blip</b> on the Radar (<b>Google</b> Weblog)])]), element(item, [xsi:type=ns1:ResultElement], [element(URL, [xsi:type=xsd:string], [http://www.webmasterworld.com/forum89/6572.htm]), element(cachedSize, [xsi:type=xsd:string], []), element(directoryCategory, [xsi:type=ns1:DirectoryCategory], [element(fullViewableName, [xsi:type=xsd:string], []), element(specialEncoding, [xsi:type=xsd:string], [])]), element(directoryTitle, [xsi:type=xsd:string], []), element(hostName, [xsi:type=xsd:string], []), element(relatedInformationPresent, [xsi:type=xsd:boolean], [true]), element(snippet, [xsi:type=xsd:string], [Have your earnings returned to &quot;normal&quot; googles 05/05/05 <b>blip</b>.]), element(summary, [xsi:type=xsd:string], []), element(title, [xsi:type=xsd:string], [<b>Google&#39;s</b> 05/05/05 <b>Blip</b>])]), element(item, [xsi:type=ns1:ResultElement], [element(URL, [xsi:type=xsd:string], [http://www.webmasterworld.com/forum86/480.htm]), element(cachedSize, [xsi:type=xsd:string], []), element(directoryCategory, [xsi:type=ns1:DirectoryCategory], [element(fullViewableName, [xsi:type=xsd:string], []), element(specialEncoding, [xsi:type=xsd:string], [])]), element(directoryTitle, [xsi:type=xsd:string], []), element(hostName, [xsi:type=xsd:string], []), element(relatedInformationPresent, [xsi:type=xsd:boolean], [true]), element(snippet, [xsi:type=xsd:string], [A significant <b>blip</b> on the <b>Google</b> radar screen I&#39;m sure. Let&#39;s see if other nations<br> follow suit... antonaf Junior Member view member profile <b>...</b>]), element(summary, [xsi:type=xsd:string], []), element(title, [xsi:type=xsd:string], [<b>Google</b> Loses French Appeal])]), element(item, [xsi:type=ns1:ResultElement], [element(URL, [xsi:type=xsd:string], [http://chrisray.typepad.com/blog/2005/05/googles_dns_bli.html]), element(cachedSize, [xsi:type=xsd:string], [28k]), element(directoryCategory, [xsi:type=ns1:DirectoryCategory], [element(fullViewableName, [xsi:type=xsd:string], []), element(specialEncoding, [xsi:type=xsd:string], [])]), element(directoryTitle, [xsi:type=xsd:string], []), element(hostName, [xsi:type=xsd:string], []), element(relatedInformationPresent, [xsi:type=xsd:boolean], [true]), element(snippet, [xsi:type=xsd:string], [<b>Google&#39;s</b> DNS <b>Blip</b>. Hacked? <b>Google</b> says not and blame their 15 minute outage Saturday<br> <b>...</b> Listed below are links to weblogs that reference <b>Google&#39;s</b> DNS <b>Blip</b>: <b>...</b>]), element(summary, [xsi:type=xsd:string], []), element(title, [xsi:type=xsd:string], [Chris Ray | Interactively Speaking: <b>Google&#39;s</b> DNS <b>Blip</b>])]), element(item, [xsi:type=ns1:ResultElement], [element(URL, [xsi:type=xsd:string], [http://www.threadwatch.org/node/3632]), element(cachedSize, [xsi:type=xsd:string], [32k]), element(directoryCategory, [xsi:type=ns1:DirectoryCategory], [element(fullViewableName, [xsi:type=xsd:string], []), element(specialEncoding, [xsi:type=xsd:string], [])]), element(directoryTitle, [xsi:type=xsd:string], []), element(hostName, [xsi:type=xsd:string], []), element(relatedInformationPresent, [xsi:type=xsd:boolean], [true]), element(snippet, [xsi:type=xsd:string], [Text Link Advertising Moves Forward, Without a <b>Blip</b>! <b>...</b> We also know that <b>Google</b><br> hates link spam (comment spam, guestbook spam, trackback spam, link farms, <b>...</b>]), element(summary, [xsi:type=xsd:string], []), element(title, [xsi:type=xsd:string], [Text Link Advertising Moves Forward, Without a <b>Blip</b>! | Threadwatch.org])]), element(item, [xsi:type=ns1:ResultElement], [element(URL, [xsi:type=xsd:string], [http://www.searchengineworld.com/forum912/1-35-10.htm]), element(cachedSize, [xsi:type=xsd:string], []), element(directoryCategory, [xsi:type=ns1:DirectoryCategory], [element(fullViewableName, [xsi:type=xsd:string], []), element(specialEncoding, [xsi:type=xsd:string], [])]), element(directoryTitle, [xsi:type=xsd:string], []), element(hostName, [xsi:type=xsd:string], []), element(relatedInformationPresent, [xsi:type=xsd:boolean], [true]), element(snippet, [xsi:type=xsd:string], [<b>Google</b> registered an initial 3 day <b>blip</b> up in referrals then virtually disappeared<br> from SE referrals for the next 16 Days. In September however, <b>Google</b> came <b>...</b>]), element(summary, [xsi:type=xsd:string], []), element(title, [xsi:type=xsd:string], [<b>Google</b> Update Jagger Continues])]), element(item, [xsi:type=ns1:ResultElement], [element(URL, [xsi:type=xsd:string], [http://www.theage.com.au/articles/2003/01/03/1041196779397.html]), element(cachedSize, [xsi:type=xsd:string], [28k]), element(directoryCategory, [xsi:type=ns1:DirectoryCategory], [element(fullViewableName, [xsi:type=xsd:string], []), element(specialEncoding, [xsi:type=xsd:string], [])]), element(directoryTitle, [xsi:type=xsd:string], []), element(hostName, [xsi:type=xsd:string], []), element(relatedInformationPresent, [xsi:type=xsd:boolean], [true]), element(snippet, [xsi:type=xsd:string], [Typed anything into the <b>Google</b> search engine lately? Your query and millions like<br> it are being logged <b>...</b> And that last little <b>blip</b>? &quot;Hawaii,&quot; Patel says. <b>...</b>]), element(summary, [xsi:type=xsd:string], []), element(title, [xsi:type=xsd:string], [Ga-ga over <b>Google</b> - theage.com.au])]), element(item, [xsi:type=ns1:ResultElement], [element(URL, [xsi:type=xsd:string], [http://www.highrankings.com/faq-google-hate.htm]), element(cachedSize, [xsi:type=xsd:string], [11k]), element(directoryCategory, [xsi:type=ns1:DirectoryCategory], [element(fullViewableName, [xsi:type=xsd:string], []), element(specialEncoding, [xsi:type=xsd:string], [])]), element(directoryTitle, [xsi:type=xsd:string], []), element(hostName, [xsi:type=xsd:string], []), element(relatedInformationPresent, [xsi:type=xsd:boolean], [true]), element(snippet, [xsi:type=xsd:string], [While your various keyword phrases are on an emotional roller coaster at <b>Google</b>,<br> you won&#39;t even notice a <b>blip</b> in your traffic or sales if you&#39;ve got all <b>...</b>]), element(summary, [xsi:type=xsd:string], []), element(title, [xsi:type=xsd:string], [Why does <b>Google</b> hate my site? SEO FAQ - High Rankings])]), element(item, [xsi:type=ns1:ResultElement], [element(URL, [xsi:type=xsd:string], [http://groups.google.com/group/comp.graphics.apps.photoshop]), element(cachedSize, [xsi:type=xsd:string], [42k]), element(directoryCategory, [xsi:type=ns1:DirectoryCategory], [element(fullViewableName, [xsi:type=xsd:string], []), element(specialEncoding, [xsi:type=xsd:string], [])]), element(directoryTitle, [xsi:type=xsd:string], []), element(hostName, [xsi:type=xsd:string], []), element(relatedInformationPresent, [xsi:type=xsd:boolean], [true]), element(snippet, [xsi:type=xsd:string], [Go to <b>Google</b> Groups Home <b>...</b> Thanks, Colonel <b>Blip</b>. E-mail: colonelblip.no.spam.ple...@big<br> foot.com ----== Posted via Newsfeeds. <b>...</b>]), element(summary, [xsi:type=xsd:string], []), element(title, [xsi:type=xsd:string], [<b>Google</b> Groups : comp.graphics.apps.photoshop])])]), element(searchComments, [xsi:type=xsd:string], []), element(searchQuery, [xsi:type=xsd:string], [google blip]), element(searchTime, [xsi:type=xsd:double], [0.291973]), element(searchTips, [xsi:type=xsd:string], []), element(startIndex, [xsi:type=xsd:int], [1])])])])])]
URL: http://searchenginewatch.com/sereport/article.php/2164611
  snippet: This <b>Google</b> <b>blip</b> wouldn&#39;t make Liv Tyler very happy, though it&#39;s still hard to<br> see which <b>...</b> The classic <b>Google</b> <b>blip</b>, that put Bill Gates on par with Satan. <b>...</b>

URL: http://google.blogspace.com/archives/000620.html
  snippet: September 30, 2002: A <b>Blip</b> on the Radar. Reuters: &#39;<b>Google</b> blips&#39;: Search not<br> always right covers the fact that Microsoft comes up first on a search for &quot;go <b>...</b>

URL: http://www.webmasterworld.com/forum89/6572.htm
  snippet: Have your earnings returned to &quot;normal&quot; googles 05/05/05 <b>blip</b>.

URL: http://www.webmasterworld.com/forum86/480.htm
  snippet: A significant <b>blip</b> on the <b>Google</b> radar screen I&#39;m sure. Let&#39;s see if other nations<br> follow suit... antonaf Junior Member view member profile <b>...</b>

URL: http://chrisray.typepad.com/blog/2005/05/googles_dns_bli.html
  snippet: <b>Google&#39;s</b> DNS <b>Blip</b>. Hacked? <b>Google</b> says not and blame their 15 minute outage Saturday<br> <b>...</b> Listed below are links to weblogs that reference <b>Google&#39;s</b> DNS <b>Blip</b>: <b>...</b>

URL: http://www.threadwatch.org/node/3632
  snippet: Text Link Advertising Moves Forward, Without a <b>Blip</b>! <b>...</b> We also know that <b>Google</b><br> hates link spam (comment spam, guestbook spam, trackback spam, link farms, <b>...</b>

URL: http://www.searchengineworld.com/forum912/1-35-10.htm
  snippet: <b>Google</b> registered an initial 3 day <b>blip</b> up in referrals then virtually disappeared<br> from SE referrals for the next 16 Days. In September however, <b>Google</b> came <b>...</b>

URL: http://www.theage.com.au/articles/2003/01/03/1041196779397.html
  snippet: Typed anything into the <b>Google</b> search engine lately? Your query and millions like<br> it are being logged <b>...</b> And that last little <b>blip</b>? &quot;Hawaii,&quot; Patel says. <b>...</b>

URL: http://www.highrankings.com/faq-google-hate.htm
  snippet: While your various keyword phrases are on an emotional roller coaster at <b>Google</b>,<br> you won&#39;t even notice a <b>blip</b> in your traffic or sales if you&#39;ve got all <b>...</b>

URL: http://groups.google.com/group/comp.graphics.apps.photoshop
  snippet: Go to <b>Google</b> Groups Home <b>...</b> Thanks, Colonel <b>Blip</b>. E-mail: colonelblip.no.spam.ple...@big<br> foot.com ----== Posted via Newsfeeds. <b>...</b>


example8_graph

Extracted from module : graph



  % example data predicates
  subclass(a,d).
  subclass(b,e).
  subclass(c,f).
  subclass(d,e).
  subclass(e,g).
  subclass(f,g).
  subclassT(X,Y):- closure(subclass,X,Y).

  % this illustrates spanning_node/3
  demo:-
    ensure_loaded(bio(graph)),
    setof(X,spanning_node(subclassT,[a,b,c],X),Xs),
    format('spanning nodes: ~w~n',[Xs]).
  

Output:

spanning nodes: [g]

example9_graph

Extracted from module : graph



  % This example illustrates the transitive closure of a relation
  :- use_module(bio(graph)).
  :- use_module(bio(ontol_db)).
  :- use_module(bio(io)).

  % demo: find all superclasses of cysteine metabolism
  demo:-
    load_bioresource(go),
    class(ID,'cysteine metabolism'),
    setof(SuperClassID,closure(subclass,ID,SuperClassID),SuperClassIDs),
    forall(member(SuperClassID,SuperClassIDs),
           (   class(SuperClassID,N),
               format('subclass: ~w ~w~n',[SuperClassID,N]))).
    
  

Output:

subclass: GO:0000096 sulfur amino acid metabolism
subclass: GO:0006082 organic acid metabolism
subclass: GO:0006519 amino acid and derivative metabolism
subclass: GO:0006520 amino acid metabolism
subclass: GO:0006790 sulfur metabolism
subclass: GO:0006807 nitrogen compound metabolism
subclass: GO:0007582 physiological process
subclass: GO:0008150 biological_process
subclass: GO:0008152 metabolism
subclass: GO:0009069 serine family amino acid metabolism
subclass: GO:0009308 amine metabolism
subclass: GO:0009987 cellular process
subclass: GO:0019752 carboxylic acid metabolism
subclass: GO:0044237 cellular metabolism
subclass: GO:0044238 primary metabolism
subclass: GO:0050875 cellular physiological process

example10_graph

Extracted from module : graph



  % this illustrates the user of higher-order programming -
  % combining relations
  % here we combine graph closure over 'subclass' and inverse
  % to get superclasses
  :- use_module(bio(graph)).
  :- use_module(bio(ontol_db)).
  :- use_module(bio(io)).

  % demo: find all subclasses of cysteine metabolism
  demo:-
    load_bioresource(go),
    class(ID,'cysteine metabolism'),
    setof(SubClassID,closure(inverse(subclass),ID,SubClassID),SubClassIDs),
    forall(member(SubClassID,SubClassIDs),
           (   class(SubClassID,N),
               format('subclass: ~w ~w~n',[SubClassID,N]))).
  

Output:

subclass: GO:0006535 cysteine biosynthesis from serine
subclass: GO:0009093 cysteine catabolism
subclass: GO:0019267 asparagine biosynthesis from cysteine
subclass: GO:0019343 cysteine biosynthesis via cystathione
subclass: GO:0019344 cysteine biosynthesis
subclass: GO:0019345 cysteine biosynthesis via S-sulfo-L-cysteine
subclass: GO:0019346 transsulfuration
subclass: GO:0019447 D-cysteine catabolism
subclass: GO:0019448 L-cysteine catabolism
subclass: GO:0019449 L-cysteine catabolism to hypotaurine
subclass: GO:0019450 L-cysteine catabolism to pyruvate
subclass: GO:0019451 L-cysteine catabolism to pyruvate, using cysteine dioxygenase
subclass: GO:0019452 L-cysteine catabolism to taurine
subclass: GO:0019453 L-cysteine catabolism via cystine
subclass: GO:0019454 L-cysteine catabolism via cystine, using glutathione-cystine transhydrogenase
subclass: GO:0019455 L-cysteine catabolism via cystine, using cystine reductase
subclass: GO:0019456 L-cysteine catabolism via cystine, using cysteine transaminase
subclass: GO:0046438 D-cysteine metabolism
subclass: GO:0046439 L-cysteine metabolism

example11_io

Extracted from module : io



  % -- purpose: show loading and unloading of a dynamic db --

  % make sure ontol db is modifiable BEFORE loading module
  user:dynamic_db(ontol_db).

  % load modules
  :- use_module(bio(io)).
  :- use_module(bio(ontol_db)).

  % summarize all ontologies currently loaded into the db
  summarize_ontol:-
    setof(Ont,ID^belongs(ID,Ont),Onts),
    length(Onts,CountOnts),
    format('Summary of ~w ontologies:~n',[CountOnts]),
    forall(member(Ont,Onts),show_ontol_size(Ont)).

  % fetch all IDs belonging to an ontology and display count
  show_ontol_size(Ont):-
    setof(ID,belongs(ID,Ont),IDs),
    length(IDs,CountIDs),
    format('ontol ~w has ~w classes~n',[Ont,CountIDs]).

  demo:-
    load_bioresource(cell),
    load_bioresource(go),
    writeln('cell+go:'),
    summarize_ontol,
    unload_bioresource(cell),
    writeln('go:'),
    summarize_ontol,
    unload_bioresource(go).
  

Output:

cell+go:
Summary of 5 ontologies:
ontol biological_process has 10046 classes
ontol cell has 741 classes
ontol cellular_component has 1629 classes
ontol gene_ontology has 1 classes
ontol molecular_function has 7313 classes
go:
Summary of 1 ontologies:
ontol gene_ontology has 1 classes

example12_io

Extracted from module : io



  % -- load an ontology into the db and query it --
  :- use_module(bio(io)).
  :- use_module(bio(ontol_db)).
  :- use_module(bio(sb_db)).

  demo:-
    load_bioresource(chebi), % this ontology must be defined in bioconf.pro
    load_biofile(sbml,'BIOMD0000000018.xml'),
    class(ClassID,'amino acids'),
    forall((   subclassRT(AnnotClassID,ClassID),
               entity_class(EntID,AnnotClassID),
               class(AnnotClassID,AnnotClassName)),
           format('Entity: ~w AnnotClass: ~w ~w~n',
                  [EntID,AnnotClassID,AnnotClassName])).
  

Output:

Entity: glutamine AnnotClass: CHEBI:18050 L-glutamine
Entity: glutamine AnnotClass: CHEBI:18050 L-glutamine
Entity: serine AnnotClass: CHEBI:17115 L-serine
Entity: serine AnnotClass: CHEBI:17115 L-serine
Entity: glycine AnnotClass: CHEBI:15428 glycine

example13_io

Extracted from module : io



  % examples of converting from one file format to another:
  % Chaos-XML to Chado/Sequence Ontology OWL format
  :- use_module(bio(io)).

  demo:-
    load_bioresource(so),
    load_biofile(chaos,'Rab1.chaos-xml'),
    write_biofile(pro,'Rab1.pro'),
    ensure_loaded(bio(seqfeature_bridge_to_inst)),
    write_biofile(owl,'Rab1.owl'),
    writeln('Showing first 100 lines of exported OWL file:'),
    shell('head -100 Rab1.owl').
  

Output:

Showing first 100 lines of exported OWL file:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE rdf:RDF [
    <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
]>

<rdf:RDF
    xmlns:rdf="&rdf;"
>
<SO:SO_0000147 rdf:about="&exon;exon_EMBL/GenBank/SwissProt:AE003734:54949:55287"
    SO:SO_0000704="Rab1"
    orphan:locus_tag="CG3320">
  <orphan:id rdf:resource="&exon;exon_EMBL/GenBank/SwissProt:AE003734:54949:55287"/>
  <sox:has_location rdf:resource="&orphan;orphan_:featureloc::exon:EMBL/GenBank/SwissProt:AE003734:54949:55287::contig:AE003734.2:55787:51703::500::839::-1"/>
  <rdfs:label xml:lang="en">Rab1-exon-5</rdfs:label>
</SO:SO_0000147>

<SO:SO_0000147 rdf:about="&exon;exon_EMBL/GenBank/SwissProt:AE003734:53798:53918"
    SO:SO_0000704="Rab1"
    orphan:locus_tag="CG3320">
  <orphan:id rdf:resource="&exon;exon_EMBL/GenBank/SwissProt:AE003734:53798:53918"/>
  <sox:has_location rdf:resource="&orphan;orphan_:featureloc::exon:EMBL/GenBank/SwissProt:AE003734:53798:53918::contig:AE003734.2:55787:51703::1869::1990::-1"/>
  <rdfs:label xml:lang="en">Rab1-exon-4</rdfs:label>
</SO:SO_0000147>

<SO:SO_0000147 rdf:about="&exon;exon_EMBL/GenBank/SwissProt:AE003734:53688:53735"
    SO:SO_0000704="Rab1"
    orphan:locus_tag="CG3320">
  <orphan:id rdf:resource="&exon;exon_EMBL/GenBank/SwissProt:AE003734:53688:53735"/>
  <sox:has_location rdf:resource="&orphan;orphan_:featureloc::exon:EMBL/GenBank/SwissProt:AE003734:53688:53735::contig:AE003734.2:55787:51703::2052::2100::-1"/>
  <rdfs:label xml:lang="en">Rab1-exon-3</rdfs:label>
</SO:SO_0000147>

<SO:SO_0000147 rdf:about="&exon;exon_EMBL/GenBank/SwissProt:AE003734:53404:53631"
    SO:SO_0000704="Rab1"
    orphan:locus_tag="CG3320">
  <sox:has_location rdf:resource="&orphan;orphan_:featureloc::exon:EMBL/GenBank/SwissProt:AE003734:53404:53631::contig:AE003734.2:55787:51703::2156::2384::-1"/>
  <rdfs:label xml:lang="en">Rab1-exon-2</rdfs:label>
</SO:SO_0000147>

<SO:SO_0000147 rdf:about="&exon;exon_EMBL/GenBank/SwissProt:AE003734:52204:53631"
    SO:SO_0000704="Rab1"
    orphan:locus_tag="CG3320">
  <sox:has_location rdf:resource="&orphan;orphan_:featureloc::exon:EMBL/GenBank/SwissProt:AE003734:52204:53631::contig:AE003734.2:55787:51703::2156::3584::-1"/>
  <rdfs:label xml:lang="en">Rab1-exon-6</rdfs:label>
</SO:SO_0000147>

<SO:SO_0000147 rdf:about="&exon;exon_EMBL/GenBank/SwissProt:AE003734:52204:53323"
    SO:SO_0000704="Rab1"
    orphan:locus_tag="CG3320">
  <sox:has_location rdf:resource="&orphan;orphan_:featureloc::exon:EMBL/GenBank/SwissProt:AE003734:52204:53323::contig:AE003734.2:55787:51703::2464::3584::-1"/>
  <rdfs:label xml:lang="en">Rab1-exon-1</rdfs:label>
</SO:SO_0000147>

<SO:SO_0000104 rdf:about="&orphan;AAN13857.1"
    SO:SO_0000704="Rab1"
    orphan:codon_start="1"
    orphan:locus_tag="CG3320"
    orphan:note="Rab1 gene product from transcript CG3320-RB"
    orphan:product="CG3320-PB"
    sox:has_seqlen="146">
  <orphan:db_xref>FLYBASE:FBgn0016700</orphan:db_xref>
  <orphan:db_xref>GI:23171868</orphan:db_xref>
  <orphan:protein_id rdf:resource="&orphan;AAN13857.1"/>
  <orphan:translation>MSSVNPEYDYLFKLLLIGDSGVGKSCLLLRFADDTYTESYISTIGVDFKIRTIELDGKTIKLQIWDTAGQERFRTITSSYYRGAHGIIVVYDCTDQESFNNVKQWLEEIERYACENVNKLLVGNKSDLTTKKVVDHTTAAVRILLV</orphan:translation>
  <sox:has_location rdf:resource="&orphan;orphan_:featureloc::AAN13857.1::contig:AE003734.2:55787:51703::816::2405::-1"/>
  <sox:has_residues>MSSVNPEYDYLFKLLLIGDSGVGKSCLLLRFADDTYTESYISTIGVDFKIRTIELDGKTIKLQIWDTAGQERFRTITSSYYRGAHGIIVVYDCTDQESFNNVKQWLEEIERYACENVNKLLVGNKSDLTTKKVVDHTTAAVRILLV</sox:has_residues>
  <rdfs:label xml:lang="en">Rab1-CDS-2</rdfs:label>
</SO:SO_0000104>

<SO:SO_0000104 rdf:about="&orphan;AAF55873.1"
    SO:SO_0000704="Rab1"
    orphan:codon_start="1"
    orphan:locus_tag="CG3320"
    orphan:note="Rab1 gene product from transcript CG3320-RA"
    orphan:product="CG3320-PA"
    sox:has_seqlen="205">
  <orphan:db_xref>FLYBASE:FBgn0016700</orphan:db_xref>
  <orphan:db_xref>GI:7300727</orphan:db_xref>
  <orphan:protein_id rdf:resource="&orphan;AAF55873.1"/>
  <orphan:translation>MSSVNPEYDYLFKLLLIGDSGVGKSCLLLRFADDTYTESYISTIGVDFKIRTIELDGKTIKLQIWDTAGQERFRTITSSYYRGAHGIIVVYDCTDQESFNNVKQWLEEIERYACENVNKLLVGNKSDLTTKKVVDHTTAAEYAAQLGIPFLETSAKSATNVEQAFMTMAAEIKNRVGPPSSATDNASKVKIDQGRPVENTKSGCC</orphan:translation>
  <sox:has_location rdf:resource="&orphan;orphan_:featureloc::AAF55873.1::contig:AE003734.2:55787:51703::816::2662::-1"/>
  <sox:has_residues>MSSVNPEYDYLFKLLLIGDSGVGKSCLLLRFADDTYTESYISTIGVDFKIRTIELDGKTIKLQIWDTAGQERFRTITSSYYRGAHGIIVVYDCTDQESFNNVKQWLEEIERYACENVNKLLVGNKSDLTTKKVVDHTTAAEYAAQLGIPFLETSAKSATNVEQAFMTMAAEIKNRVGPPSSATDNASKVKIDQGRPVENTKSGCC</sox:has_residues>
  <rdfs:label xml:lang="en">Rab1-CDS-1</rdfs:label>
</SO:SO_0000104>

<SO:SO_0000234 rdf:about="&mRNA;mRNA_EMBL/GenBank/SwissProt:AE003734:52204:55287"
    SO:SO_0000704="Rab1"
    orphan:db_xref="FLYBASE:FBgn0016700"
    orphan:locus_tag="CG3320"
    orphan:product="CG3320-RB">
  <sox:has_location rdf:resource="&orphan;orphan_:featureloc::mRNA:EMBL/GenBank/SwissProt:AE003734:52204:55287::contig:AE003734.2:55787:51703::500::3584::-1"/>
  <rdfs:label xml:lang="en">Rab1-mRNA-2</rdfs:label>
</SO:SO_0000234>

<SO:SO_0000704 rdf:about="&gene;gene_EMBL/GenBank/SwissProt:AE003734:52204:55287"
    SO:SO_0000704="Rab1"
    orphan:db_xref="FLYBASE:FBgn0016700"
    orphan:locus_tag="CG3320"
    orphan:map="93D2-93D2"
    orphan:note="last curated on Mon Apr 01 10:37:17 PST 2002">

example14_ontol_bridge_from_gosql

Extracted from module : ontol_bridge_from_gosql



  :- use_module(bio(ontol_db)).
  :- use_module(bio(ontol_bridge_from_gosql)).
  :- ontol_bridge_from_gosql:set_bridge_resource(go).

  % fetch classes from an instance of a GO MySQL DB
  demo:-
    class(ID,'transcription factor activity'),
    format('Class: ~w (TF activity)~n',[ID]),
    forall(synonym(ID,Type,Syn),
           format(' Synonym: [~w] Type: ~w~n',[Syn,Type])),
    forall(subclass(ID,PID),
           (  class(PID,N),
              format(' Superclass: [~w] ~w~n',[PID,N]))).
  

Output:

Class: GO:0003700 (TF activity)
 Synonym: [GO:0000130] Type: alt_id
 Superclass: [GO:0003677] DNA binding
 Superclass: [GO:0030528] transcription regulator activity

example15_ontol_bridge_from_owl

Extracted from module : ontol_bridge_from_owl



  :- use_module(bio(io),[load_biofile/2]).
  :- use_module(bio(ontol_db)).
  :- use_module(bio(ontol_bridge_from_owl)).
  
  % access biopax OWL model using ontol_db predicates
  demo:-
    load_biofile(owl,'biopax-level1.owl'),
    class(ID,rna),
    format('In biopax, rna is a subclass of the following:~n',[]),
    forall(subclass(ID,PID),
           showclass(PID)).

  showclass(ID):-
    class(ID,N),
    format('Class ID:~w~nClass name:~w~n',[ID,N]).
  

Output:

In biopax, rna is a subclass of the following:
Class ID:http://www.biopax.org/release/biopax-level1.owl#physicalEntity
Class name:physicalEntity
Class ID:http://www.biopax.org/release/biopax-level1.owl#entity
Class name:entity

example16_ontol_db

Extracted from module : ontol_db



  :- use_module(bio(ontol_db)).
  :- use_module(bio(io)).

  % find all superclasses of a particular class
  demo:-
    load_bioresource(go),
    class(ID,'transcription factor activity'),
    setof(ParentID,subclassRT(ID,ParentID),ParentIDs),
    writeln(parents=ParentIDs).    
  

Output:

parents=[GO:0003674, GO:0003676, GO:0003677, GO:0003700, GO:0005488, GO:0030528]

example17_parser_nhx

Extracted from module : parser_nhx



  :- use_module(bio(io)).
  :- use_module(bio(phylo_db)).

  % show height of all trees in file
  demo:-
    load_biofile(nhx,'test.nhx'),
    forall(phylotree(Node),
           (   phylonode_height(Node,Height),
               format('tree ~w has height ~w~n',[Node,Height]))).
  

Output:

tree node1 has height 0.15

example18_parser_obo

Extracted from module : parser_obo



  :- use_module(bio(io)).

  demo:-
    load_biofile(obo_native,'test.obo'),
    write_biofile(owl,'test.owl'),
    writeln('Showing first 100 lines of exported OWL file:'),
    shell('head -100 test.owl').
  

Output:

Showing first 100 lines of exported OWL file:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE rdf:RDF [
    <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
]>

<rdf:RDF
    xmlns:rdf="&rdf;"
>
<owl:Class rdf:about="&GO;GO_0050306">
  <rdfs:comment xml:lang="en">sucrose 1F-fructosyltransferase activity</rdfs:comment>
  <rdfs:label xml:lang="en">sucrose 1F-fructosyltransferase activity</rdfs:label>
  <rdfs:subClassOf rdf:resource="&GO;GO_0050738"/>
</owl:Class>

<owl:Class rdf:about="&GO;GO_0050524">
  <rdfs:comment xml:lang="en">coenzyme-B sulfoethylthiotransferase activity</rdfs:comment>
  <rdfs:label xml:lang="en">coenzyme-B sulfoethylthiotransferase activity</rdfs:label>
  <rdfs:subClassOf rdf:resource="&GO;GO_0050497"/>
</owl:Class>

<owl:Class rdf:about="&GO;GO_0050543">
  <rdfs:comment xml:lang="en">icosatetraenoic acid binding</rdfs:comment>
  <rdfs:label xml:lang="en">icosatetraenoic acid binding</rdfs:label>
  <rdfs:subClassOf rdf:resource="&GO;GO_0050542"/>
</owl:Class>

<owl:Class rdf:about="&GO;GO_0050544">
  <rdfs:comment xml:lang="en">arachidonic acid binding</rdfs:comment>
  <rdfs:label xml:lang="en">arachidonic acid binding</rdfs:label>
  <rdfs:subClassOf rdf:resource="&GO;GO_0050543"/>
</owl:Class>

<owl:Class rdf:about="&GO;GO_0050599">
  <rdfs:comment xml:lang="en">deacetoxycephalosporin-C synthase activity</rdfs:comment>
  <rdfs:label xml:lang="en">deacetoxycephalosporin-C synthase activity</rdfs:label>
  <rdfs:subClassOf rdf:resource="&GO;GO_0050498"/>
</owl:Class>

<owl:Class rdf:about="&GO;GO_0050609">
  <rdfs:comment xml:lang="en">phosphonate dehydrogenase activity</rdfs:comment>
  <rdfs:label xml:lang="en">phosphonate dehydrogenase activity</rdfs:label>
  <rdfs:subClassOf rdf:resource="&GO;GO_0050499"/>
</owl:Class>

<owl:Class rdf:about="&GO;GO_0050611">
  <rdfs:comment xml:lang="en">arsenate reductase (azurin) activity</rdfs:comment>
  <rdfs:label xml:lang="en">arsenate reductase (azurin) activity</rdfs:label>
  <rdfs:subClassOf rdf:resource="&GO;GO_0050522"/>
</owl:Class>

<owl:Class rdf:about="&GO;GO_0050646">
  <rdfs:comment xml:lang="en">5-oxo-6E,8Z,11Z,14Z-icosatetraenoic acid binding</rdfs:comment>
  <rdfs:label xml:lang="en">5-oxo-6E,8Z,11Z,14Z-icosatetraenoic acid binding</rdfs:label>
  <rdfs:subClassOf rdf:resource="&GO;GO_0050543"/>
</owl:Class>

<owl:Class rdf:about="&GO;GO_0050647">
  <rdfs:comment xml:lang="en">5-hydroxy-6E,8Z,11Z,14Z-icosatetraenoic acid binding</rdfs:comment>
  <rdfs:label xml:lang="en">5-hydroxy-6E,8Z,11Z,14Z-icosatetraenoic acid binding</rdfs:label>
  <rdfs:subClassOf rdf:resource="&GO;GO_0050543"/>
</owl:Class>

<owl:Class rdf:about="&GO;GO_0050648">
  <rdfs:comment xml:lang="en">5(S)-hydroxyperoxy-6E,8Z,11Z,14Z-icosatetraenoic acid binding</rdfs:comment>
  <rdfs:label xml:lang="en">5(S)-hydroxyperoxy-6E,8Z,11Z,14Z-icosatetraenoic acid binding</rdfs:label>
  <rdfs:subClassOf rdf:resource="&GO;GO_0050543"/>
</owl:Class>

<owl:Class rdf:about="&GO;GO_0050650">
  <rdfs:comment xml:lang="en">chondroitin sulfate proteoglycan biosynthesis</rdfs:comment>
  <rdfs:label xml:lang="en">chondroitin sulfate proteoglycan biosynthesis</rdfs:label>
  <rdfs:subClassOf rdf:resource="&GO;GO_0050654"/>
</owl:Class>

<owl:Class rdf:about="&GO;GO_0050651">
  <rdfs:subClassOf rdf:resource="&GO;GO_0050650"/>
  <rdfs:subClassOf rdf:resource="&GO;GO_0050655"/>
  <rdfs:comment xml:lang="en">dermatan sulfate proteoglycan biosynthesis</rdfs:comment>
  <rdfs:label xml:lang="en">dermatan sulfate proteoglycan biosynthesis</rdfs:label>
</owl:Class>

<owl:Class rdf:about="&GO;GO_0050655">
  <rdfs:comment xml:lang="en">dermatan sulfate proteoglycan metabolism</rdfs:comment>
  <rdfs:label xml:lang="en">dermatan sulfate proteoglycan metabolism</rdfs:label>
  <rdfs:subClassOf rdf:resource="&GO;GO_0050654"/>
</owl:Class>

<owl:Class rdf:about="&GO;GO_0050658">
  <rdfs:comment xml:lang="en">RNA transport</rdfs:comment>
  <rdfs:label xml:lang="en">RNA transport</rdfs:label>
  <rdfs:subClassOf rdf:resource="&GO;GO_0050657"/>
</owl:Class>

<owl:Class rdf:about="&GO;GO_0050660">
  <rdfs:comment xml:lang="en">FAD binding</rdfs:comment>
  <rdfs:label xml:lang="en">FAD binding</rdfs:label>
  <rdfs:subClassOf rdf:resource="&GO;GO_0050662"/>
</owl:Class>

<owl:Class rdf:about="&GO;GO_0050661">

example19_phylo_db

Extracted from module : phylo_db



  :- use_module(bio(io)).
  :- use_module(bio(phylo_db)).

  % show height of all trees in file
  demo:-
    load_biofile(nhx,'test.nhx'),
    forall(phylotree(Node),
           (   phylonode_height(Node,Height),
               format('tree ~w has height ~w~n',[Node,Height]))).
  

Output:

tree node1 has height 0.15

example20_rdb_util

Extracted from module : rdb_util



  :- use_module(bio(rdb_util)).
  rdb_util:qmap(term_assoc(ID,Sym),
     sql(cols=['term.acc'=ID,
               'gene_product.symbol'=Sym],
         from=['term INNER JOIN association ON (term.id=term_id) INNER JOIN gene_product ON (gene_product.id=gene_product_id)'])).

  demo:-
    rdb_connect(Dbh,go),
    GeneSym=dpp,
    forall(rdb_lookup(Dbh,term_assoc(ID,GeneSym)),
           format('Gene: ~w annotated_to: ~w~n',[GeneSym,ID])).
  

Output:

Gene: dpp annotated_to: GO:0005615
Gene: dpp annotated_to: GO:0005622
Gene: dpp annotated_to: GO:0007442
Gene: dpp annotated_to: GO:0007444
Gene: dpp annotated_to: GO:0007474
Gene: dpp annotated_to: GO:0007476
Gene: dpp annotated_to: GO:0008586
Gene: dpp annotated_to: GO:0030718
Gene: dpp annotated_to: GO:0035158
Gene: dpp annotated_to: GO:0035263
Gene: dpp annotated_to: GO:0042078
Gene: dpp annotated_to: GO:0046843
Gene: dpp annotated_to: GO:0005160
Gene: dpp annotated_to: GO:0007179
Gene: dpp annotated_to: GO:0001708
Gene: dpp annotated_to: GO:0001715
Gene: dpp annotated_to: GO:0002168
Gene: dpp annotated_to: GO:0005160
Gene: dpp annotated_to: GO:0005576
Gene: dpp annotated_to: GO:0007179
Gene: dpp annotated_to: GO:0007352
Gene: dpp annotated_to: GO:0007378
Gene: dpp annotated_to: GO:0007391
Gene: dpp annotated_to: GO:0007393
Gene: dpp annotated_to: GO:0007424
Gene: dpp annotated_to: GO:0007444
Gene: dpp annotated_to: GO:0007447
Gene: dpp annotated_to: GO:0007448
Gene: dpp annotated_to: GO:0007479
Gene: dpp annotated_to: GO:0009795
Gene: dpp annotated_to: GO:0009950
Gene: dpp annotated_to: GO:0016015
Gene: dpp annotated_to: GO:0019827
Gene: dpp annotated_to: GO:0030509
Gene: dpp annotated_to: GO:0042127
Gene: dpp annotated_to: GO:0045476
Gene: dpp annotated_to: GO:0001708
Gene: dpp annotated_to: GO:0001709
Gene: dpp annotated_to: GO:0001745
Gene: dpp annotated_to: GO:0004871
Gene: dpp annotated_to: GO:0007354
Gene: dpp annotated_to: GO:0007391
Gene: dpp annotated_to: GO:0007398
Gene: dpp annotated_to: GO:0007423
Gene: dpp annotated_to: GO:0007424
Gene: dpp annotated_to: GO:0007425
Gene: dpp annotated_to: GO:0007427
Gene: dpp annotated_to: GO:0007440
Gene: dpp annotated_to: GO:0007442
Gene: dpp annotated_to: GO:0007444
Gene: dpp annotated_to: GO:0007446
Gene: dpp annotated_to: GO:0007447
Gene: dpp annotated_to: GO:0007450
Gene: dpp annotated_to: GO:0007458
Gene: dpp annotated_to: GO:0007473
Gene: dpp annotated_to: GO:0007474
Gene: dpp annotated_to: GO:0007476
Gene: dpp annotated_to: GO:0007479
Gene: dpp annotated_to: GO:0007507
Gene: dpp annotated_to: GO:0008285
Gene: dpp annotated_to: GO:0009948
Gene: dpp annotated_to: GO:0009950
Gene: dpp annotated_to: GO:0009993
Gene: dpp annotated_to: GO:0016015
Gene: dpp annotated_to: GO:0017145
Gene: dpp annotated_to: GO:0030509
Gene: dpp annotated_to: GO:0030707
Gene: dpp annotated_to: GO:0035147
Gene: dpp annotated_to: GO:0035215
Gene: dpp annotated_to: GO:0042078
Gene: dpp annotated_to: GO:0045705
Gene: dpp annotated_to: GO:0046620
Gene: dpp annotated_to: GO:0046845
Gene: dpp annotated_to: GO:0048066
Gene: dpp annotated_to: GO:0048100

example21_sb_bridge_from_biopax

Extracted from module : sb_bridge_from_biopax



  :- use_module(bio(sb_db),[reaction/2,entity_class/2,reaction_link/3]).
  :- use_module(bio(io),[load_biofile/2]).
  :- use_module(bio(graph),[closure_dist/4]).
  
  % load OWL class and instance data and access via sb_db views
  demo:-
    load_biofile(owl,'biopax-level1.owl'),
    load_biofile(owl,'biopax-example-ecocyc-glycolysis.owl'),
    ensure_loaded(bio(sb_bridge_from_biopax)),
    reaction(ID,'6PFRUCTPHOS-RXN'),
    show_reaction(ID).

  show_reaction(ID):-
    reaction(ID,N),
    format('Reaction: ~w [~w]~n',[ID,N]),
    forall(entity_class(ID,CID),
           format('  Annotation: ~w~n',[CID])),
    forall(closure_dist(sb_db:reaction_link,D,ID,ID2),
           (   reaction(ID2,N2),
               format('  Distance ~w from ~w [~w]~n',[D,ID2,N2]))).
  

Output:

Reaction: http://www.biopax.org/examples/glycolysis#biochemicalReaction13 [6PFRUCTPHOS-RXN]
  Annotation: EC:2.7.1.11
  Distance 0 from http://www.biopax.org/examples/glycolysis#biochemicalReaction13 [6PFRUCTPHOS-RXN]
  Distance 1 from http://www.biopax.org/examples/glycolysis#biochemicalReaction295 [F16ALDOLASE-RXN]
  Distance 2 from http://www.biopax.org/examples/glycolysis#biochemicalReaction172 [glyceraldehyde 3-phosphate oxidation]
  Distance 2 from http://www.biopax.org/examples/glycolysis#biochemicalReaction297 [triose phosphate isomerization]

example22_sb_db

Extracted from module : sb_db



  :- use_module(bio(sb_db)).
  :- use_module(bio(ontol_db)).
  :- use_module(bio(io)).
  
  summarize_species(SID):-
    species(SID,Name,Comp),
    format('Species: ~w ~w in:~w~n',[SID,Name,Comp]).
  
  demo:-
    load_biofile(sbml,'BIOMD0000000018.xml'),
    load_bioresource(chebi),    % EBI Chemical otnology
    
    forall( (class(CID1,'amino acids'),
             parentRT(CID,CID1),
             species_class(SID,CID)),
           summarize_species(SID)).
  
  

Output:

Species: glutamine  in:cell
Species: glutamine  in:cell
Species: serine  in:cell
Species: glycine  in:cell
Species: serine  in:cell

example23_sb_db

Extracted from module : sb_db



  :- use_module(bio(sb_db)).
  :- use_module(bio(io)).

  % find reactions spanning distinct compartments
  reactions_spanning_compartments(R1,C1,R2,C2):-
    species(S1,_,C1),
    reaction_reactant(R1,S1),
    reaction_link(R1,R2),
    reaction_product(R2,S2),
    species(S2,_,C2),
    C1 \= C2.
  
  demo:-
    load_biofile(sbml,'BIOMD0000000018.xml'),
    forall(reactions_spanning_compartments(R1,C1,R2,C2),
           format('Reaction ~w in ~w and ~w in ~w~n',[R1,C1,R2,C2])).
  

Output:

Reaction RFC in ext and MTX1on in cell
Reaction RFC in ext and FPGS12 in cell

example24_seqfeature_db

Extracted from module : seqfeature_db



  :- use_module(bio(seqfeature_db)).
  :- use_module(bio(io)).

  % find all exons
  demo:-
    load_biofile(chaos,'Rab1.chaos-xml'),
    forall((   feature(ID,_,exon),
               featureloc(ID,Src,Beg,End,Strand)),
            format('Exon on ~w:~w..~w[~w]~n',
                   [Src,Beg,End,Strand])).
  
  

Output:

Exon on contig:AE003734.2:55787:51703:500..839[-1]
Exon on contig:AE003734.2:55787:51703:1869..1990[-1]
Exon on contig:AE003734.2:55787:51703:2052..2100[-1]
Exon on contig:AE003734.2:55787:51703:2156..2384[-1]
Exon on contig:AE003734.2:55787:51703:2156..3584[-1]
Exon on contig:AE003734.2:55787:51703:2464..3584[-1]

example25_seqfeature_db

Extracted from module : seqfeature_db



  % demonstrate use of seqfeature module in conjunction with
  % an ontology of sequence feature classes
  :- use_module(bio(seqfeature_db)).
  :- use_module(bio(io)).
  :- use_module(bio(ontol_db),[class/2,subclassRT/2]).
  :- use_module(bio(bioseq),[revcomp/2]).

  % reverse complement a transcript sequence
  % if ID is not-ground, then will unify with some transcript ID
  % in the database
  revcomp_transcript(ID,Name,RevSeq):-
    feature_by_typename(transcript,ID,_),
    feature(ID,Name,_),
    feature_residues(ID,DnaSeq),
    revcomp(DnaSeq,RevSeq).

  demo:-
    load_biofile(chaos,'Rab1.chaos-xml'),
    load_bioresource(so),         % load sequence ontology
    forall(revcomp_transcript(ID,Name,Seq),
           format('transcript ~w ~w revcomp(dnaseq) = ~w~n',[ID,Name,Seq])).
  

Output:


example26_seqfeature_xmlmap_chaos

Extracted from module : seqfeature_xmlmap_chaos



  :- use_module(bio(io)).
  :- use_module(bio(seqfeature_db)).
  :- use_module(bio(seqfeature_bridge_from_chaos)).

  demo:-
    load_biofile(chaos,'Rab1.chaos-xml'),
    setof(ID-Name,gene(ID,Name),GeneIDNames),
    writeln(genes=GeneIDNames).
  

Output:

genes=[gene:EMBL/GenBank/SwissProt:AE003734:52204:55287-Rab1]

example27_seqfeature_xmlmap_game

Extracted from module : seqfeature_xmlmap_game



  :- use_module(bio(io)).
  :- use_module(bio(seqfeature_db)).
  :- use_module(bio(seqfeature_bridge_from_game)).

  demo:-
    load_biofile(game,'Rab1.game-xml'),
    setof(ID-Name,gene(ID,Name),GeneIDNames),
    writeln(genes=GeneIDNames).
  

Output:


example28_tabling

Extracted from module : tabling



  :- use_module(bio(tabling)).

  fib(X,V):-
        (   X<2
        ->  V=X
        ;   Xm1 is X-1,
            Xm2 is X-2,
            fib(Xm1,V1),
            fib(Xm2,V2),
            V is V1+V2).

  demo:-
    table_pred(fib/2),
    X=30,
    fib(X,V),
    format('fib(~w)=~w~n',[X,V]).
  
  

Output:

fib(30)=832040

example29_taxon_bridge_to_ontol

Extracted from module : taxon_bridge_to_ontol



  :- use_module(bio(io)).
  :- use_module(bio(taxon_bridge_to_ontol)).
  :- use_module(bio(taxon_db)).
  :- use_module(bio(ontol_db)).

  show_class(ID):-
    class(ID,Name),
    format(' [~w] ~w~n',[ID,Name]).
  
  demo:-
    load_bioresource(taxnames),
    load_bioresource(taxnodes),
    class(ID,'Drosophila melanogaster'),
    format('Lineage of fruitfly is:~n'),
    forall(subclassT(ID,ParentID),
           show_class(ParentID)).
  

Output:

Lineage of fruitfly is:
 [NCBITaxon:32351] melanogaster subgroup
 [NCBITaxon:32346] melanogaster group
 [NCBITaxon:32341] Sophophora
 [NCBITaxon:7215] Drosophila
 [NCBITaxon:186285] Drosophiliti
 [NCBITaxon:46879] Drosophilina
 [NCBITaxon:46877] Drosophilini
 [NCBITaxon:43845] Drosophilinae
 [NCBITaxon:7214] Drosophilidae
 [NCBITaxon:43746] Ephydroidea
 [NCBITaxon:43741] Acalyptratae
 [NCBITaxon:43738] Schizophora
 [NCBITaxon:43733] Muscomorpha
 [NCBITaxon:7203] Brachycera
 [NCBITaxon:7147] Diptera
 [NCBITaxon:33392] Endopterygota
 [NCBITaxon:33340] Neoptera
 [NCBITaxon:7496] Pterygota
 [NCBITaxon:85512] Dicondylia
 [NCBITaxon:50557] Insecta
 [NCBITaxon:6960] Hexapoda
 [NCBITaxon:197562] Pancrustacea
 [NCBITaxon:197563] Mandibulata
 [NCBITaxon:6656] Arthropoda
 [NCBITaxon:88770] Panarthropoda
 [NCBITaxon:33317] Protostomia
 [NCBITaxon:33316] Coelomata
 [NCBITaxon:33213] Bilateria
 [NCBITaxon:6072] Eumetazoa
 [NCBITaxon:33208] Metazoa
 [NCBITaxon:33154] Fungi/Metazoa group
 [NCBITaxon:2759] Eukaryota
 [NCBITaxon:131567] cellular organisms
 [NCBITaxon:1] root

example30_taxon_db

Extracted from module : taxon_db



  :- use_module(bio(taxon_db)).
  :- use_module(bio(io)).

  demo:-
    load_bioresource(taxnames),
    load_bioresource(taxnodes),
    taxname(ID1,'Drosophila melanogaster'),
    taxname(ID2,'Homo sapiens'),
    nearest_common_ancestor(ID1,ID2,PID),
    taxname(PID,N),
    format('least common ancestor node of fly and human is ~w~n',[N]).
  

Output:

least common ancestor node of fly and human is Coelomata

example31_xml_transform

Extracted from module : xml_transform



  % purpose: convert an xml file with 'person' elements
  % and nested 'address' elements to a flat term list
  :- use_module(bio(xml_transform)).
  :- use_module(library(sgml)).

  % define the mapping in the 'user' module
  user:xmlpred(personset,_,[],translate(person)).
  user:xmlpred(person,_,person(ID,Name),
               [let(ID=ssid),
                let(Name=fullname),
                prolog(M=in_person(ID)),
                translate(address,M)]).
  user:xmlpred(address,in_person(PID),person_address(PID,Street,City),
               [let(Street=street),
                let(City=city)]).

  % convert XML to prolog facts and write them out
  demo:-
    File='personset.xml',
    load_structure(File,Els,[dialect(xml),space(remove)]),
    apply_xmlpred(user,Els,Preds),
    forall(member(Pred,Preds),
           writeln(Pred)).
  

Output:

person(1, Sherlock Holmes)
person_address(1, 221B Baker Street, London)
person(2, mr tickle)
person_address(2, 1010B tickle street, New York)

example32_xml_writer

Extracted from module : xml_writer



  :- use_module(bio(xml_writer)).

  demo:-
     doc_start(X),
     event_start(X,X2,note,[id=1]),
     event(X2,hello),
     event_end(X2,X).
  

Output:

<?xml version="1.0"?>

<note id="1">hello</note>