jbrowse-plugin-mafviewer 1.0.2 → 1.0.4
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/CHANGELOG.md +3 -0
- package/README.md +183 -0
- package/dist/jbrowse-plugin-mafviewer.umd.development.js +239 -136
- package/dist/jbrowse-plugin-mafviewer.umd.development.js.map +1 -1
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js +1 -1
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js.map +1 -1
- package/package.json +8 -10
- package/src/BigMafAdapter/BigMafAdapter.ts +8 -18
- package/src/LinearMafDisplay/components/ColorLegend.tsx +27 -28
- package/src/LinearMafDisplay/components/ReactComponent.tsx +4 -1
- package/src/LinearMafDisplay/components/SetRowHeight.tsx +76 -0
- package/src/LinearMafDisplay/components/YScaleBars.tsx +7 -3
- package/src/LinearMafDisplay/configSchema.ts +2 -3
- package/src/LinearMafDisplay/renderSvg.tsx +13 -4
- package/src/LinearMafDisplay/stateModel.ts +83 -20
- package/src/LinearMafRenderer/LinearMafRenderer.ts +110 -50
- package/src/LinearMafRenderer/components/ReactComponent.tsx +4 -1
- package/src/MafAddTrackWorkflow/AddTrackWorkflow.tsx +1 -0
- package/src/MafTabixAdapter/MafTabixAdapter.ts +11 -20
package/CHANGELOG.md
ADDED
package/README.md
CHANGED
|
@@ -6,3 +6,186 @@ This is a port of the JBrowse 1 plugin https://github.com/cmdcolin/mafviewer to
|
|
|
6
6
|
JBrowse 2
|
|
7
7
|
|
|
8
8
|

