Writing A Simple Application

Contents


The first EMBOSS application was called seqret and got its name from the amount of hidden library code involved in its complexity. The program simply reads in a sequence, and writes it out again.

The AJAX Command Definition and the commandline syntax provide the additional power that allows seqret to read and write any sequence format that EMBOSS supports, using the full power of the Uniform Sequence Address to control sequence locations and formats.

Source Code seqret.c

The ACD file (see below) controls the user interface. All the application needs to do is:

Of course, a more complicated application could actually do something before writing out the sequence.

#include "emboss.h"

int main (int argc, char * argv[]) {

  AjPSeq seq;
  AjPSeqout seqout;

  embInit ("seqret", argc, argv);

  seq = ajAcdGetSeq ("sequence");
  seqout = ajAcdGetSeqout ("outseq");

  ajSeqWrite (seqout, seq);
  ajSeqWriteClose (seqout);

  ajExit ();

}

ACD File seqret.acd

The AJAX Command Definition file specifies an input sequence, called "sequence", and an output sequence, called "outseq".

Both can be specified as parameters (writing "required: Y" instead of "param: 1" would make them only qualifiers), but can also use their names as qualifiers.

The same names are to be used by the application to retrieve the sequence object and the output sequence location.

appl: seqret
  sequence: sequence [ param: 1 ]
  outseq: seqout [ param: 2 ]

Running seqret

The full range of sequence command line options are available to seqret. As new sequence input or output formats are added to AJAX, seqret is automatically able to use them. No application code needs to change.

In this example, a FASTA format sequence file is written to standard output in GCG format.

% seqret fasta::paamir.tfa  -osformat gcg -filter
!!NA_SEQUENCE 1.0

Pseudomonas aeruginosa amiC and amiR genes 2/97

PAAMIR  Length: 2167  Type: N  Check: 3726 ..

    1  GGTACCGCTG GCCGAGCATC TGCTCGATCA CCACCAGCCG GGCGACGGGA

   51  ACTGCACGAT CTACCTGGCG AGCCTGGAGC ACGAGCGGGT TCGCTTCGTA

.............. lines omitted ................

  951  CATGGTTTCT TCCCGGAGAA CGCGACCATC ACCGCCTGGG CCGAGGCGGC