JWS-112 Bumping version of ClustalO (src, binaries and windows) to version 1.2.4.
[jabaws.git] / binaries / src / clustalo / src / clustalo-api-test.c
index 90ae3a0..f4d2636 100644 (file)
  ********************************************************************/
 
 /*
- *  RCS $Id: clustalo-api-test.c 213 2011-03-11 16:10:15Z andreas $
+ *  RCS $Id: clustalo-api-test.c 280 2013-05-16 16:04:12Z fabian $
  */
 
 
 #include <stdio.h>
 
+/* see clustal-omega.c for documentation */
+
 /* Include clustal-omega's header. That's all you need 
  *
  * If you developing in C++, use the following instead:
@@ -44,8 +46,9 @@ main(int argc, char **argv)
     char *pcSeqInfile;
     int iAux;
 
-    /* use LOGLEVEL_QUIET to make Clustal shut up */
-    iVerbosityLevel = LOGLEVEL_INFO;
+
+    /* Must happen first: setup logger */
+    LogDefaultSetup(&rLog);
 
     SetDefaultAlnOpts(&rAlnOpts);
 
@@ -54,7 +57,7 @@ main(int argc, char **argv)
     /* Get sequence input file name from command line
      */
     if (argc!=2) {
-        Fatal("Need sequence file as argument");
+        Log(&rLog, LOG_FATAL, "Need sequence file as argument");
     }
     pcSeqInfile = argv[1];
 
@@ -64,16 +67,16 @@ main(int argc, char **argv)
     if (ReadSequences(prMSeq, pcSeqInfile,
                       SEQTYPE_UNKNOWN,
                       INT_MAX, INT_MAX)) {
-        Fatal("Reading sequence file '%s' failed", pcSeqInfile);
+        Log(&rLog, LOG_FATAL, "Reading sequence file '%s' failed", pcSeqInfile);
     }
 
     /* Dump some info about the sequences
      */
     for (iAux=0; iAux<prMSeq->nseqs; iAux++) {
-        Info(LOGLEVEL_INFO, 
+        Log(&rLog, LOG_INFO, 
              "Sequence no %d has the following name: %s",
              iAux, prMSeq->sqinfo[iAux].name);
-        Info(LOGLEVEL_INFO, 
+        Log(&rLog, LOG_INFO, 
              "Sequence no %d has the following residues: %s",
              iAux, prMSeq->seq[iAux]);
         /* more info can be found in prMSeq->sqinfo[iAux] */
@@ -82,20 +85,21 @@ main(int argc, char **argv)
 
     /* Align the sequences without a profile (NULL)
      */
-    if (Align(prMSeq, NULL, & rAlnOpts)) {
-        Fatal("A fatal error happended during the alignment process");
+    if (Align(prMSeq, NULL, &rAlnOpts)) {
+        Log(&rLog, LOG_FATAL, "A fatal error happended during the alignment process");
     }
 
 
     /* Output of final alignment to stdout (NULL) as aligned fasta/a2m
      */
-    if (WriteAlignment(prMSeq, NULL, MSAFILE_A2M)) {
-        Fatal("Could not save alignment");
+#define LINE_WRAP 60
+    if (WriteAlignment(prMSeq, NULL, MSAFILE_A2M, LINE_WRAP)) {
+        Log(&rLog, LOG_FATAL, "Could not save alignment");
     } 
 
     FreeMSeq(&prMSeq);
 
-    Info(LOGLEVEL_INFO, "Successfull program exit");
+    Log(&rLog, LOG_INFO, "Successfull program exit");
 
     return EXIT_SUCCESS;
 }