-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui.R
More file actions
119 lines (117 loc) · 5.22 KB
/
Copy pathui.R
File metadata and controls
119 lines (117 loc) · 5.22 KB
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
ui <- fluidPage(
tags$head(
tags$style(HTML("
.container-fluid {
max-width: 1480px;
}
.table-wrap {
display: block;
overflow-x: scroll;
overflow-y: hidden;
width: 100%;
margin-bottom: 12px;
padding-bottom: 6px;
border: 1px solid #e5e5e5;
border-radius: 4px;
background: #fff;
}
.table-wrap table {
display: table;
font-size: 12px;
white-space: nowrap;
width: max-content;
min-width: 100%;
margin-bottom: 0;
}
.table-wrap table th,
.table-wrap table td,
table.dataTable th,
table.dataTable td {
text-align: center !important;
vertical-align: middle !important;
}
.shiny-plot-output {
width: 100% !important;
}
.section-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.section-header h4 {
margin: 0;
}
"))
),
titlePanel("AB1 文件分析工具"),
sidebarLayout(
sidebarPanel(
width = 3,
helpText("用于碱基编辑的 AB1 / Sanger 测序分析。程序会自动识别输入序列与测序结果的正反向关系;选择目标碱基和编辑后碱基后,可输出摘要、位点编辑率图和下载结果。分析结果与 ab1 测序质量相关,结果异常时建议导入 SnapGene 查看峰图。"),
textInput("template_filter", "搜索模板标签", value = ""),
selectInput("saved_sequence", "已保存序列模板", choices = c("请选择已保存序列模板" = "")),
textInput("sequence", "输入序列", value = ""), # 序列输入框
textInput("template_name", "模板标签(例如 RD-201-DIS3)", value = ""),
textInput("target_position", "重点目标位点(例如 8)", value = ""),
actionButton("save_template", "保存当前序列模板"),
actionButton("delete_template", "删除当前模板"),
helpText("选择需要统计的参考碱基位点。程序会在输入序列中找出所有该碱基位置,并提取这些位点的峰比例。"),
selectInput("target_base", "目标碱基", choices = c("A", "C", "G", "T"), selected = "C"),
helpText("选择期望的编辑后碱基。程序会输出每个位点的目标碱基比例、编辑后碱基比例、编辑率和 non-target edit rate。"),
selectInput("edited_base", "编辑后碱基", choices = c("A", "C", "G", "T"), selected = "T"),
helpText("处理前可先用正则规则规范样本名称,便于结果表和下载文件阅读。该操作只影响应用中的显示名称,不改动原始 ab1 文件。"),
selectInput(
"rename_preset",
"文件名规则",
choices = c(
"仅去掉 .ab1 后缀" = "strip_extension",
"去掉开头序号" = "strip_leading_index",
"去掉测序公司 TSS 后缀" = "strip_tss_suffix",
"保留 编号_引物名" = "keep_index_and_primer",
"组合规则(保留编号_引物名)" = "combined_default",
"自定义正则" = "custom"
),
selected = "combined_default"
),
textInput("rename_pattern", "正则表达式", value = ""),
textInput("rename_replacement", "替换为", value = ""),
selectInput("saved_regex", "已保存正则规则", choices = c("请选择已保存正则规则" = "")),
textInput("regex_preset_name", "规则名称", value = ""),
actionButton("save_regex", "保存正则规则"),
actionButton("delete_regex", "删除选中规则"),
textInput("download_tag", "Tag名称", value = ""),
actionButton("preview_rename", "预览改名结果"),
helpText("8个文件处理时间为90秒,文件越多时间越久,耐心等待"),
fileInput("ab1_files", "上传 AB1 文件", multiple = TRUE, accept = ".ab1"), # 文件上传按钮
actionButton("process", "处理数据") # 处理数据按钮
),
mainPanel(
width = 9,
textOutput("status"), # 状态信息
verbatimTextOutput("task_progress"), # 当前任务进度
tabsetPanel(
tabPanel(
"分析概览",
div(
class = "section-header",
h4("摘要"),
downloadButton("download", "下载结果包(Excel + 图表)")
),
helpText("Target_Position_Edit_Rate: 手动指定重点位点的预期编辑率。Top_Position_Edit_Rate: 最高编辑位点的预期编辑率。Non_Target_Edit_Rate_at_Top_Position: 历史字段,表示最高位点总非参考碱基比例(包含预期编辑);非预期替换率与编辑产物纯度见对应新字段。"),
div(class = "table-wrap", tableOutput("summary")),
h4("图表"),
uiOutput("summary_plot_ui"),
selectInput("sample_plot_name", "单样本图选择", choices = c("请选择样本" = "")),
plotOutput("sample_position_plot", height = "340px"),
plotOutput("heatmap_plot", height = "460px")
),
tabPanel(
"文件名预览",
div(class = "table-wrap", tableOutput("rename_preview")),
downloadButton("download_renamed_ab1", "下载重命名AB1")
)
)
)
)
)