@gene-code/rehype 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# gene-code Rehype plugin
|
|
2
|
+
|
|
3
|
+
This is a rehype plugin that enables the mermaid-like diagram code visualizations.
|
|
4
|
+
|
|
5
|
+
Just use `gene-code` as lang parameter on a code block, followed by diagram description:
|
|
6
|
+
|
|
7
|
+
````
|
|
8
|
+
```gene-code
|
|
9
|
+
geneDiagram
|
|
10
|
+
gene KRAS
|
|
11
|
+
length 189
|
|
12
|
+
domain 5 166 GTPase
|
|
13
|
+
domain 167 185 HVR
|
|
14
|
+
variant G12D 12 missense
|
|
15
|
+
variant G12V 12 missense
|
|
16
|
+
variant G12C 12 missense
|
|
17
|
+
variant G12A 12 missense
|
|
18
|
+
variant G12S 12 missense
|
|
19
|
+
variant G12R 12 missense
|
|
20
|
+
variant G13D 13 missense
|
|
21
|
+
variant G13C 13 missense
|
|
22
|
+
variant V14I 14 missense
|
|
23
|
+
variant L19F 19 missense
|
|
24
|
+
variant Q22K 22 missense
|
|
25
|
+
variant T35fs 35 frameshift
|
|
26
|
+
````
|
|
27
|
+
|
|
28
|
+
Currently supports two types of diagrams:
|
|
29
|
+
|
|
30
|
+
- Lollipop variants diagram: `geneDiagram`
|
|
31
|
+
- Pedigree diagram: `pedigreeDiagram`
|
|
32
|
+
|
|
33
|
+
## Lollipop variants diagram: `geneDiagram`
|
|
34
|
+
|
|
35
|
+
The syntax:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
geneDiagram <-- diagram type
|
|
39
|
+
gene KRAS <-- label of the gene
|
|
40
|
+
length 189 <-- length
|
|
41
|
+
domain 5 166 GTPase <-- protein domain start, end and label
|
|
42
|
+
domain 167 185 HVR
|
|
43
|
+
variant G12D 12 missense <-- variant label, pos ans class
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Pedigree diagram: `pedigreeDiagram`
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
pedigreeDiagram
|
|
50
|
+
node gf male unaffected noncarrier <-- node/individual's ID, sex, phenotype, genotype
|
|
51
|
+
node gm female unaffected carrier
|
|
52
|
+
couple gf gm <-- parents node IDs
|
|
53
|
+
node uncle male unknown unknown gf-gm
|
|
54
|
+
node dad male unaffected carrier gf-gm
|
|
55
|
+
node mom female unaffected carrier
|
|
56
|
+
couple dad mom
|
|
57
|
+
node childless_a male unaffected noncarrier gf-gm
|
|
58
|
+
node childless_b female unaffected unknown
|
|
59
|
+
couple childless_a childless_b
|
|
60
|
+
node son male affected carrier dad-mom
|
|
61
|
+
node daughter female unaffected carrier dad-mom
|
|
62
|
+
node baby male unaffected noncarrier dad-mom
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
# Usage in markdown
|
|
66
|
+
|
|
67
|
+
Use as any other rehype plugins.
|
|
68
|
+
See the `example-react` package for basic example.
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
// App.tsx
|
|
72
|
+
|
|
73
|
+
import rehypeGeneCode from "@gene-code/rehype";
|
|
74
|
+
import remarkGfm from "remark-gfm";
|
|
75
|
+
import Markdown from "react-markdown";
|
|
76
|
+
|
|
77
|
+
//... in a component
|
|
78
|
+
<Markdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeGeneCode]}>
|
|
79
|
+
{text}
|
|
80
|
+
</Markdown>;
|
|
81
|
+
```
|