-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsa.qmd
76 lines (64 loc) · 1.8 KB
/
msa.qmd
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
---
title: "Alignments"
---
```{r}
# Prepare data for filtering
library(tidyverse)
redundant <-
'data/L_redundant.tsv' |>
read_tsv() |>
select(motif = redundant) |>
unique()
motif <-
'data/potentially-novel-motifs.tsv' |>
read_tsv() |>
anti_join(redundant, 'motif')
motif %>%
mutate_at('motif', str_remove, '\\.fna\\.motif') |>
pull(motif) %>%
unique %>%
sort -> motifs_list
ojs_define(motifs_list = motifs_list)
```
::: {style="display: none;"}
```{ojs}
//Check GET variable `candidate` for what motif to choose, otherwise default to first one
para = window.location.href.match(/(?<=candidate=)(.*?)[^&]+/)
sv = {
if ( para !== null ) {
if ( motifs_list.includes(para[0]) ) {
return para[0]
}
}
return motifs_list[0]
}
```
:::
```{ojs}
infoHelper = function(x, lab, txt) {
// The element to show
let res = html`${lab} <span class='myInfo' id='${x}'>ⓘ</span>`
// Add tippy tooltip
// Iusse: add with delay, otherwise the span was not yet displayed
setTimeout(function() {
tippy('#' + x, {
content: txt
})
}, 500)
return(res)
}
// Choose a single motif
viewof sel = Inputs.select(
motifs_list,
{
label: 'Alignment for',
value: sv
}
)
html`Download alignment as <a href="https://rth.dk/resources/crs/cyanobacteria/data/motifs/${sel}.sto">Stockholm</a> | <a href="https://rth.dk/resources/crs/cyanobacteria/data/motifs-fasta/${sel}.fasta">Fasta</a> | <a href="https://rth.dk/resources/crs/cyanobacteria/data/jalview/${sel}.svg">Figure</a>`
html`<a href="https://rth.dk/resources/crs/cyanobacteria/candidate.html?candidate=${sel}">View CRS details</a>`
```
```{ojs}
html`<center><img src="https://rth.dk/resources/crs/cyanobacteria/data/jalview/${sel}.svg" class = 'jalview'/></center>`
```
Visualization made with [Jalview](https://www.jalview.org/).