Title: | Using Needleman-Wunsch to Match Sample Names |
---|---|
Description: | The Needleman-Wunsch global alignment algorithm can be used to find approximate matches between sample names in different data sets. See Wang et al. (2010) <doi:10.4137/CIN.S5613>. |
Authors: | Kevin R. Coombes |
Maintainer: | Kevin R. Coombes <[email protected]> |
License: | Apache License (== 2.0) |
Version: | 1.2.7 |
Built: | 2024-11-11 07:17:49 UTC |
Source: | CRAN |
This dataset contains vectors of cell line names that are used to demonstrate how to use the NameNeedle package.
data(cellLineNames)
data(cellLineNames)
This dataset contains four objects: three character vectors (sf2Names
,
rppaNames
, and illuNames
) and one factor (illuType
).
The three character vectors, sf2Names
, rppaNames
, and
illuNames
contain the names of cell lines used in three different
but related experiments. The factor, illuType
, indicates whether
the cell lines named in the illuNames
vector were derived from
lung cancer (with the value "Lung
") or from head and neck cancer
("HNSCC
").
data(cellLineNames) head(rppaNames) head(sf2Names) head(illuNames) summary(illuType)
data(cellLineNames) head(rppaNames) head(sf2Names) head(illuNames) summary(illuType)
The Needleman-Wunsch simple gap algorithm was one of the first methods introduced for global alignment of biological sequences. The same algorithm can be used to match cell line names or sample names from two related data sets; we provide examples in the documentation, using data that accompanies this package.
While the NameNeedle package can be used for biological sequence alignment, the Biostrings package from Bioconductor contains much more sophisticated tools for that problem.
needles(pattern, subject, params=defaultNeedleParams) needleScores(pattern, subjects, params=defaultNeedleParams) defaultNeedleParams
needles(pattern, subject, params=defaultNeedleParams) needleScores(pattern, subjects, params=defaultNeedleParams) defaultNeedleParams
pattern |
character string to be matched |
subject |
character string to be matched against |
subjects |
character vector where matches are sought |
params |
list containing four required components. The default values are
specified by the object $ MATCH : num 1 $ MISMATCH: num -1 $ GAP : num -1 $ GAPCHAR : chr "*" |
The Needleman-Wunsch global alignment algorithm was one of the first algorithms used to align DNA, RNA, or protein sequences. The basic algorithm uses dynamic programming to find an optimal alignment between two sequences, with parameters that specify penalties for mismatches and gaps and a reward for exact matches. More elaborate algorithms (not implemented here) make use of matrices with different penalties depending on different kinds of mismatches. The version implemented here is based on the Perl implementation in the first section of Chapter 3 of the book BLAST.
The needles
function returns a list with five components:
score |
The raw alignment score. |
align1 |
The final (optimal) alignment for the |
align2 |
The final (optimal) alignment for the |
sm |
The score matrix. |
dm |
The backtrace matrix. |
The needleScores
function returns a numeric vector the same
length as the subjects
argument, with each entry equal to the
corresponding raw alignment score.
Kevin R. Coombes [email protected], P. Roebuck [email protected]
Needleman SB, Wunsch CD.
A general method applicable to the search for similarities in the
amino acid sequence of two proteins.
J Mol Biol 1970, 48(3):443–453.
Korf I, Yandell M, Bedell J.
BLAST.
O'Reilly Media, 2003.
Wang J, Byers LA, Yordy JS, Liu W, Shen L, Baggerly KA, Giri U, Myers
JN, Ang KK, Story MD, Girard L, Minna JD, Heymach JV, Coombes KR.
Blasted cell line names.
Cancer Inform. 2010; 9:251–5.
The Biostrings package from Bioconductor used to contain a function
called needwunQS
that provided a simple gap implementation of
Needleman-Wunsch, similar to the one presented here. That function has been
deprecated in favor of a more elaborate interface called
pairwiseAlignment
that incorporates a variety of
other alignment methods in addition. While pairwiseAlignment
is much
more useful for applications to biological sequences, it is serious overkill
for the application we have in mind for matching cell line or other sample
names.
data(cellLineNames) myParam <- defaultNeedleParams myParam$MATCH <- 2 myParam$MISMATCH <- -2 needles(sf2Names[2], illuNames[1], myParam) scores <- needleScores(sf2Names[6], illuNames, myParam) w <- which(scores == max(scores)) w sf2Names[6] needles(sf2Names[6], illuNames[w], myParam)
data(cellLineNames) myParam <- defaultNeedleParams myParam$MATCH <- 2 myParam$MISMATCH <- -2 needles(sf2Names[2], illuNames[1], myParam) scores <- needleScores(sf2Names[6], illuNames, myParam) w <- which(scores == max(scores)) w sf2Names[6] needles(sf2Names[6], illuNames[w], myParam)