0
|
1 /******************************************************************************
|
|
2 ** @source gdnawalk
|
|
3 **
|
|
4 ** Draws DNA Walk map of the genome
|
|
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 gdnawalk *************************************************************
|
|
40 **
|
|
41 ** Draws DNA Walk map of the genome
|
|
42 **
|
|
43 ******************************************************************************/
|
|
44
|
|
45 int main(int argc, char *argv[])
|
|
46 {
|
|
47 embInitPV("gdnawalk", argc, argv, "GEMBASSY", "1.0.3");
|
|
48
|
|
49 struct soap soap;
|
|
50 struct ns1__dnawalkInputParams params;
|
|
51
|
|
52 AjPSeqall seqall;
|
|
53 AjPSeq seq;
|
|
54 AjPStr inseq = NULL;
|
|
55 AjPStr seqid = NULL;
|
|
56 AjPFile outf = NULL;
|
|
57 AjPStr filename = NULL;
|
|
58 AjPStr outfname = NULL;
|
|
59 AjPStr format = NULL;
|
|
60
|
|
61 ajint i;
|
|
62
|
|
63 char *in0;
|
|
64 char *result;
|
|
65
|
|
66 seqall = ajAcdGetSeqall("sequence");
|
|
67 filename = ajAcdGetString("goutfile");
|
|
68 format = ajAcdGetString("format");
|
|
69
|
|
70 params.gmap = 0;
|
|
71
|
|
72 i = 0;
|
|
73
|
|
74 while(ajSeqallNext(seqall, &seq))
|
|
75 {
|
|
76 soap_init(&soap);
|
|
77
|
|
78 soap.send_timeout = 0;
|
|
79 soap.recv_timeout = 0;
|
|
80
|
|
81 inseq = NULL;
|
|
82
|
|
83 ajStrAppendC(&inseq, ">");
|
|
84 ajStrAppendS(&inseq, ajSeqGetAccS(seq));
|
|
85 ajStrAppendC(&inseq, "\n");
|
|
86 ajStrAppendS(&inseq, ajSeqGetSeqS(seq));
|
|
87
|
|
88 ajStrAssignS(&seqid, ajSeqGetAccS(seq));
|
|
89
|
|
90 in0 = ajCharNewS(inseq);
|
|
91
|
|
92 if(soap_call_ns1__dnawalk(
|
|
93 &soap,
|
|
94 NULL,
|
|
95 NULL,
|
|
96 in0,
|
|
97 ¶ms,
|
|
98 &result
|
|
99 ) == SOAP_OK)
|
|
100 {
|
|
101 ++i;
|
|
102
|
|
103 outfname = ajStrNewS(ajFmtStr("%S.%d.%S",
|
|
104 filename,
|
|
105 i,
|
|
106 format));
|
|
107
|
|
108 outf = ajFileNewOutNameS(outfname);
|
|
109
|
|
110 if(!outf)
|
|
111 {
|
|
112 ajDie("File open error\n");
|
|
113 }
|
|
114
|
|
115 if(!ajStrMatchC(format, "png"))
|
|
116 {
|
|
117 if(!gHttpConvertC(result, &outf, ajStrNewC("png"), format))
|
|
118 {
|
|
119 ajDie("File downloading error from:\n%s\n", result);
|
|
120 }
|
|
121 else
|
|
122 {
|
|
123 ajFmtPrint("Created %S\n", outfname);
|
|
124 }
|
|
125 }
|
|
126 else
|
|
127 {
|
|
128 if(!gHttpGetBinC(result, &outf))
|
|
129 {
|
|
130 ajDie("File downloading error from:\n%s\n", result);
|
|
131 }
|
|
132 else
|
|
133 {
|
|
134 ajFmtPrint("Created %S\n", outfname);
|
|
135 }
|
|
136 }
|
|
137
|
|
138 ajStrDel(&outfname);
|
|
139 }
|
|
140 else
|
|
141 {
|
|
142 soap_print_fault(&soap, stderr);
|
|
143 }
|
|
144
|
|
145 soap_destroy(&soap);
|
|
146 soap_end(&soap);
|
|
147 soap_done(&soap);
|
|
148
|
|
149 AJFREE(in0);
|
|
150
|
|
151 ajStrDel(&seqid);
|
|
152 ajStrDel(&inseq);
|
|
153 }
|
|
154
|
|
155 ajSeqallDel(&seqall);
|
|
156 ajSeqDel(&seq);
|
|
157
|
|
158 ajStrDel(&filename);
|
|
159
|
|
160 embExit();
|
|
161
|
|
162 return 0;
|
|
163 }
|