[ <Tutorial> <The blip command-line tool> <Queries using blip> <Writing applications using blip> <Examples> ]

Tutorial

First of all, this is alpha software. Please email me, the developer of Blip if you're interested in using this software and I will expand this section. What follows is a rough skeleton of documentation

The blip command-line tool

Blip comes with a command line tool to allow simple non-programmatic access to a limited subset of the functionality of the full blip package. Run with the "-h" option for full instructions. Here are some examples

show the context of the class named "lymphocyte" in the "cell" ontology resource. Requires setting up "cell" in your bioconf.pro file

unix> blip -r cell ontol-subset -n lymphocyte
class(CL:0000542, lymphocyte)
/-CL:0000000 cell
 I-CL:0000003 cell in vivo
  I-CL:0000004 cell by organism
   I-CL:0000255 eukaryotic cell
    I-CL:0000548 animal cell
     I-CL:0000080 circulating cell
      I-CL:0000081 blood cell
       I-CL:0000542 lymphocyte
  I-CL:0000012 cell by class
   I-CL:0000144 cell by function
    I-CL:0000080 circulating cell
     I-CL:0000081 blood cell
      I-CL:0000542 lymphocyte
        

Queries using blip

If you run blip without specifying a command you will be placed in prolog query mode

unix> blip -r cell
?- use_module(bio(ontol_db)).

Yes
?- class(ID,lymphocyte),subclassT(ID,ParentID),class(ParentID,ParentN).

ID = 'CL:0000542'
ParentID = 'CL:0000081'
ParentN = 'blood cell' ;

ID = 'CL:0000542'
ParentID = 'CL:0000080'
ParentN = 'circulating cell' ;

ID = 'CL:0000542'
ParentID = 'CL:0000144'
ParentN = 'cell by function' ;

ID = 'CL:0000542'
ParentID = 'CL:0000548'
ParentN = 'animal cell' ;

ID = 'CL:0000542'
ParentID = 'CL:0000012'
ParentN = 'cell by class' ;

ID = 'CL:0000542'
ParentID = 'CL:0000003'
ParentN = 'cell in vivo' ;

ID = 'CL:0000542'
ParentID = 'CL:0000000'
ParentN = cell ;

ID = 'CL:0000542'
ParentID = 'CL:0000255'
ParentN = 'eukaryotic cell' ;

ID = 'CL:0000542'
ParentID = 'CL:0000004'
ParentN = 'cell by organism' ;

ID = 'CL:0000542'
ParentID = 'CL:0000003'
ParentN = 'cell in vivo' ;

ID = 'CL:0000542'
ParentID = 'CL:0000000'
ParentN = cell ;

No
?- 
        

Writing applications using blip

Prolog

The first thing you should know about Blip is that it is written in Prolog. You will need to download and install SWI-Prolog (Blip has been tested on both stable and release versions). If you wish to use a different prolog engine, you will have to make some code modifications. Currently only SWI is supported. In future the download section will have precompiled binaries, so you will not need to install SWI-Prolog yourself.

Prolog is a declarative logic programming language, and as such is quite distinct from typical imperative languages such as Java, Perl, C, Python and Ruby. If you expect to use Blip to write application programs, don't expect to just pick up Prolog by browsing the Blip code, take the time to find a decent Prolog tutorial and learn it properly. Don't be put off if you are an inexperienced programmer - you may actually be at an advantage if your thought processes aren't already locked into the mindset of a lesser language

Prolog can be seen as a database system and programming language, but don't let that put you off if you don't like SQL. If you are intended to use blip in order to do some data mining or complex querying across different data sources, you should be able to get going by following some examples without needing to underst a lot of the subtleties of Prolog programming

Bluffers Guide to Blip

When in an interactive prolog session, you can issue queries to the prolog in-memory database. The query takes the form of a goal: a predicate followed by zero or more arguments. Arguments can be ground or free (variables). Variables are indicated by the fact that their name has a leading upper case character (this may seem a little odd at first but it is in fact extremely useful).

Examples

The following examples are absolutely trivial: check back later for some real examples!!!!!!

Starting prolog

To start SWI-Prolog, type

swipl
at the command line - you are now in an interactive prolog session. Hit ctrl-D to exit back to the unix shell at any time

Translating a DNA sequence

translate the sequence 'atg' using the default genetic code

use_module(bio(bioseq)).
translate_dna(atg,AASeq).
          
The value of
AASeq
will be unified with the translation of atg, which is methionine.

translate the sequence 'atg' using the vertebrate mitochondrial genetic code (NCBI Genetic code ID 2)

use_module(bio(bioseq)).
translate_dna('ATG',AASeq,2).
          
The value of
AASeq
will be unified with the translation of atg, which is also methionine. Note that if we choose to represent the DNA sequence in uppercase, we have to place quotes around it so that prolog does not think it is a variable

translate the sequence 'aaa' using all 24 genetic codes

use_module(bio(bioseq)).
translate_dna('AAA',AASeq,Code),gencode_organism(Code,Org).
          
This query has three free variables: the amino acid sequence and the ID and name of the genetic code. To cycle though all 24 answers, press the ; key until prolog says "yes".

Reverse complementing a DNA sequence

Reverse complements a sequence

use_module(bio(bioseq)).
revcomp(aaaaaatgcgcc,Seq).
          

Finding the least common clade between two species

Look up the IDs for two taxa by their names (scientific), then find the minimal common ancestor in the taxonomy tree

use_module(bio(taxon_db)).
use_module(bio(io)).

load_biofile(ncbitaxnode,'nodes.dmp').
load_biofile(ncbitaxname,'names.dmp').

taxname(ID1,'Drosophila melanogaster'),
taxname(ID2,'Homo sapiens'),
nearest_common_ancestor(ID1,ID2,PID),
taxname(PID,N).
          
The answer you should get is 'Coelomata'