Hitmap 1.3
 All Data Structures Namespaces Files Functions Variables Typedefs Friends Macros Groups Pages
SWcommon_ref.c
Go to the documentation of this file.
1 
9 /*
10  * <license>
11  *
12  * Hitmap v1.2
13  *
14  * This software is provided to enhance knowledge and encourage progress in the scientific
15  * community. It should be used only for research and educational purposes. Any reproduction
16  * or use for commercial purpose, public redistribution, in source or binary forms, with or
17  * without modifications, is NOT ALLOWED without the previous authorization of the copyright
18  * holder. The origin of this software must not be misrepresented; you must not claim that you
19  * wrote the original software. If you use this software for any purpose (e.g. publication),
20  * a reference to the software package and the authors must be included.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND ANY
23  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
25  * THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * Copyright (c) 2007-2015, Trasgo Group, Universidad de Valladolid.
33  * All rights reserved.
34  *
35  * More information on http://trasgo.infor.uva.es/
36  *
37  * </license>
38 */
39 
40 // Headers
41 #include "SWcommon.h"
42 #include "SWcommon_ref.h"
43 
44 
45 
46 void readProtein(ProteinFile * fprotein, aa_t * protein, int psize){
47 
48 
49  protein[0] = GAP_AA;
50 
51  int i = 1;
52  char ch;
53  while(i<=psize){
54 
55  int res = fscanf(fprotein->file,"%c",&ch);
56 
57  if(res == EOF){
58  fprotein->rewind++;
59  rewind(fprotein->file);
60  continue;
61  }
62 
63  aa_t aa = char2AA(ch);
64  if( aa != NOTFOUND_AA ){
65  protein[i++] = aa;
66  }
67 
68  }
69 
70 }
71 
72 
73 void printProtein(aa_t * p, int psize){
74 
75  // Print
76  int i;
77  for(i=1; i<psize+1; i++){
78  printf("%c",AA2char(p[i]));
79  }
80  printf("\n");
81 
82 
83 }
84 
88 void printProteinMatch(aa_t * p, int psize, int begin, int end){
89 
90  // Print
91  int i;
92  for(i=1; i<psize+1; i++){
93 
94  if(i>begin && i<end+1)
95  printf("%c", (char) toupper(AA2char(p[i])));
96  else
97  printf("%c",AA2char(p[i]));
98  }
99  printf("\n");
100 }
101 
102 
103 
104 
105 
106 double currentTime(){
107  struct timeval tim;
108  gettimeofday(&tim, NULL);
109  return (double) tim.tv_sec + ((double)tim.tv_usec / (1000*1000) );
110 };
111 
void printProteinMatch(HitTile_aa_t p, int begin, int end)
Definition: SWcommon_hit.c:90
void readProtein(ProteinFile *fprotein, HitTile_aa_t *protein, int psize)
Definition: SWcommon_hit.c:48
int rewind
Definition: SWcommon.h:205
void printProtein(HitTile_aa_t p, int offset, int psize)
Definition: SWcommon_hit.c:78
short aa_t
Definition: SWcommon.h:59
#define GAP_AA
Definition: SWcommon.h:243
double currentTime()
Definition: SWcommon_ref.c:106
#define NOTFOUND_AA
Definition: SWcommon.h:239
FILE * file
Definition: SWcommon.h:204