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