|
|
9
|
+
|
|
10
|
+
## Demo
|
|
11
|
+
|
|
12
|
+
https://jbrowse.org/code/jb2/main/?config=%2Fdemos%2Fmafviewer%2Fhg38%2Fdistconfig.json&session=share-O3sxhB3iS2&password=8Ysiv
|
|
13
|
+
|
|
14
|
+
## GUI usage (e.g. in JBrowse Desktop)
|
|
15
|
+
|
|
16
|
+
This short screenshot workflow shows how you can load your own custom MAF files
|
|
17
|
+
via the GUI
|
|
18
|
+
|
|
19
|
+
First install the plugin via the plugin store
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
Then use the custom "Add track workflow"
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+
## Manual config entry
|
|
28
|
+
|
|
29
|
+
### Add plugin to your jbrowse 2 config.json
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"plugins": [
|
|
34
|
+
{
|
|
35
|
+
"name": "MafViewer",
|
|
36
|
+
"url": "https://unpkg.com/jbrowse-plugin-mafviewer/dist/jbrowse-plugin-mafviewer.umd.production.min.js"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Example MafTabixAdapter config
|
|
43
|
+
|
|
44
|
+
The MafTabix track is created according to
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"type": "MafTrack",
|
|
49
|
+
"trackId": "chrI.bed",
|
|
50
|
+
"name": "chrI.bed",
|
|
51
|
+
"adapter": {
|
|
52
|
+
"type": "MafTabixAdapter",
|
|
53
|
+
"samples": ["ce10", "cb4", "caeSp111", "caeRem4", "caeJap4", "caePb3"],
|
|
54
|
+
"bedGzLocation": {
|
|
55
|
+
"uri": "chrI.bed.gz"
|
|
56
|
+
},
|
|
57
|
+
"index": {
|
|
58
|
+
"location": {
|
|
59
|
+
"uri": "chrI.bed.gz.tbi"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"assemblyNames": ["c_elegans"]
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Example BigMafAdapter config
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"type": "MafTrack",
|
|
72
|
+
"trackId": "bigMaf",
|
|
73
|
+
"name": "bigMaf (chr22_KI270731v1_random)",
|
|
74
|
+
"adapter": {
|
|
75
|
+
"type": "BigMafAdapter",
|
|
76
|
+
"samples": [
|
|
77
|
+
"hg38",
|
|
78
|
+
"panTro4",
|
|
79
|
+
"rheMac3",
|
|
80
|
+
"mm10",
|
|
81
|
+
"rn5",
|
|
82
|
+
"canFam3",
|
|
83
|
+
"monDom5"
|
|
84
|
+
],
|
|
85
|
+
"bigBedLocation": {
|
|
86
|
+
"uri": "bigMaf.bb"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"assemblyNames": ["hg38"]
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Example with customized sample names and colors
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"trackId": "MAF",
|
|
98
|
+
"name": "example",
|
|
99
|
+
"type": "MafTrack",
|
|
100
|
+
"assemblyNames": ["hg38"],
|
|
101
|
+
"adapter": {
|
|
102
|
+
"type": "MafTabixAdapter",
|
|
103
|
+
"bedGzLocation": {
|
|
104
|
+
"uri": "data.txt.gz"
|
|
105
|
+
},
|
|
106
|
+
"index": {
|
|
107
|
+
"location": {
|
|
108
|
+
"uri": "data.txt.gz.tbi"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"samples": [
|
|
112
|
+
{
|
|
113
|
+
"id": "hg38",
|
|
114
|
+
"label": "Human",
|
|
115
|
+
"color": "rgba(255,255,255,0.7)"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"id": "panTro4",
|
|
119
|
+
"label": "Chimp",
|
|
120
|
+
"color": "rgba(255,0,0,0.7)"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"id": "gorGor3",
|
|
124
|
+
"label": "Gorilla",
|
|
125
|
+
"color": "rgba(0,0,255,0.7)"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"id": "ponAbe2",
|
|
129
|
+
"label": "Orangutan",
|
|
130
|
+
"color": "rgba(255,255,255,0.7)"
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The samples array is either `string[]|{id:string,label:string,color?:string}[]`
|
|
138
|
+
|
|
139
|
+
## Prepare data
|
|
140
|
+
|
|
141
|
+
This is the same as the jbrowse 1 mafviewer plugin (currently the similar to
|
|
142
|
+
the). This plugin supports two formats
|
|
143
|
+
|
|
144
|
+
1. BigMaf format, which can be created following UCSC guidelines
|
|
145
|
+
|
|
146
|
+
2. MAF tabix based format, based on a custom BED created via conversion tools in
|
|
147
|
+
this repo.
|
|
148
|
+
|
|
149
|
+
The choice between the two is your convenience. BigMaf is a "standard" UCSC
|
|
150
|
+
format, basically just a specialized BigBed, so it requires JBrowse 1.14.0 or
|
|
151
|
+
newer for it's BigBed support. The custom BED format only requires JBrowse
|
|
152
|
+
1.12.3 or newer, so therefore some slightly older JBrowse versions can support
|
|
153
|
+
it.
|
|
154
|
+
|
|
155
|
+
_Note: Both formats start with a MAF as input, and note that your MAF file
|
|
156
|
+
should contain the species name and chromosome name e.g. hg38.chr1 in the
|
|
157
|
+
sequence identifiers._
|
|
158
|
+
|
|
159
|
+
### Preparing BigMaf
|
|
160
|
+
|
|
161
|
+
Follow instructions from https://genome.ucsc.edu/FAQ/FAQformat.html#format9.3
|
|
162
|
+
and set the storeType of your track as MAFViewer/Store/SeqFeature/BigMaf
|
|
163
|
+
|
|
164
|
+
### Preparing the tabix BED format
|
|
165
|
+
|
|
166
|
+
Start by converting the MAF into a pseudo-BED format using the maf2bed tool
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# from https://github.com/cmdcolin/maf2bed
|
|
170
|
+
cargo install maf2bed
|
|
171
|
+
cat file.maf | maf2bed hg38 | bgzip > out.bed
|
|
172
|
+
tabix -p bed out.bed.gz
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
The second argument to maf2bed is the genome version e.g. hg38 used for the main
|
|
176
|
+
species in the MAF (if your MAF comes from a pipeline like Ensembl or UCSC, the
|
|
177
|
+
identifiers in the MAF file will say something like hg38.chr1, therefore, the
|
|
178
|
+
argument to maf2bed should just be hg38 to remove hg38 part of the identifier.
|
|
179
|
+
if your MAF file does not include the species name as part of the identifier,
|
|
180
|
+
you should add the species into them the those scaffold/chromosome e.g. create
|
|
181
|
+
hg38.chr1 if it was just chr1 before)
|
|
182
|
+
|
|
183
|
+
If all is well, your BED file should have 6 columns, with
|
|
184
|
+
`chr, start, end, id, score, alignment_data`, where `alignment_data` is
|
|
185
|
+
separated between each species by `;` and each field in the alignment is
|
|
186
|
+
separated by `:`.
|
|
187
|
+
|
|
188
|
+
### Footnote
|
|
189
|
+
|
|
190
|
+
If you can't use the `cargo install maf2bed` binary, there is a `bin/maf2bed.pl`
|
|
191
|
+
perl version of it in this repo
|