-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory_冲突文件_DELL_20230617123831
479 lines (479 loc) · 19.5 KB
/
.Rhistory_冲突文件_DELL_20230617123831
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
library(blogdown)
blogdown::serve_site()
blogdown::serve_site()
setwd("D:/BaiduSyncdisk/lijun_All_codes/leo1234j_website/leo1234jv4/")
blogdown::serve_site()
blogdown::install_hugo()
blogdown::serve_site()
blogdown::serve_site()
blogdown::serve_site()
blogdown::serve_site()
blogdown::serve_site()
blogdown::serve_site()
blogdown::stop_server()
blogdown::build_site()
blogdown::serve_site()
blogdown::stop_server()
blogdown::build_site()
blogdown::serve_site()
blogdown::stop_server()
blogdown::build_site()
blogdown::build_site()
blogdown::serve_site()
blogdown::stop_server()
blogdown::build_site()
blogdown::build_site()
blogdown::build_site()
blogdown::build_site()
blogdown::serve_site()
blogdown::stop_server()
library(blogdown)
setwd("D:/BaiduSyncdisk/lijun_All_codes/leo1234j_website/leo1234jv4/")
blogdown::serve_site()
blogdown::stop_server()
blogdown::build_site()
blogdown::serve_site()
blogdown::stop_server()
blogdown::build_site()
blogdown::serve_site()
blogdown::stop_server()
blogdown::serve_site()
blogdown::stop_server()
blogdown::serve_site()
blogdown::stop_server()
blogdown::serve_site()
blogdown::stop_server()
blogdown::build_site()
blogdown::serve_site()
blogdown::stop_server()
blogdown::build_site()
blogdown::serve_site()
blogdown::stop_server()
blogdown::build_site()
library(celltalker)
#-------------------------P4 sagittal MALDI-TOF imaging--------------------------#
{
#################################Load library needed
library(Cardinal)
library(dplyr)
library(Seurat) ###Seurat analysis pipeline
}
#######################################Analysis our Rapidflex MALDI-TOF/TOF data;
setwd("E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/")
msi_folder <- "E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/"
name_list <- list.files(path = "E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/", pattern='.imzML')
name_1 <- substr(name_list[1], 1, nchar(name_list[1])-6)
MSI_obj <- readImzML(name_1, folder = msi_folder, attach.only = TRUE,
mass.range = NULL, resolution = NA, units = c("ppm", "mz"),
as = "MSImagingExperiment", parse.only = FALSE,
BPPARAM = getCardinalBPPARAM())
name_1
name_list
MSI_obj <- readImzML(name_1, folder = msi_folder, attach.only = TRUE,
mass.range = NULL, resolution = NA, units = c("ppm", "mz"),
as = "MSImagingExperiment", parse.only = FALSE,
BPPARAM = getCardinalBPPARAM())
#######################################Analysis our Rapidflex MALDI-TOF/TOF data;
setwd("E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/")
msi_folder <- "E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/"
name_list <- list.files(path = "E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/", pattern='.imzML')
name_1 <- substr(name_list[1], 1, nchar(name_list[1])-6)
MSI_obj <- readImzML(name_1, folder = msi_folder, attach.only = TRUE,
mass.range = NULL, resolution = NA, units = c("ppm", "mz"),
as = "MSImagingExperiment", parse.only = FALSE,
BPPARAM = getCardinalBPPARAM())
MSI_obj
name_1
MSI_obj@featureData@resolution
################Flip the image;
MSI_obj@elementMetadata@coord@listData[["x"]] <- -(MSI_obj@elementMetadata@coord@listData[["x"]])
MSI_obj@elementMetadata@coord@listData[["y"]] <- -(MSI_obj@elementMetadata@coord@listData[["y"]])
################Pre-processing;
###We calculate the mean spectrum using summarizeFeatures().
#Fun: A function or list of functions that return statistical summaries.
#Known statistics can be provided to be computed more efficiently than providing the equivalent function.
#Known statistics include "min", "max", "mean", "sum", "sd", and "var".
MSI_obj_mean <- summarizeFeatures(MSI_obj, "mean")
dir.create("E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/export_plot/")
plot_path <- "E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/export_plot/"
plot(MSI_obj_mean, main = "Mean_Neg_1-5DAN_human_tumor")
png(paste0(plot_path, "Mean_Neg_mode_1-5DAN_2022_0909_human_tumor.png"), width =1200, height = 400)
plot(MSI_obj_mean, main = "Mean_Neg_1-5DAN_human_tumor")
dev.off()
######################Apply plotly plot to interactively visualize TIC plot, and check individual peaks;
feature_data_mean <- as.data.frame(cbind(MSI_obj_mean@featureData@mz, MSI_obj_mean@featureData$mean))
colnames(feature_data_mean) <- c("mz", "mean")
library(plotly)
###################normalize all pixels with TIC method;
##In order to make the mass spectra comparable between different pixels, it is necessary to normalize the data. We will use TIC normalization.
##Let’s calculate the TIC to see how it currently varies across the dataset in the raw, unprocessed specra.
###summarizePixels(x, FUN = "mean", ...) FUN = "sum";
# summarize image by TIC
lj_100um_mid_tic <- summarizePixels(MSI_obj, c(tic="sum"))
###########All m/z;
all_mz <- MSI_obj@featureData@mz
all_mz <- as.data.frame(all_mz)
#############################################setting the color bar;
#library(devtools)
#install_github("marchtaylor/sinkr")
library(sinkr) # https://github.com/marchtaylor/sinkr
ncolors <- 256
colors <- jetPal(ncolors)
setwd("E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/export_plot/")
#################################export all mz spectrum into one pdf and have a profile view;
##dir.create("D:/lijun_2022/lijun_All_data/2022_04_12_in_guodian_MALDI/neg_wholebrain_batch_A")
plot_path <- "E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/export_plot/"
################create a reference peaks;
###To process the dataset, we will first perform peak picking on the mean spectrum to create a set of reference peaks.
###We will then bin the peaks in the entire dataset to this reference.
lj_100um_mid_ref <- MSI_obj_mean %>%
peakPick(SNR=3) %>% ###SNR; The minimum signal-to-noise ratio to be considered a peak.
peakAlign(ref="mean", ###ref; A reference to which to align the peaks.
tolerance=0.5, ###The tolerance to be used when aligning detected peaks to the reference. If this is NA, then automatically guess a tolerance from the data.
units="mz") %>% ###The units to use for the tolerance. Either parts-per-million or the raw m/z values.
peakFilter() %>% ###
process()
###Now we bin the rest of the dataset to the reference peaks.
lj_100um_mid_peaks <- MSI_obj %>%
normalize(method="tic") %>%
peakBin(ref=mz(lj_100um_mid_ref),
tolerance=0.26, ###units = c("ppm", "mz") #######0.26, manual measured
units="mz") %>% ###The units to use for the tolerance.
process()
lj_100um_mid_peaks ###(tol = 0.26 mz)
length(lj_100um_mid_peaks@featureData@mz)
image(MSI_obj, mz=lj_100um_mid_peaks@featureData@mz[100], plusminus=0.1, colorscale = colors, contrast.enhance = c("suppression"))
#################Export result MSI after peak picking;
mz_array_peaks <- lj_100um_mid_peaks@featureData@mz
pdf(paste0(plot_path, "human_tumor_after_peak_picking_378_features_1_5_DAN_neg_09_09.pdf"), width = 35.1/8, height = 23.6/8)
4.13、2
4.13/2
35.1/8
23.6/8
pdf(paste0(plot_path, "human_tumor_after_peak_picking_378_features_1_5_DAN_neg_09_09.pdf"), width = 4.13, height = 5.21)
###4.13 * 5.21
for(i in 1:length(mz_array_peaks)){
p <- image(MSI_obj, mz=mz_array_peaks[i], plusminus=0.1, colorscale = colors, contrast.enhance = c("suppression"))
print(p)
}
dev.off()
name_list <- list.files(path = "E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/", pattern='.imzML')
name_1 <- substr(name_list[2], 1, nchar(name_list[1])-6)
name_1
gc()
#-------------------------P4 sagittal MALDI-TOF imaging--------------------------#
{
#################################Load library needed
library(Cardinal)
library(dplyr)
library(Seurat) ###Seurat analysis pipeline
}
#######################################Analysis our Rapidflex MALDI-TOF/TOF data;
setwd("E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/")
msi_folder <- "E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/"
name_list <- list.files(path = "E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/", pattern='.imzML')
name_1 <- substr(name_list[2], 1, nchar(name_list[1])-6)
MSI_obj <- readImzML(name_1, folder = msi_folder, attach.only = TRUE,
mass.range = NULL, resolution = NA, units = c("ppm", "mz"),
as = "MSImagingExperiment", parse.only = FALSE,
BPPARAM = getCardinalBPPARAM())
MSI_obj
name_list <- list.files(path = "E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/", pattern='.imzML')
name_1 <- substr(name_list[2], 1, nchar(name_list[1])-6)
MSI_obj <- readImzML(name_1, folder = msi_folder, attach.only = TRUE,
mass.range = NULL, resolution = NA, units = c("ppm", "mz"),
as = "MSImagingExperiment", parse.only = FALSE,
BPPARAM = getCardinalBPPARAM())
name_1
name_1 <- substr(name_list[2], 1, nchar(name_list[1])-7)
MSI_obj <- readImzML(name_1, folder = msi_folder, attach.only = TRUE,
mass.range = NULL, resolution = NA, units = c("ppm", "mz"),
as = "MSImagingExperiment", parse.only = FALSE,
BPPARAM = getCardinalBPPARAM())
MSI_obj
MSI_obj@featureData@resolution
################Flip the image;
MSI_obj@elementMetadata@coord@listData[["x"]] <- -(MSI_obj@elementMetadata@coord@listData[["x"]])
MSI_obj@elementMetadata@coord@listData[["y"]] <- -(MSI_obj@elementMetadata@coord@listData[["y"]])
################Pre-processing;
###We calculate the mean spectrum using summarizeFeatures().
#Fun: A function or list of functions that return statistical summaries.
#Known statistics can be provided to be computed more efficiently than providing the equivalent function.
#Known statistics include "min", "max", "mean", "sum", "sd", and "var".
MSI_obj_mean <- summarizeFeatures(MSI_obj, "mean")
###dir.create("E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/export_plot/")
plot_path <- "E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/export_plot/"
png(paste0(plot_path, "Mean_Neg_mode_1-5DAN_20um_2022_0909_human_tumor.png"), width =1200, height = 400)
plot(MSI_obj_mean, main = "Mean_Neg_1-5DAN_20um_human_tumor")
dev.off()
######################Apply plotly plot to interactively visualize TIC plot, and check individual peaks;
feature_data_mean <- as.data.frame(cbind(MSI_obj_mean@featureData@mz, MSI_obj_mean@featureData$mean))
colnames(feature_data_mean) <- c("mz", "mean")
library(plotly)
fig_mid_mean <- plot_ly(data = feature_data_mean, x = ~mz, y =~mean, mode = 'lines')
###################normalize all pixels with TIC method;
##In order to make the mass spectra comparable between different pixels, it is necessary to normalize the data. We will use TIC normalization.
##Let’s calculate the TIC to see how it currently varies across the dataset in the raw, unprocessed specra.
###summarizePixels(x, FUN = "mean", ...) FUN = "sum";
# summarize image by TIC
lj_100um_mid_tic <- summarizePixels(MSI_obj, c(tic="sum"))
###########All m/z;
all_mz <- MSI_obj@featureData@mz
all_mz <- as.data.frame(all_mz)
#############################################setting the color bar;
#library(devtools)
#install_github("marchtaylor/sinkr")
library(sinkr) # https://github.com/marchtaylor/sinkr
ncolors <- 256
colors <- jetPal(ncolors)
setwd("E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/export_plot/")
#################################export all mz spectrum into one pdf and have a profile view;
##dir.create("D:/lijun_2022/lijun_All_data/2022_04_12_in_guodian_MALDI/neg_wholebrain_batch_A")
plot_path <- "E:/LC_MS_raw_data/20220909_gelab_human_tumor/NIN-tumor/export_plot/"
################create a reference peaks;
###To process the dataset, we will first perform peak picking on the mean spectrum to create a set of reference peaks.
###We will then bin the peaks in the entire dataset to this reference.
lj_100um_mid_ref <- MSI_obj_mean %>%
peakPick(SNR=3) %>% ###SNR; The minimum signal-to-noise ratio to be considered a peak.
peakAlign(ref="mean", ###ref; A reference to which to align the peaks.
tolerance=0.5, ###The tolerance to be used when aligning detected peaks to the reference. If this is NA, then automatically guess a tolerance from the data.
units="mz") %>% ###The units to use for the tolerance. Either parts-per-million or the raw m/z values.
peakFilter() %>% ###
process()
###Now we bin the rest of the dataset to the reference peaks.
lj_100um_mid_peaks <- MSI_obj %>%
normalize(method="tic") %>%
peakBin(ref=mz(lj_100um_mid_ref),
tolerance=0.26, ###units = c("ppm", "mz") #######0.26, manual measured
units="mz") %>% ###The units to use for the tolerance.
process()
lj_100um_mid_peaks ###(tol = 0.26 mz)
length(lj_100um_mid_peaks@featureData@mz)
image(MSI_obj, mz=lj_100um_mid_peaks@featureData@mz[100], plusminus=0.1, colorscale = colors, contrast.enhance = c("suppression"))
#################Export result MSI after peak picking;
mz_array_peaks <- lj_100um_mid_peaks@featureData@mz
pdf(paste0(plot_path, "human_tumor_20um_after_peak_picking_250_features_1_5_DAN_neg_09_09.pdf"), width = 3.01, height = 2.53)
###width = 3.01, height = 2.53
for(i in 1:length(mz_array_peaks)){
p <- image(MSI_obj, mz=mz_array_peaks[i], plusminus=0.1, colorscale = colors, contrast.enhance = c("suppression"))
print(p)
}
dev.off()
gc()
setwd("D:/BaiduSyncdisk/lijun_All_codes/leo1234j_website/leo1234jv4/")
setwd("D:/BaiduSyncdisk/lijun_All_codes/leo1234j_website/leo1234jv4/")
library(blogdown)
blogdown::serve_site()
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
#library(shinyjs)
library(shiny)
library(DT)
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
#library(shinyjs)
library(shiny)
library(DT)
library(Cardinal) ####???
install.packages("Cardinal")
install.packages("BiocManager")
BiocManager::install("Cardinal")
install.packages("locfit")
library(Cardinal) ####???
library(plotly)
library(ggplot2)
library(Seurat)
#library(fontawesome)
library(bs4Dash)
library(tidyverse)
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("Cardinal")
library(Cardinal) ####???
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("EBImage")
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("EBImage", force = TRUE)
library(Seurat)
#library(fontawesome)
library(bs4Dash)
library(tidyverse)
library(shinydashboard)
library(DT)
library(blogdown)
library(blogdown)
blogdown::serve_site()
blogdown::stop_server()
blogdown::build_site()
blogdown::serve_site()
blogdown::serve_site()
blogdown::stop_server()
library(blogdown)
setwd("D:/BaiduSyncdisk/lijun_All_codes/leo1234j_website/leo1234jv4/")
blogdown::serve_site()
install.packages("leaflet")
library(blogdown)
blogdown::serve_site()
blogdown::stop_server()
blogdown::build_site()
library(blogdown)
blogdown::serve_site()
592-450
143*3
20^4
20^5
20^6
20^7
4574-3955
library(blogdown)
setwd("D:/BaiduSyncdisk/lijun_All_codes/leo1234j_website/leo1234jv4/")
blogdown::serve_site()
## try http:// if https:// URLs are not supported
source("https://bioconductor.org/biocLite.R")
## biocLite("BiocUpgrade") ## you may need this
biocLite("ggtree")
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("ggtree")
library(ggtree)
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("ggtree")
install.packages("dplyr")
install.packages("dplyr")
library(ggtree)
library(blogdown)
setwd("F:/BaiduSyncdisk/lijun_All_codes/leo1234j_website/leo1234jv4/")
blogdown::serve_site()
blogdown::stop_server()
blogdown::serve_site()
install.packages("edfReader")
library(blogdown)
setwd("F:/BaiduSyncdisk/lijun_All_codes/leo1234j_website/leo1234jv4/")
blogdown::serve_site()
blogdown::stop_server()
blogdown::build_site()
library(ggpubr)
# Create a simple bar plot
ggbarplot(
ToothGrowth, x = "dose", y = "len",
add = c("mean_se", "jitter"),
fill = "#BF504D"
)
ToothGrowth
# Grouped bar plots
# Colored by groups
ggbarplot(
ToothGrowth, x = "dose", y = "len",
add = c("mean_sd", "jitter"),
color = "supp", palette = c("#807F7F", "#BF504D"),
position = position_dodge(0.8)
)
# Create a simple bar plot
ggbarplot(
ToothGrowth, x = "dose", y = "len",
add = c("mean_se", "jitter"),
fill = "#BF504D"
)
# Change bars fill color by groups
# You need to change also point shapes by groups
ggbarplot(
ToothGrowth, x = "dose", y = "len",
add = c("mean_sd", "jitter"),
add.params = list(shape = "supp"),
fill= "supp", palette = c("#807F7F", "#BF504D"),
position = position_dodge(0.8)
)
# Create a simple bar plot
ggbarplot(
ToothGrowth, x = "dose", y = "len",
add = c("mean_se", "jitter"),
fill = "#BF504D"
)
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("msa")
BiocManager::install("msa", force = TRUE)
library(msa)
## ----LoadPackageToDetermineVersion,echo=FALSE,message=FALSE,results='hide'----
options(width=65)
set.seed(0)
library(msa)
library(seqinr)
msaVersion <- packageDescription("msa")$Version
msaDateRaw <- packageDescription("msa")$Date
msaDateYear <- as.numeric(substr(msaDateRaw, 1, 4))
msaDateMonth <- as.numeric(substr(msaDateRaw, 6, 7))
msaDateDay <- as.numeric(substr(msaDateRaw, 9, 10))
msaDate <- paste(month.name[msaDateMonth], " ",
msaDateDay, ", ",
msaDateYear, sep="")
## ----SimpleExFileNames-----------------------------------------
mySequenceFile <- system.file("examples", "exampleAA.fasta", package="msa")
mySequences <- readAAStringSet(mySequenceFile)
mySequences
## ----doAlignment-----------------------------------------------
myFirstAlignment <- msa(mySequences)
myFirstAlignment
## ----showWholeWidth--------------------------------------------
print(myFirstAlignment, show="complete")
## ----VisualizePDF,results='asis'-------------------------------
msaPrettyPrint(myFirstAlignment, y=c(164, 213), output="asis",
showNames="none", showLogo="none", askForOverwrite=FALSE)
## ----OtherAlgorithms-------------------------------------------
myClustalWAlignment <- msa(mySequences, "ClustalW")
myClustalWAlignment
## ----maskExample-----------------------------------------------
myMaskedAlignment <- myFirstAlignment
colM <- IRanges(start=1, end=100)
colmask(myMaskedAlignment) <- colM
myMaskedAlignment
## ----Hemoglobin2-----------------------------------------------
library(seqinr)
d <- dist.alignment(hemoAln2, "identity")
as.matrix(d)[2:5, "HBA1_Homo_sapiens", drop=FALSE]
## ----HemoglobinTree,output.width='0.8\\textwidth',output.height='0.5\\textwidth',message=FALSE,results='hide'----
library(ape)
hemoTree <- nj(d)
## ----ShowConsensusBottom,results="asis"------------------------
msaPrettyPrint(myFirstAlignment, output="asis", y=c(164, 213),
subset=c(1:6), showNames="none", showLogo="none",
consensusColor="ColdHot", showLegend=FALSE,
askForOverwrite=FALSE)
## ----conservationExample1--------------------------------------
data(BLOSUM62)
msaConservationScore(myFirstAlignment, BLOSUM62)
## ----conservationExample2--------------------------------------
msaConservationScore(myFirstAlignment, BLOSUM62, gapVsGap=0,
type="upperlower", thresh=c(40, 20))
## ----conservationExample3--------------------------------------
msaConservationScore(myMaskedAlignment, BLOSUM62, gapVsGap=0,
type="upperlower", thresh=c(40, 20))
## ----Hemoglobin1-----------------------------------------------
hemoSeq <- readAAStringSet(system.file("examples/HemoglobinAA.fasta",
package="msa"))
hemoAln <- msa(hemoSeq)
hemoAln
hemoAln2 <- msaConvert(hemoAln, type="seqinr::alignment")
## ----Hemoglobin2-----------------------------------------------
library(seqinr)
d <- dist.alignment(hemoAln2, "identity")
as.matrix(d)[2:5, "HBA1_Homo_sapiens", drop=FALSE]
## ----HemoglobinTree,output.width='0.8\\textwidth',output.height='0.5\\textwidth',message=FALSE,results='hide'----
library(ape)
hemoTree <- nj(d)
plot(hemoTree, main="Phylogenetic Tree of Hemoglobin Alpha Sequences")