00001 /* Last edited: Feb 11 16:06 2002 (ac2) */ 00002 /* 00003 00004 // ####################################################################### 00005 00006 // SSAHA : Sequence Search and Alignment by Hashing Algorithm 00007 // Version 3.2, released 1st March 2004 00008 // Copyright (c) Genome Research 2002 00009 00010 // SSAHA is free software; you can redistribute it and/or modify 00011 // it under the terms of version 2 of the GNU General Public Licence 00012 // as published by the Free Software Foundation. 00013 00014 // This program is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public Licence for more details. 00018 00019 // You should have received a copy of the GNU General Public Licence 00020 // along with this program; if not, write to the Free Software 00021 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 // or see the on-line version at http://www.gnu.org/copyleft/gpl.txt 00023 00024 // ####################################################################### 00025 00026 // Module Name : SSAHAMainC 00027 // File Name : SSAHAMainC.cpp 00028 // Language : C++ 00029 // Module Author: Anthony J. Cox (ac2@sanger.ac.uk) 00030 00031 // Description: 00032 // 00033 // Main demonstrating C interface to SSAHA 00034 // 00035 // Includes: 00036 */ 00037 #include "SSAHAWrapper.h" 00038 #include <stdio.h> 00039 #include <stdlib.h> 00040 #include <string.h> 00041 00042 int main( int numArgs, char** args ) 00043 { 00044 char lineBuf[1000]; 00045 FILE* fp; 00046 SSAHAHit* pThis; 00047 SSAHAHit* pTop; 00048 int* pStart; 00049 char* pSource; 00050 00051 if (numArgs!=3) 00052 { 00053 printf 00054 ("Usage: %s queryFileName tableName\n", 00055 args[0]); 00056 exit(-1); 00057 } /* if */ 00058 00059 if ((fp=fopen(args[1],"r"))==NULL) 00060 { 00061 printf("Error: could not open query file %s", args[1]); 00062 } /* if */ 00063 00064 loadTable( args[2] ); 00065 00066 while( fgets(lineBuf, 1000, fp) ) 00067 { 00068 doSearch( lineBuf, (strlen(lineBuf)-1)/5, &pTop, &pStart ); 00069 /* the `strlen...' bit just gives max num whole words */ 00070 pThis=pTop; 00071 pSource=lineBuf; 00072 while(*pStart!=-1) 00073 { 00074 printf("%c%c%c%c%c\n", *pSource++, *pSource++, *pSource++, *pSource++, *pSource++); 00075 while (pThis!=&pTop[*pStart]) 00076 { 00077 printf("%s %d %d\n", getSubjectName( pThis->seqNum), pThis->seqNum, pThis->seqPos); 00078 pThis++; 00079 } /* while */ 00080 pStart++; 00081 } /* while */ 00082 00083 } /* while */ 00084 00085 /* printf("%s %d",lineBuf, strlen(lineBuf));*/ 00086 00087 00088 clearSearch(); 00089 clearTable(); 00090 return 0; 00091 } /* main */ 00092 00093 00094 00095 00096 /* End of file SSAHAMainC.cpp */ 00097
1.5.2