comparison GEMBASSY-1.0.3/src/gshuffleseq.c @ 0:8300eb051bea draft

Initial upload
author ktnyt
date Fri, 26 Jun 2015 05:19:29 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:8300eb051bea
1 /******************************************************************************
2 ** @source gshuffleseq
3 **
4 ** Create randomized sequence with conserved k-mer composition
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 RESTify
11 ** @modified 2015/2/7 Refactor
12 ** @@
13 **
14 ** This program is free software; you can redistribute it and/or
15 ** modify it under the terms of the GNU General Public License
16 ** as published by the Free Software Foundation; either version 2
17 ** of the License, or (at your option) any later version.
18 **
19 ** This program is distributed in the hope that it will be useful,
20 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ** GNU General Public License for more details.
23 **
24 ** You should have received a copy of the GNU General Public License
25 ** along with this program; if not, write to the Free Software
26 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 ******************************************************************************/
28
29 #include "emboss.h"
30 #include "soapH.h"
31 #include "GLANGSoapBinding.nsmap"
32 #include "soapClient.c"
33 #include "soapC.c"
34 #include "../gsoap/stdsoap2.c"
35 #include "glibs.h"
36
37
38
39
40 /* @prog gshuffleseq **********************************************************
41 **
42 ** Create randomized sequence with conserved k-mer composition
43 **
44 ******************************************************************************/
45
46 int main(int argc, char *argv[])
47 {
48 embInitPV("gshuffleseq", argc, argv, "GEMBASSY", "1.0.3");
49
50 struct soap soap;
51 struct ns1__shuffleseqInputParams params;
52
53 AjPSeqall seqall;
54 AjPSeqout seqout;
55 AjPSeq seq;
56 AjPStr inseq = NULL;
57 ajint k = 0;
58
59 char *in0;
60 char *result;
61
62 seqall = ajAcdGetSeqall("sequence");
63 k = ajAcdGetInt("k");
64 seqout = ajAcdGetSeqout("outseq");
65
66 params.k = k;
67
68 while(ajSeqallNext(seqall, &seq))
69 {
70
71 soap_init(&soap);
72
73 inseq = NULL;
74
75 ajStrAppendS(&inseq, ajSeqGetSeqS(seq));
76
77 in0 = ajCharNewS(inseq);
78
79 if(soap_call_ns1__shuffleseq(
80 &soap,
81 NULL,
82 NULL,
83 in0,
84 &params,
85 &result
86 ) == SOAP_OK)
87 {
88 ajCharFmtUpper(result);
89 ajSeqAssignSeqC(seq, result);
90 ajSeqoutWriteSeq(seqout, seq);
91 }
92 else
93 {
94 soap_print_fault(&soap, stderr);
95 }
96
97 soap_destroy(&soap);
98 soap_end(&soap);
99 soap_done(&soap);
100
101 AJFREE(in0);
102
103 ajStrDel(&inseq);
104 }
105
106 ajSeqoutClose(seqout);
107 ajSeqoutDel(&seqout);
108 ajSeqallDel(&seqall);
109 ajSeqDel(&seq);
110
111 embExit();
112
113 return 0;
114 }