This function will rarely need to be called directly, but does most of
the calculations behind TRAMP
, so it is useful to
understand how this works.
This function generates a three-dimensional \(s \times k \times
n\) matrix of the (smallest, see below) distance in base
pairs between peaks in a collection of unknowns (run data) and a
database of knowns for several enzyme/primer combinations. \(s\) is
the number of different samples in the samples data
(length(labels(samples))
), \(k\) is the number of different
types in the knowns database (length(labels(knowns))
), and
\(n\) is the number of different enzyme/primer combinations. The
enzyme/primer combinations used are all combinations present in the
knowns database; combinations present only in the samples will be
ignored. Not all samples need contain all enzyme/primer combinations
present in the knowns.
In the resulting array, m[i,j,k]
is the difference (in base
pairs) between the i
th sample and the j
th known for the
k
th enzyme/primer combination. The ordering of the \(n\)
enzyme/primer combinations is arbitrary, so a data.frame of
combinations is included as the attribute enzyme.primer
, where
enzyme.primer$enzyme[k]
and enzyme.primer$primer[k]
correspond to enzyme and primer used for the distances in
m[,,k]
.
Each case in the knowns database has a single (or no) peak for each
enzyme/primer combination, but each sample may contain multiple peaks
for an enzyme/primer combination; the difference is always the
smallest distance from the sample to the known peak. Where a sample
and/or a known lacks an enzyme/primer combination, the value of the
difference is NA
. The smallest absolute distance is
taken between sample and known peaks, but the sign of the difference
is preserved (negative where the closest sample peak was less than the
known peak, positive where greater; see absolute.min
).