Mercurial > repos > ktnyt > gembassy
comparison GEMBASSY-1.0.3/src/gpalindrome.c @ 2:8947fca5f715 draft default tip
Uploaded
| author | ktnyt |
|---|---|
| date | Fri, 26 Jun 2015 05:21:44 -0400 |
| parents | 84a17b3fad1f |
| children |
comparison
equal
deleted
inserted
replaced
| 1:84a17b3fad1f | 2:8947fca5f715 |
|---|---|
| 1 /****************************************************************************** | |
| 2 ** @source gpalindrome | |
| 3 ** | |
| 4 ** Searches palindrome sequences | |
| 5 ** | |
| 6 ** @author Copyright (C) 2012 Hidetoshi Itaya | |
| 7 ** @version 1.0.3 | |
| 8 ** @modified 2012/1/20 Hidetoshi Itaya Created! | |
| 9 ** @modified 2013/6/16 Revision 1 | |
| 10 ** @modified 2015/2/7 Refactor | |
| 11 ** @@ | |
| 12 ** | |
| 13 ** This program is free software; you can redistribute it and/or | |
| 14 ** modify it under the terms of the GNU General Public License | |
| 15 ** as published by the Free Software Foundation; either version 2 | |
| 16 ** of the License, or (at your option) any later version. | |
| 17 ** | |
| 18 ** This program is distributed in the hope that it will be useful, | |
| 19 ** but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 21 ** GNU General Public License for more details. | |
| 22 ** | |
| 23 ** You should have received a copy of the GNU General Public License | |
| 24 ** along with this program; if not, write to the Free Software | |
| 25 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 26 ******************************************************************************/ | |
| 27 | |
| 28 #include "emboss.h" | |
| 29 #include "soapH.h" | |
| 30 #include "GLANGSoapBinding.nsmap" | |
| 31 #include "soapClient.c" | |
| 32 #include "soapC.c" | |
| 33 #include "../gsoap/stdsoap2.c" | |
| 34 #include "glibs.h" | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 /* @prog gpalindrome ********************************************************** | |
| 40 ** | |
| 41 ** Searches palindrome sequences | |
| 42 ** | |
| 43 ******************************************************************************/ | |
| 44 | |
| 45 int main(int argc, char *argv[]) | |
| 46 { | |
| 47 embInitPV("gpalindrome", argc, argv, "GEMBASSY", "1.0.3"); | |
| 48 | |
| 49 struct soap soap; | |
| 50 struct ns1__palindromeInputParams params; | |
| 51 | |
| 52 AjPSeqall seqall; | |
| 53 AjPSeq seq; | |
| 54 AjPStr inseq = NULL; | |
| 55 AjPStr seqid = NULL; | |
| 56 ajint shortest = 0; | |
| 57 ajint loop = 0; | |
| 58 AjBool gtmatch = 0; | |
| 59 | |
| 60 char *in0; | |
| 61 char *result; | |
| 62 | |
| 63 AjPFile outf = NULL; | |
| 64 | |
| 65 seqall = ajAcdGetSeqall("sequence"); | |
| 66 shortest = ajAcdGetInt("shortest"); | |
| 67 loop = ajAcdGetInt("loop"); | |
| 68 gtmatch = ajAcdGetBoolean("gtmatch"); | |
| 69 outf = ajAcdGetOutfile("outfile"); | |
| 70 | |
| 71 params.shortest = shortest; | |
| 72 params.loop = loop; | |
| 73 params.gtmatch = gtmatch; | |
| 74 params.output = "f"; | |
| 75 | |
| 76 while(ajSeqallNext(seqall, &seq)) | |
| 77 { | |
| 78 soap_init(&soap); | |
| 79 | |
| 80 inseq = NULL; | |
| 81 | |
| 82 ajStrAppendC(&inseq, ">"); | |
| 83 ajStrAppendS(&inseq, ajSeqGetNameS(seq)); | |
| 84 ajStrAppendC(&inseq, "\n"); | |
| 85 ajStrAppendS(&inseq, ajSeqGetSeqS(seq)); | |
| 86 | |
| 87 ajStrAssignS(&seqid, ajSeqGetAccS(seq)); | |
| 88 | |
| 89 in0 = ajCharNewS(inseq); | |
| 90 | |
| 91 if(soap_call_ns1__palindrome( | |
| 92 &soap, | |
| 93 NULL, | |
| 94 NULL, | |
| 95 in0, | |
| 96 ¶ms, | |
| 97 &result | |
| 98 ) == SOAP_OK) | |
| 99 { | |
| 100 ajFmtPrintF(outf, "Sequence: %S\n", seqid); | |
| 101 | |
| 102 if(!gFileOutURLC(result, &outf)) | |
| 103 { | |
| 104 ajDie("File downloading error from:\n%s\n", result); | |
| 105 embExitBad(); | |
| 106 } | |
| 107 } | |
| 108 else | |
| 109 { | |
| 110 soap_print_fault(&soap, stderr); | |
| 111 } | |
| 112 | |
| 113 soap_destroy(&soap); | |
| 114 soap_end(&soap); | |
| 115 soap_done(&soap); | |
| 116 | |
| 117 AJFREE(in0); | |
| 118 | |
| 119 ajStrDel(&inseq); | |
| 120 } | |
| 121 | |
| 122 ajFileClose(&outf); | |
| 123 | |
| 124 ajSeqallDel(&seqall); | |
| 125 ajSeqDel(&seq); | |
| 126 ajStrDel(&seqid); | |
| 127 | |
| 128 embExit(); | |
| 129 | |
| 130 return 0; | |
| 131 } |
