1 /* 2 * Copyright (c) 2007 Genome Research Ltd. 3 * Author(s): James Bonfield 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, 9 * this list of conditions and the following disclaimer. 10 * 11 * 2. Redistributions in binary form must reproduce the above 12 * copyright notice, this list of conditions and the following 13 * disclaimer in the documentation and/or other materials provided 14 * with the distribution. 15 * 16 * 3. Neither the names Genome Research Ltd and Wellcome Trust Sanger 17 * Institute nor the names of its contributors may be used to endorse 18 * or promote products derived from this software without specific 19 * prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY GENOME RESEARCH LTD AND CONTRIBUTORS "AS 22 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 24 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENOME RESEARCH 25 * LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 /* 35 * Author(s): James Bonfield, Mark Jordan 36 * 37 * Copyright (c) 1995-1996, 1998, 2002-2003 MEDICAL RESEARCH COUNCIL 38 * All rights reserved 39 * 40 * Redistribution and use in source and binary forms, with or without 41 * modification, are permitted provided that the following conditions are met: 42 * 43 * 1 Redistributions of source code must retain the above copyright notice, 44 * this list of conditions and the following disclaimer. 45 * 46 * 2 Redistributions in binary form must reproduce the above copyright 47 * notice, this list of conditions and the following disclaimer in 48 * the documentation and/or other materials provided with the 49 * distribution. 50 * 51 * 3 Neither the name of the MEDICAL RESEARCH COUNCIL, THE LABORATORY OF 52 * MOLECULAR BIOLOGY nor the names of its contributors may be used 53 * to endorse or promote products derived from this software without 54 * specific prior written permission. 55 * 56 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 57 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 58 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 59 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 60 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 61 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 62 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 63 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 64 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 66 * POSSIBILITY OF SUCH DAMAGE. 67 */ 68 69 /* 70 * Copyright (c) Medical Research Council 1994. All rights reserved. 71 * 72 * Permission to use, copy, modify and distribute this software and its 73 * documentation for any purpose is hereby granted without fee, provided that 74 * this copyright and notice appears in all copies. 75 * 76 * This file was written by James Bonfield, Simon Dear, Rodger Staden, 77 * as part of the Staden Package at the MRC Laboratory of Molecular 78 * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom. 79 * 80 * MRC disclaims all warranties with regard to this software. 81 */ 82 83 #ifndef _TRANSLATE_H_ 84 #define _TRANSLATE_H_ 85 86 #include "io_lib/scf.h" 87 #include "io_lib/Read.h" 88 #include "io_lib/expFileIO.h" 89 90 #ifdef __cplusplus 91 extern "C" { 92 #endif 93 94 /* 95 * Translates an Scf structure into a Read structure. 96 * The Scf structure is left unchanged. 97 * 98 * Returns: 99 * A pointer to an allocated Read structure upon success. 100 * NULLRead upon failure. 101 */ 102 Read *scf2read(Scf *scf); 103 104 /* 105 * Translates a Read structure into a Scf structure. 106 * The Read structure is left unchanged. 107 * 108 * Returns: 109 * A pointer to an allocated Scf structure upon success. 110 * NULL upon failure. 111 */ 112 Scf *read2scf(Read *read); 113 114 /* 115 * Translates a Read structure and an Experiment file. 116 * The Read structure is left unchanged. 117 * 118 * Returns: 119 * A pointer to an allocated Exp_info structure upon success. 120 * NULL upon failure (FIXME: need to free memory here) 121 */ 122 Exp_info *read2exp(Read *read, char *EN); 123 124 /* 125 * Controls the use of the SQ and ON lines when loading an experiment file. 126 * The default (value&1 == 1) is to load these into the Read structure. 127 * With value&1 == 0 we load the sequence directly from the trace file 128 * (LT line). 129 * value&2 controls whether to use the SL/SR fields when setting the cutoff. 130 * value&2 == 0 implies to do so, and value&2 == 2 implies to not. 131 * 132 * Returns: 133 * The old value. 134 */ 135 int read_experiment_redirect(int value); 136 137 /* 138 * Takes an original read structure and a set of edit change arrays and 139 * produces a new base position array incorporating all the edits. For 140 * insertions, interpolation is used to derive a suitable sample position. 141 * 142 * INPUTS: 143 * 144 * Read *r = The original unedited read structure 145 * int Comp = 0=Normal sequence, 1=Complemented sequence 146 * int Ned = Length of edited arrays to follow 147 * char *edBases = Sequence of base characters incorporating ins/del edits 148 * uint_2 *edPos = Corresponding original base numbers, 0 indicates an 149 * insertion. Base numbers start at 1. 150 * 151 * OUTPUTS: 152 * 153 * This array is assumed to be empty with an allocated length of Ned elements. 154 * 155 * uint_2* basePos = Base positions in samples 156 */ 157 158 void read_update_base_positions( Read *r, int Comp, int Ned, char *edBases, 159 int_2 *edPos, uint_2 *basePos ); 160 161 /* 162 * Takes a set of edit change arrays and produces a new set of confidence 163 * arrays incorporating all the edits. 164 * 165 * INPUTS: 166 * 167 * int Ned = Length of edited arrays to follow 168 * char* edBases = Sequence of base characters incorporating ins/del edits 169 * int1* edConf = Corresponding confidence values, 100 for insertions 170 * 171 * 172 * OUTPUTS: 173 * 174 * These output arrays are assumed to be empty with an allocated length 175 * of Ned elements each. The names and types are identical to the same 176 * elements in the Read structure. 177 * 178 * char* prob_A = Base confidence A 179 * char* prob_C = Base confidence C 180 * char* prob_G = Base confidence G 181 * char* prob_T = Base confidence T 182 * 183 */ 184 185 void read_update_confidence_values( int Ned, char* edBases, int1* edConf, 186 char* prob_A, char* prob_C, char* prob_G, char* prob_T ); 187 188 189 /* 190 * Translates an experiment file to a Read structure. 191 * The Exp_Info structure is left unchanged. 192 * 193 * Returns: 194 * A pointer to an allocated Read structure upon success. 195 * NULLRead upon failure. 196 */ 197 Read *exp2read(Exp_info *e, char *fn); 198 199 #ifdef __cplusplus 200 } 201 #endif 202 203 #endif 204