Hitmap 1.3
 All Data Structures Namespaces Files Functions Variables Typedefs Friends Macros Groups Pages
SWcommon_hit.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 // Include the header
41 #include "SWcommon_hit.h"
42 
43 
44 
48 void readProtein(ProteinFile * fprotein, HitTile_aa_t * protein, int psize){
49 
50  hit_tileElemAt(*protein,1,0) = GAP_AA;
51 
52  int i = 1;
53  char ch;
54  while(i<=psize){
55 
56  int res = fscanf(fprotein->file,"%c",&ch);
57 
58  if(res == EOF){
59  fprotein->rewind++;
60  rewind(fprotein->file);
61  continue;
62  }
63 
64  aa_t aa = char2AA(ch);
65 
66 
67  if( aa != NOTFOUND_AA ){
68  hit_tileElemAt(*protein,1,i++) = aa;
69 
70  }
71  }
72 
73 }
74 
75 
76 
77 
78 void printProtein(HitTile_aa_t p, int offset, int psize){
79 
80  // Print
81  int i;
82  for(i=1+offset; i<psize+offset+1; i++){
83  printf("%c",AA2char( hit_tileElemAt(p,1,i) ));
84  }
85  printf("\n");
86 
87 }
88 
89 
90 void printProteinMatch(HitTile_aa_t p, int begin, int end){
91 
92  // Print
93  int i;
94  for(i=1; i< hit_tileDimCard(p,0); i++){
95 
96  if(i>begin && i<end+1)
97  printf("%c", (char) toupper(AA2char(hit_tileElemAt(p,1,i))));
98  else
99  printf("%c",AA2char(hit_tileElemAt(p,1,i)));
100  }
101  printf("\n");
102 
103 
104 }
105 
106 
#define hit_tileElemAt(var, ndims,...)
Definition: hit_tile.h:519
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
#define hit_tileDimCard(var, dim)
Definition: hit_tile.h:750
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
#define NOTFOUND_AA
Definition: SWcommon.h:239
FILE * file
Definition: SWcommon.h:204