Debian Codegraph @

ESTmapper LaTeX/hit-filtering.tex

raw
1 \documentclass[twoside, twocolumn, 10pt]{article}
2 \usepackage{amsmath,amssymb}
3 \usepackage{moreverb}
4 \usepackage{fancyheadings}
5 \usepackage{ulem}
6 \usepackage{parskip}
7 \usepackage{calc,ifthen,epsfig}
8 \sloppy
9
10 % A few float parameters
11 %
12 \renewcommand{\dbltopfraction}{0.9}
13 \renewcommand{\dblfloatpagefraction}{0.9}
14 %\renewcommand{\textfraction}{0.05}
15
16
17 \begin{document}
18
19 % See page 63-64, LaTeX Companion
20 %
21 % leftmargin controls the left margin for EVERYTHING in the list!
22 %
23 \newcommand{\entrylabel}[1]{\mbox{\texttt{#1:}}\hfil}
24 \newenvironment{entry}
25 {\begin{list}{}%
26 {\renewcommand{\makelabel}{\entrylabel}%
27 %\setlength{\leftmargin}{1.5in}%
28 }}
29 {\end{list}}
30
31 % The first parbox width controls the indent on the first text line
32 % The makebox width seems to do nothing.
33 \newcommand{\Lentrylabel}[1]{%
34 {\parbox[b]{0pt}{\makebox[0pt][l]{\texttt{#1:}}\\}}\hfil\relax}
35 \newenvironment{Lentry}
36 {\renewcommand{\entrylabel}{\Lentrylabel}\begin{entry}}
37 {\end{entry}}
38
39 \title{ESTmapper documentation}
40 \author{
41 Liliana Florea\thanks{[email protected]},
42 Brian P. Walenz\thanks{[email protected]}}
43
44 \maketitle
45
46 \pagestyle{fancy}
47
48 \rhead[]{}
49 \chead[ESTmapper]{ESTmapper}
50 \lhead[\today]{\today}
51
52 \normalem
53
54 \newcommand{\ESTmapper}{{\sc ESTmapper\ }}
55
56 \begin{abstract}
57 The gory details of the \ESTmapper process is described.
58
59
60
61
62
63
64
65
66
67
68
69
70
71 \subsection{Hit Filtering}
72
73 \begin{figure*}
74 \begin{center}
75 \epsfig{figure=filter.eps, silent=, width=4.5in}
76 \end{center}
77 \caption{Diagram of the match-building algorithm. The dotted-box represents
78 the extent of the current match. Lines with arrows define regions of action.
79 If the next mer falls in the dark region, the current match is evaluated and
80 potentially saved; if the next mer falls into any of the lighter areas,
81 the mer is added to the current match, and the current match is extended.
82 Note that we have processed all mers in the white region.
83 We process hit A next. As it is in a light region, it is added to the
84 match, and the match is extended. Hit B will break the current match,
85 so it is evaluated and saved. A new match region is formed,
86 encompassing only hit B. Hit C would extend the new match region.}
87 \label{fig:hitfiltering}
88 \end{figure*}
89
90 The goal of filtering is to take a set of mers, and isolate subsets
91 that look like cDNA matches. That is, we want to find a subset of
92 hits that form a nearly-idential alignment, but could have large gaps
93 in the genomic sequence (introns).
94
95 This is done in two passes. The first pass will detect all
96 nearly-identical regions, some of these regions will be grouped into
97 exon-intron structures. The second pass will examine the regions, and
98 merge those that are in approximately the same genomic area.
99
100 The hits in a region of near identity will all be on nearly the same
101 diagonal. By sorting the hits by the diagonal they are on, we can
102 quickly find a subset of hits that form a nearly identical match
103 because they will be consecutive in the list.
104
105 The first pass is shown in Figure~\ref{fig:hitfiltering}. In the
106 figure, a large dashed-box represents the extent of the current
107 matching region, the lines with arrows are various distance thresholds
108 and divide the space into three regions (dark, light and white).
109
110 The white region contains exactly those hits that we have processed
111 thus far. If the next hit in the list falls into one of the lightly
112 shaded regions, it is added to the current match. If the next hit
113 falls into the darkly shaded region, it terminated the current match.
114
115 When the current match is terminated, it is evaluated to decide if it
116 is a significant match or not. Two classes of matches are possible:
117 single exon or multiple exon (based on the size of the diagonal). If
118 a single exon match contains more than $X$ exact base matches, the
119 match region is saved. If a multiple exon match contains more than
120 $Y$ exact base matches, the match region is saved. Otherwise, the
121 match region is discarded, and a new match region is created which
122 contains only the current hit.
123
124 When a match is saved, we only need to save the coordinates in the
125 genomic sequence. Essentially, we are saying ``There might be some
126 piece of the cDNA on this genomic region''. We extend each side of
127 the saved region by an amount proportional to the amount of cDNA that
128 was not represented by the match. {\bf need to explain why}
129
130 \subsection{Match Merging}
131
132 Because of the extension of matches, some matches might be
133 overlapping, or close enough to consider the same match. The final
134 step is to scan the list of matches and merge those that are close.
135
136 \subsection{output}
137
138 Matches are scored by the number of exact base matches they have. We
139 probably want to normalize this to [0,1] somehow, but should also use
140 number of exons, etc., etc.
141
142 \section{What is a signal}
143
144 Signal has three values associated with it. The amount 'covered', the
145 amount 'matched' and the total 'length'.
146 %
147 The amount covered is the number of
148 bases in the mRNA that are contained in least one mer.
149 %
150 The amount matched is the number of paired bases (for example, position
151 $i$ in the cDNA paired with position $j$ in the genomic) covered by a mer.
152 %
153 The length is the number of mers in the mRNA (roughly equivalent to the
154 number of bases in the mRNA that could be covered by a mer, but easier
155 to compute).
156
157 From these, we can derive two scores, the coverage and the multiplicity.
158 The coverage, $\frac{covered}{length}$, represents the fraction of the mRNA
159 that we found, while the multiplicity, $\frac{matched}{covered}$, represents
160 the amount of the mRNA that we found too many times.
161
162 A high multiplicity usually indicates a repeat-containing mRNA. High
163 multiplicity and high coverage can indicate that the mRNA is not cDNA.
164
165 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
166 \section{Filtering, first try}
167
168 Written around 4 December 2001.
169
170 \subsection{Output of the Search}
171
172 The search outputs hits. Each hit is made up of one or more exon-like
173 matches. Each match can represent one or more exons, as long as the
174 mers in the match do not show inconsistent overlap.
175
176 [Insert three pictures here -- single exon match, multiple exon match,
177 inconsistent mers]
178
179 Each match is extended by a value determined by the amount of un-matched
180 query sequence.
181
182 Each match is scored by the number of mers it contains.
183
184 Once the list of matches is found, any matches within 5Kb are merged.
185 The number of mers in a merged match is the sum of the number of mers
186 in its pieces.
187
188 The list of merged matches is then output as hits.
189
190 Hits are scored by:
191
192 (number of mers in the merged matche) / (number or mers in the query)
193
194 Number of mers in the query is the number of valid mers -- the
195 high-frequency mers and mers containing 'N' are not counted.
196
197 A score of 1.0 is perfect; a score less than 1.0 indicates a partial
198 match, while a score more than 1.0 indicates a duplicate gene nearby,
199 or a large spurious match.
200
201 \subsection{Filtering of Hits}
202
203 Given all hits for a specific query sequence, we filter them by throwing
204 away the lowest scoring ones. (duh!)
205
206 A low-score cutoff if determined with:
207
208 cutoff = cutoffScale * (highestScore - lowestScore) + lowestScore
209
210 where cutoffScale is a parameter to decide how aggressive the
211 filtering is (1.0 is perfectly aggressive, 0.3 is reasonable).
212
213 Then all hits with score < cutoff are discarded.
214
215 \subsection{Modifications}
216
217 Occasionally, large spurious matches are found (e.g., ???). The score
218 of the spurious match can be significantly better than the score of the
219 real match, which will cause the real match to be filtered out. To
220 compensate for this, the value of highestScore in the cutoff computation
221 is modified to be
222
223 max(lowestScore, min(1.0, highestScore))
224
225 \subsection{Discussion}
226
227 As the search is done over the whole genome, and all hits are used
228 to determine the highestScore and lowestScore blah, blah, blah.
229
230
231 if highestScore $<$ 1.0 -- unmatched mers are assumed to be in error,
232 either in the query or the genome. We will never find these mers, so
233 we should reduce the aggressiveness of the filter to account for this.
234
235 if highestScore $>$ 1.0 -- the best hit is probably bogus, and we still
236 want to polish hits down to (about) the same level as if the best hit
237 were a perfect hit. Thus, threshold the highestScore to be a perfect
238 hit.
239
240 Finally, we need to make the highestScore at least the lowestScore, in
241 the extreme case that the worst hit is greater than 1.0. Ha, ha. Why
242 are you searching for repeats, anyway?
243
244 \subsection{Implementation Detail}
245
246 A CPU-time limit is imposed when polishing hits for queries that have
247 a hit with score greater than 1.5. This solves the nasty case when we
248 get a chunk of genomic as input, and it matches an entire chromosome
249 with several hundred exon-like things, and it takes hours to polish.
250
251 The more correct thing to do is to abort ANY polish that takes more
252 than 60 seconds, not just suspicious looking ones. Software
253 engineering issue.
254
255 To do this correctly, we would need to register all memory allocated by
256 sim4(), and free it when a timer goes off. How to actually return from
257 the sim4()? Without longjmp()?
258
259 If we use threads, is this easier? Have the master thread abort the
260 slave ({\tt pthread\_cancel})? Still have the memory deallocation problem.
261 ({\tt pthread\_cleanup\_push} can do it, if we keep a list of allocations)
262
263 \section{Filtering EST signals}
264
265 \section{Filtering mRNA signals}
266
267 \begin{figure}
268 \begin{center}
269 \begin{tabular}{|c|c|p{0.3in}|p{1.25in}|}
270 \hline
271 Switch & Variable & Def. Value & Description \\
272 \hline
273 \hline
274 -l & $L$ & 0.2 & Signal spread low range \\
275 -h & $H$ & 0.6 & Signal spread high range \\
276 -v & $V$ & 0.3 & Pass value \\
277 -m & $M$ & 0.3 & Signal quality floor \\
278 -mc & $M_c$ & 0.2 & Minimum signal quality \\
279 -ml & $M_l$ & 150 & Minimum signal size \\
280 \hline
281 \end{tabular}
282 \end{center}
283 \caption{Parameters, default values and descriptions}
284 \label{table:defvalues}
285 \end{figure}
286
287 In order to filter signals, we need to decide, for each mRNA, which
288 signals are bad, and which are good (duh!), which means that we'll
289 need to look at {\em all} signals for a single mRNA.
290
291 For the filter presented below, we need to know the best and worst
292 coverage values that occur for any signal associated with a specific
293 mRNA. Once those are known, the signals can be filtered in any order.
294 This is important in the case where the signals are detected
295 chromosome by chromosome. Instead of sorting all signals, we can save
296 the best and worst coverage for each mRNA.
297
298 The filter has six parameters, summarized in Table~\ref{table:defvalues}.
299
300 If the signals for a specific mRNA are all very similar, it is
301 probable that the weaker signals are weak only because of a few
302 mismatches that break 20-mers. In this case, we cannot reliably pick
303 the signals that are true, and should consider all of them.
304
305 On the other hand, if there is a large range in the quality of signals,
306 we can safely discard low scoring signals, and still be confident that
307 we will find the good stuff.
308
309 Therefore, the filter will discard no signals if the range in quality
310 values is small, and will gradually discard more, proportional to the
311 range. So that we don't discard too much, we limit the increase in
312 filtering to $V$ (0.3).
313 \begin{align*}
314 h &= bestCoverage - worstCoverage \\
315 p &= \begin{cases}
316 0.0 & \text{if $h \le L$} \\
317 V * \frac{h-L}{H-L} & \text{if $L < h < H$} \\
318 V & \text{if $H \le h$}
319 \end{cases} \\
320 c &= min(worstCoverage + p \cdot h, M)
321 \end{align*}
322
323 \begin{figure*}
324 \begin{center}
325 \epsfig{figure=mRNAfilt.eps, silent=, width=4.5in}
326 \end{center}
327 \caption{The $p$ curve.}
328 \label{fig:pcurve}
329 \end{figure*}
330
331 $p$ is the amount of filtering, ranging from minimum (0.0) to maximum
332 ($V$, a parameter).
333
334 The $c$ value computed above is the filtering threshold. Signals with
335 coverage below $c$ are considered weak, and are discarded.
336
337 If the score range is small ($\le L$), then $c$ will be
338 $worstCoverage$, and we do no filtering. If the score range is large
339 ($\ge H$), then $c$ will be $M$ of the best score. $c$ is the minimum
340 coverage that will be accepted. It is derived from the range of
341 scores, not the number of scores.
342
343 Finally, it is possible that {\em all} signals are good. If we used the
344 above filtering we would be discarding the low scoring (but still valid)
345 signals. To overcome this, absolute limits $M_c$ and $M_l$ are enforced.
346
347 A signal is saved if both of the following conditions are met:
348 \begin{enumerate}
349 \item ($c <= coverage$)
350 \item ($M_c <= coverage$) or ($M_l <= coveredBases$)
351 \end{enumerate}
352
353 This filter is overly permissive, throwing out only signals that are
354 obviously garbage.
355
356
357 \end{document}
358