@jbrowse/plugin-alignments 2.2.2 → 2.3.1

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.
Files changed (308) hide show
  1. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +1 -1
  2. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js.map +1 -1
  3. package/dist/AlignmentsTrack/index.js +1 -0
  4. package/dist/AlignmentsTrack/index.js.map +1 -1
  5. package/dist/BamAdapter/BamSlightlyLazyFeature.d.ts +3 -4
  6. package/dist/BamAdapter/BamSlightlyLazyFeature.js +11 -18
  7. package/dist/BamAdapter/BamSlightlyLazyFeature.js.map +1 -1
  8. package/dist/BamAdapter/index.js +1 -0
  9. package/dist/BamAdapter/index.js.map +1 -1
  10. package/dist/CramAdapter/CramSlightlyLazyFeature.d.ts +5 -7
  11. package/dist/CramAdapter/CramSlightlyLazyFeature.js +6 -8
  12. package/dist/CramAdapter/CramSlightlyLazyFeature.js.map +1 -1
  13. package/dist/CramAdapter/index.js +1 -0
  14. package/dist/CramAdapter/index.js.map +1 -1
  15. package/dist/GuessAlignmentsTypes/index.d.ts +3 -0
  16. package/dist/GuessAlignmentsTypes/index.js +56 -0
  17. package/dist/GuessAlignmentsTypes/index.js.map +1 -0
  18. package/dist/HtsgetBamAdapter/index.js +11 -11
  19. package/dist/HtsgetBamAdapter/index.js.map +1 -1
  20. package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +10 -13
  21. package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.js.map +1 -1
  22. package/dist/LinearAlignmentsDisplay/index.js +1 -0
  23. package/dist/LinearAlignmentsDisplay/index.js.map +1 -1
  24. package/dist/LinearAlignmentsDisplay/models/configSchema.d.ts +6 -3
  25. package/dist/LinearAlignmentsDisplay/models/configSchema.js +2 -3
  26. package/dist/LinearAlignmentsDisplay/models/configSchema.js.map +1 -1
  27. package/dist/LinearAlignmentsDisplay/models/model.d.ts +22 -36
  28. package/dist/LinearAlignmentsDisplay/models/model.js +166 -151
  29. package/dist/LinearAlignmentsDisplay/models/model.js.map +1 -1
  30. package/dist/LinearPileupDisplay/components/SetFeatureHeight.d.ts +2 -2
  31. package/dist/LinearPileupDisplay/components/SetFeatureHeight.js +2 -4
  32. package/dist/LinearPileupDisplay/components/SetFeatureHeight.js.map +1 -1
  33. package/dist/LinearPileupDisplay/configSchema.d.ts +0 -3
  34. package/dist/LinearPileupDisplay/configSchema.js.map +1 -1
  35. package/dist/LinearPileupDisplay/index.js +2 -0
  36. package/dist/LinearPileupDisplay/index.js.map +1 -1
  37. package/dist/LinearPileupDisplay/model.d.ts +19 -16
  38. package/dist/LinearPileupDisplay/model.js +28 -13
  39. package/dist/LinearPileupDisplay/model.js.map +1 -1
  40. package/dist/LinearReadArcsDisplay/components/ReactComponent.d.ts +6 -0
  41. package/dist/LinearReadArcsDisplay/components/ReactComponent.js +49 -0
  42. package/dist/LinearReadArcsDisplay/components/ReactComponent.js.map +1 -0
  43. package/dist/LinearReadArcsDisplay/configSchema.d.ts +6 -0
  44. package/dist/LinearReadArcsDisplay/configSchema.js +52 -0
  45. package/dist/LinearReadArcsDisplay/configSchema.js.map +1 -0
  46. package/dist/LinearReadArcsDisplay/drawFeats.d.ts +14 -0
  47. package/dist/LinearReadArcsDisplay/drawFeats.js +162 -0
  48. package/dist/LinearReadArcsDisplay/drawFeats.js.map +1 -0
  49. package/dist/LinearReadArcsDisplay/index.d.ts +2 -0
  50. package/dist/LinearReadArcsDisplay/index.js +27 -0
  51. package/dist/LinearReadArcsDisplay/index.js.map +1 -0
  52. package/dist/LinearReadArcsDisplay/model.d.ts +342 -0
  53. package/dist/LinearReadArcsDisplay/model.js +327 -0
  54. package/dist/LinearReadArcsDisplay/model.js.map +1 -0
  55. package/dist/LinearReadCloudDisplay/components/ReactComponent.d.ts +6 -0
  56. package/dist/LinearReadCloudDisplay/components/ReactComponent.js +49 -0
  57. package/dist/LinearReadCloudDisplay/components/ReactComponent.js.map +1 -0
  58. package/dist/LinearReadCloudDisplay/configSchema.d.ts +6 -0
  59. package/dist/LinearReadCloudDisplay/configSchema.js +51 -0
  60. package/dist/LinearReadCloudDisplay/configSchema.js.map +1 -0
  61. package/dist/LinearReadCloudDisplay/drawFeats.d.ts +10 -0
  62. package/dist/LinearReadCloudDisplay/drawFeats.js +159 -0
  63. package/dist/LinearReadCloudDisplay/drawFeats.js.map +1 -0
  64. package/dist/LinearReadCloudDisplay/index.d.ts +2 -0
  65. package/dist/LinearReadCloudDisplay/index.js +27 -0
  66. package/dist/LinearReadCloudDisplay/index.js.map +1 -0
  67. package/dist/LinearReadCloudDisplay/model.d.ts +320 -0
  68. package/dist/LinearReadCloudDisplay/model.js +252 -0
  69. package/dist/LinearReadCloudDisplay/model.js.map +1 -0
  70. package/dist/LinearSNPCoverageDisplay/index.js +1 -0
  71. package/dist/LinearSNPCoverageDisplay/index.js.map +1 -1
  72. package/dist/LinearSNPCoverageDisplay/models/model.d.ts +19 -20
  73. package/dist/LinearSNPCoverageDisplay/models/model.js +1 -6
  74. package/dist/LinearSNPCoverageDisplay/models/model.js.map +1 -1
  75. package/dist/{BamAdapter/MismatchParser.d.ts → MismatchParser/index.d.ts} +23 -0
  76. package/dist/{BamAdapter/MismatchParser.js → MismatchParser/index.js} +116 -3
  77. package/dist/MismatchParser/index.js.map +1 -0
  78. package/dist/PileupRPC/base.d.ts +8 -0
  79. package/dist/PileupRPC/base.js +22 -0
  80. package/dist/PileupRPC/base.js.map +1 -0
  81. package/dist/PileupRPC/index.d.ts +3 -0
  82. package/dist/PileupRPC/index.js +9 -0
  83. package/dist/PileupRPC/index.js.map +1 -0
  84. package/dist/PileupRPC/methods/GetGlobalValueForTag.d.ts +14 -0
  85. package/dist/PileupRPC/methods/GetGlobalValueForTag.js +29 -0
  86. package/dist/PileupRPC/methods/GetGlobalValueForTag.js.map +1 -0
  87. package/dist/PileupRPC/methods/GetReducedFeatures.d.ts +25 -0
  88. package/dist/PileupRPC/methods/GetReducedFeatures.js +61 -0
  89. package/dist/PileupRPC/methods/GetReducedFeatures.js.map +1 -0
  90. package/dist/PileupRPC/methods/GetVisibleModifications.d.ts +14 -0
  91. package/dist/PileupRPC/methods/GetVisibleModifications.js +32 -0
  92. package/dist/PileupRPC/methods/GetVisibleModifications.js.map +1 -0
  93. package/dist/PileupRPC/rpcMethods.d.ts +4 -34
  94. package/dist/PileupRPC/rpcMethods.js +7 -77
  95. package/dist/PileupRPC/rpcMethods.js.map +1 -1
  96. package/dist/PileupRPC/util.d.ts +8 -0
  97. package/dist/PileupRPC/util.js +20 -0
  98. package/dist/PileupRPC/util.js.map +1 -0
  99. package/dist/PileupRenderer/PileupRenderer.d.ts +1 -1
  100. package/dist/PileupRenderer/PileupRenderer.js +5 -5
  101. package/dist/PileupRenderer/PileupRenderer.js.map +1 -1
  102. package/dist/PileupRenderer/index.js +1 -0
  103. package/dist/PileupRenderer/index.js.map +1 -1
  104. package/dist/PileupRenderer/sortUtil.d.ts +1 -1
  105. package/dist/PileupRenderer/sortUtil.js +2 -2
  106. package/dist/PileupRenderer/sortUtil.js.map +1 -1
  107. package/dist/SNPCoverageAdapter/generateCoverageBins.js +1 -1
  108. package/dist/SNPCoverageAdapter/generateCoverageBins.js.map +1 -1
  109. package/dist/SNPCoverageAdapter/index.js +1 -3
  110. package/dist/SNPCoverageAdapter/index.js.map +1 -1
  111. package/dist/index.d.ts +2 -2
  112. package/dist/index.js +12 -58
  113. package/dist/index.js.map +1 -1
  114. package/dist/{LinearPileupDisplay/components → shared}/FilterByTag.d.ts +0 -0
  115. package/dist/{LinearPileupDisplay/components → shared}/FilterByTag.js +3 -9
  116. package/dist/shared/FilterByTag.js.map +1 -0
  117. package/dist/shared/color.d.ts +17 -0
  118. package/dist/shared/color.js +43 -0
  119. package/dist/shared/color.js.map +1 -0
  120. package/dist/shared/fetchChains.d.ts +27 -0
  121. package/dist/shared/fetchChains.js +30 -0
  122. package/dist/shared/fetchChains.js.map +1 -0
  123. package/dist/shared/index.d.ts +36 -0
  124. package/dist/{shared.js → shared/index.js} +12 -2
  125. package/dist/shared/index.js.map +1 -0
  126. package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +1 -1
  127. package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js.map +1 -1
  128. package/esm/AlignmentsTrack/index.js +1 -0
  129. package/esm/AlignmentsTrack/index.js.map +1 -1
  130. package/esm/BamAdapter/BamSlightlyLazyFeature.d.ts +3 -4
  131. package/esm/BamAdapter/BamSlightlyLazyFeature.js +11 -18
  132. package/esm/BamAdapter/BamSlightlyLazyFeature.js.map +1 -1
  133. package/esm/BamAdapter/index.js +1 -0
  134. package/esm/BamAdapter/index.js.map +1 -1
  135. package/esm/CramAdapter/CramSlightlyLazyFeature.d.ts +5 -7
  136. package/esm/CramAdapter/CramSlightlyLazyFeature.js +6 -8
  137. package/esm/CramAdapter/CramSlightlyLazyFeature.js.map +1 -1
  138. package/esm/CramAdapter/index.js +1 -0
  139. package/esm/CramAdapter/index.js.map +1 -1
  140. package/esm/GuessAlignmentsTypes/index.d.ts +3 -0
  141. package/esm/GuessAlignmentsTypes/index.js +54 -0
  142. package/esm/GuessAlignmentsTypes/index.js.map +1 -0
  143. package/esm/HtsgetBamAdapter/index.js +11 -11
  144. package/esm/HtsgetBamAdapter/index.js.map +1 -1
  145. package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +10 -13
  146. package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.js.map +1 -1
  147. package/esm/LinearAlignmentsDisplay/index.js +1 -0
  148. package/esm/LinearAlignmentsDisplay/index.js.map +1 -1
  149. package/esm/LinearAlignmentsDisplay/models/configSchema.d.ts +6 -3
  150. package/esm/LinearAlignmentsDisplay/models/configSchema.js +2 -4
  151. package/esm/LinearAlignmentsDisplay/models/configSchema.js.map +1 -1
  152. package/esm/LinearAlignmentsDisplay/models/model.d.ts +22 -36
  153. package/esm/LinearAlignmentsDisplay/models/model.js +167 -152
  154. package/esm/LinearAlignmentsDisplay/models/model.js.map +1 -1
  155. package/esm/LinearPileupDisplay/components/SetFeatureHeight.d.ts +2 -2
  156. package/esm/LinearPileupDisplay/components/SetFeatureHeight.js +2 -4
  157. package/esm/LinearPileupDisplay/components/SetFeatureHeight.js.map +1 -1
  158. package/esm/LinearPileupDisplay/configSchema.d.ts +0 -3
  159. package/esm/LinearPileupDisplay/configSchema.js.map +1 -1
  160. package/esm/LinearPileupDisplay/index.js +2 -0
  161. package/esm/LinearPileupDisplay/index.js.map +1 -1
  162. package/esm/LinearPileupDisplay/model.d.ts +19 -16
  163. package/esm/LinearPileupDisplay/model.js +29 -14
  164. package/esm/LinearPileupDisplay/model.js.map +1 -1
  165. package/esm/LinearReadArcsDisplay/components/ReactComponent.d.ts +6 -0
  166. package/esm/LinearReadArcsDisplay/components/ReactComponent.js +44 -0
  167. package/esm/LinearReadArcsDisplay/components/ReactComponent.js.map +1 -0
  168. package/esm/LinearReadArcsDisplay/configSchema.d.ts +6 -0
  169. package/esm/LinearReadArcsDisplay/configSchema.js +50 -0
  170. package/esm/LinearReadArcsDisplay/configSchema.js.map +1 -0
  171. package/esm/LinearReadArcsDisplay/drawFeats.d.ts +14 -0
  172. package/esm/LinearReadArcsDisplay/drawFeats.js +157 -0
  173. package/esm/LinearReadArcsDisplay/drawFeats.js.map +1 -0
  174. package/esm/LinearReadArcsDisplay/index.d.ts +2 -0
  175. package/esm/LinearReadArcsDisplay/index.js +21 -0
  176. package/esm/LinearReadArcsDisplay/index.js.map +1 -0
  177. package/esm/LinearReadArcsDisplay/model.d.ts +342 -0
  178. package/esm/LinearReadArcsDisplay/model.js +299 -0
  179. package/esm/LinearReadArcsDisplay/model.js.map +1 -0
  180. package/esm/LinearReadCloudDisplay/components/ReactComponent.d.ts +6 -0
  181. package/esm/LinearReadCloudDisplay/components/ReactComponent.js +44 -0
  182. package/esm/LinearReadCloudDisplay/components/ReactComponent.js.map +1 -0
  183. package/esm/LinearReadCloudDisplay/configSchema.d.ts +6 -0
  184. package/esm/LinearReadCloudDisplay/configSchema.js +49 -0
  185. package/esm/LinearReadCloudDisplay/configSchema.js.map +1 -0
  186. package/esm/LinearReadCloudDisplay/drawFeats.d.ts +10 -0
  187. package/esm/LinearReadCloudDisplay/drawFeats.js +156 -0
  188. package/esm/LinearReadCloudDisplay/drawFeats.js.map +1 -0
  189. package/esm/LinearReadCloudDisplay/index.d.ts +2 -0
  190. package/esm/LinearReadCloudDisplay/index.js +21 -0
  191. package/esm/LinearReadCloudDisplay/index.js.map +1 -0
  192. package/esm/LinearReadCloudDisplay/model.d.ts +320 -0
  193. package/esm/LinearReadCloudDisplay/model.js +224 -0
  194. package/esm/LinearReadCloudDisplay/model.js.map +1 -0
  195. package/esm/LinearSNPCoverageDisplay/index.js +1 -0
  196. package/esm/LinearSNPCoverageDisplay/index.js.map +1 -1
  197. package/esm/LinearSNPCoverageDisplay/models/model.d.ts +19 -20
  198. package/esm/LinearSNPCoverageDisplay/models/model.js +2 -7
  199. package/esm/LinearSNPCoverageDisplay/models/model.js.map +1 -1
  200. package/esm/{BamAdapter/MismatchParser.d.ts → MismatchParser/index.d.ts} +23 -0
  201. package/esm/{BamAdapter/MismatchParser.js → MismatchParser/index.js} +107 -2
  202. package/esm/MismatchParser/index.js.map +1 -0
  203. package/esm/PileupRPC/base.d.ts +8 -0
  204. package/esm/PileupRPC/base.js +16 -0
  205. package/esm/PileupRPC/base.js.map +1 -0
  206. package/esm/PileupRPC/index.d.ts +3 -0
  207. package/esm/PileupRPC/index.js +7 -0
  208. package/esm/PileupRPC/index.js.map +1 -0
  209. package/esm/PileupRPC/methods/GetGlobalValueForTag.d.ts +14 -0
  210. package/esm/PileupRPC/methods/GetGlobalValueForTag.js +23 -0
  211. package/esm/PileupRPC/methods/GetGlobalValueForTag.js.map +1 -0
  212. package/esm/PileupRPC/methods/GetReducedFeatures.d.ts +25 -0
  213. package/esm/PileupRPC/methods/GetReducedFeatures.js +55 -0
  214. package/esm/PileupRPC/methods/GetReducedFeatures.js.map +1 -0
  215. package/esm/PileupRPC/methods/GetVisibleModifications.d.ts +14 -0
  216. package/esm/PileupRPC/methods/GetVisibleModifications.js +26 -0
  217. package/esm/PileupRPC/methods/GetVisibleModifications.js.map +1 -0
  218. package/esm/PileupRPC/rpcMethods.d.ts +4 -34
  219. package/esm/PileupRPC/rpcMethods.js +4 -74
  220. package/esm/PileupRPC/rpcMethods.js.map +1 -1
  221. package/esm/PileupRPC/util.d.ts +8 -0
  222. package/esm/PileupRPC/util.js +15 -0
  223. package/esm/PileupRPC/util.js.map +1 -0
  224. package/esm/PileupRenderer/PileupRenderer.d.ts +1 -1
  225. package/esm/PileupRenderer/PileupRenderer.js +5 -5
  226. package/esm/PileupRenderer/PileupRenderer.js.map +1 -1
  227. package/esm/PileupRenderer/index.js +1 -0
  228. package/esm/PileupRenderer/index.js.map +1 -1
  229. package/esm/PileupRenderer/sortUtil.d.ts +1 -1
  230. package/esm/PileupRenderer/sortUtil.js +1 -1
  231. package/esm/PileupRenderer/sortUtil.js.map +1 -1
  232. package/esm/SNPCoverageAdapter/generateCoverageBins.js +1 -1
  233. package/esm/SNPCoverageAdapter/generateCoverageBins.js.map +1 -1
  234. package/esm/SNPCoverageAdapter/index.js +1 -3
  235. package/esm/SNPCoverageAdapter/index.js.map +1 -1
  236. package/esm/index.d.ts +2 -2
  237. package/esm/index.js +10 -56
  238. package/esm/index.js.map +1 -1
  239. package/esm/{LinearPileupDisplay/components → shared}/FilterByTag.d.ts +0 -0
  240. package/esm/{LinearPileupDisplay/components → shared}/FilterByTag.js +3 -9
  241. package/esm/shared/FilterByTag.js.map +1 -0
  242. package/esm/shared/color.d.ts +17 -0
  243. package/esm/shared/color.js +37 -0
  244. package/esm/shared/color.js.map +1 -0
  245. package/esm/shared/fetchChains.d.ts +27 -0
  246. package/esm/shared/fetchChains.js +26 -0
  247. package/esm/shared/fetchChains.js.map +1 -0
  248. package/esm/shared/index.d.ts +36 -0
  249. package/esm/{shared.js → shared/index.js} +11 -1
  250. package/esm/shared/index.js.map +1 -0
  251. package/package.json +4 -4
  252. package/src/AlignmentsFeatureDetail/AlignmentsFeatureDetail.tsx +1 -1
  253. package/src/AlignmentsTrack/index.ts +1 -0
  254. package/src/BamAdapter/BamSlightlyLazyFeature.ts +13 -19
  255. package/src/BamAdapter/index.ts +1 -0
  256. package/src/CramAdapter/CramSlightlyLazyFeature.ts +13 -15
  257. package/src/CramAdapter/__snapshots__/CramAdapter.test.ts.snap +0 -10
  258. package/src/CramAdapter/index.ts +1 -0
  259. package/src/GuessAlignmentsTypes/index.ts +79 -0
  260. package/src/HtsgetBamAdapter/index.ts +11 -15
  261. package/src/LinearAlignmentsDisplay/components/AlignmentsDisplay.tsx +21 -29
  262. package/src/LinearAlignmentsDisplay/index.ts +1 -0
  263. package/src/LinearAlignmentsDisplay/models/configSchema.ts +2 -6
  264. package/src/LinearAlignmentsDisplay/models/model.tsx +238 -199
  265. package/src/LinearPileupDisplay/components/SetFeatureHeight.tsx +4 -6
  266. package/src/LinearPileupDisplay/configSchema.ts +1 -3
  267. package/src/LinearPileupDisplay/index.ts +2 -0
  268. package/src/LinearPileupDisplay/model.ts +36 -23
  269. package/src/LinearReadArcsDisplay/components/ReactComponent.tsx +86 -0
  270. package/src/LinearReadArcsDisplay/configSchema.ts +58 -0
  271. package/src/LinearReadArcsDisplay/declare.d.ts +1 -0
  272. package/src/LinearReadArcsDisplay/drawFeats.ts +199 -0
  273. package/src/LinearReadArcsDisplay/index.ts +23 -0
  274. package/src/LinearReadArcsDisplay/model.tsx +370 -0
  275. package/src/LinearReadCloudDisplay/components/ReactComponent.tsx +86 -0
  276. package/src/LinearReadCloudDisplay/configSchema.ts +57 -0
  277. package/src/LinearReadCloudDisplay/drawFeats.ts +201 -0
  278. package/src/LinearReadCloudDisplay/index.ts +23 -0
  279. package/src/LinearReadCloudDisplay/model.tsx +289 -0
  280. package/src/LinearSNPCoverageDisplay/index.ts +1 -0
  281. package/src/LinearSNPCoverageDisplay/models/model.ts +3 -13
  282. package/src/{BamAdapter/MismatchParser.test.ts → MismatchParser/index.test.ts} +1 -1
  283. package/src/{BamAdapter/MismatchParser.ts → MismatchParser/index.ts} +129 -2
  284. package/src/PileupRPC/base.ts +24 -0
  285. package/src/PileupRPC/index.ts +12 -0
  286. package/src/PileupRPC/methods/GetGlobalValueForTag.ts +41 -0
  287. package/src/PileupRPC/methods/GetReducedFeatures.ts +76 -0
  288. package/src/PileupRPC/methods/GetVisibleModifications.ts +45 -0
  289. package/src/PileupRPC/rpcMethods.ts +8 -113
  290. package/src/PileupRPC/util.ts +19 -0
  291. package/src/PileupRenderer/PileupRenderer.ts +5 -8
  292. package/src/PileupRenderer/index.ts +1 -0
  293. package/src/PileupRenderer/sortUtil.ts +2 -3
  294. package/src/SNPCoverageAdapter/generateCoverageBins.ts +1 -1
  295. package/src/SNPCoverageAdapter/index.ts +1 -3
  296. package/src/index.ts +12 -93
  297. package/src/{LinearPileupDisplay/components → shared}/FilterByTag.tsx +3 -9
  298. package/src/shared/color.ts +47 -0
  299. package/src/shared/fetchChains.ts +63 -0
  300. package/src/{shared.ts → shared/index.ts} +17 -4
  301. package/dist/BamAdapter/MismatchParser.js.map +0 -1
  302. package/dist/LinearPileupDisplay/components/FilterByTag.js.map +0 -1
  303. package/dist/shared.d.ts +0 -25
  304. package/dist/shared.js.map +0 -1
  305. package/esm/BamAdapter/MismatchParser.js.map +0 -1
  306. package/esm/LinearPileupDisplay/components/FilterByTag.js.map +0 -1
  307. package/esm/shared.d.ts +0 -25
  308. package/esm/shared.js.map +0 -1
@@ -0,0 +1,86 @@
1
+ import React from 'react'
2
+ import { isAlive } from 'mobx-state-tree'
3
+ import { makeStyles } from 'tss-react/mui'
4
+ import { observer } from 'mobx-react'
5
+ import { getContainingView } from '@jbrowse/core/util'
6
+ import { LoadingEllipses } from '@jbrowse/core/ui'
7
+ import {
8
+ BlockMsg,
9
+ LinearGenomeViewModel,
10
+ } from '@jbrowse/plugin-linear-genome-view'
11
+
12
+ // local
13
+ import { LinearReadArcsDisplayModel } from '../model'
14
+
15
+ type LGV = LinearGenomeViewModel
16
+
17
+ const useStyles = makeStyles()(theme => ({
18
+ loading: {
19
+ paddingLeft: '0.6em',
20
+ backgroundColor: theme.palette.action.disabledBackground,
21
+ backgroundImage:
22
+ 'repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255,255,255,.5) 5px, rgba(255,255,255,.5) 10px)',
23
+ height: '100%',
24
+ width: '100%',
25
+ pointerEvents: 'none',
26
+ textAlign: 'center',
27
+ },
28
+ }))
29
+
30
+ const Arcs = observer(function ({
31
+ model,
32
+ }: {
33
+ model: LinearReadArcsDisplayModel
34
+ }) {
35
+ const view = getContainingView(model) as LGV
36
+ return (
37
+ <canvas
38
+ data-testid={`Arc-display-${model.drawn}`}
39
+ ref={ref => {
40
+ if (isAlive(model)) {
41
+ model.setRef(ref)
42
+ }
43
+ }}
44
+ style={{
45
+ position: 'absolute',
46
+ left: -view.offsetPx + model.lastDrawnOffsetPx,
47
+ width: view.dynamicBlocks.totalWidthPx,
48
+ height: model.height,
49
+ }}
50
+ width={view.dynamicBlocks.totalWidthPx * 2}
51
+ height={model.height * 2}
52
+ />
53
+ )
54
+ })
55
+
56
+ export default observer(function ({
57
+ model,
58
+ }: {
59
+ model: LinearReadArcsDisplayModel
60
+ }) {
61
+ const view = getContainingView(model)
62
+ const { classes } = useStyles()
63
+ const err = model.error
64
+ return err ? (
65
+ <BlockMsg
66
+ message={`${err}`}
67
+ severity="error"
68
+ buttonText={'Reload'}
69
+ action={model.reload}
70
+ />
71
+ ) : model.loading ? (
72
+ <div
73
+ className={classes.loading}
74
+ style={{
75
+ width: view.dynamicBlocks.totalWidthPx,
76
+ height: 20,
77
+ position: 'absolute',
78
+ left: Math.max(0, -view.offsetPx),
79
+ }}
80
+ >
81
+ <LoadingEllipses message={model.message} />
82
+ </div>
83
+ ) : (
84
+ <Arcs model={model} />
85
+ )
86
+ })
@@ -0,0 +1,58 @@
1
+ import PluginManager from '@jbrowse/core/PluginManager'
2
+ import { ConfigurationSchema } from '@jbrowse/core/configuration'
3
+ import { linearBasicDisplayConfigSchemaFactory } from '@jbrowse/plugin-linear-genome-view'
4
+ import { types } from 'mobx-state-tree'
5
+
6
+ /**
7
+ * #config LinearReadArcsDisplay
8
+ */
9
+ function configSchemaF(pluginManager: PluginManager) {
10
+ return ConfigurationSchema(
11
+ 'LinearReadArcsDisplay',
12
+ {
13
+ /**
14
+ * #slot
15
+ */
16
+ maxFeatureScreenDensity: {
17
+ type: 'number',
18
+ description: 'maximum features per pixel that is displayed in the view',
19
+ defaultValue: 5,
20
+ },
21
+
22
+ /**
23
+ * #slot
24
+ */
25
+ lineWidth: {
26
+ type: 'number',
27
+ description: 'set arc line width',
28
+ defaultValue: 1,
29
+ },
30
+
31
+ /**
32
+ * #slot
33
+ */
34
+ colorScheme: {
35
+ type: 'stringEnum',
36
+ model: types.enumeration('colorScheme', [
37
+ 'strand',
38
+ 'normal',
39
+ 'insertSize',
40
+ 'insertSizeAndOrientation',
41
+ 'mappingQuality',
42
+ 'tag',
43
+ ]),
44
+ description: 'color scheme to use',
45
+ defaultValue: 'normal',
46
+ },
47
+ },
48
+ {
49
+ /**
50
+ * #baseConfiguration
51
+ */
52
+ baseConfiguration: linearBasicDisplayConfigSchemaFactory(pluginManager),
53
+ explicitlyTyped: true,
54
+ },
55
+ )
56
+ }
57
+
58
+ export default configSchemaF
@@ -0,0 +1 @@
1
+ declare module 'canvas2svg'
@@ -0,0 +1,199 @@
1
+ import { getContainingView, getSession } from '@jbrowse/core/util'
2
+ import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
3
+
4
+ // locals
5
+ import {
6
+ getOrientationColor,
7
+ getInsertSizeColor,
8
+ getInsertSizeAndOrientationColor,
9
+ } from '../shared/color'
10
+ import { ChainData } from '../shared/fetchChains'
11
+ import { featurizeSA } from '../MismatchParser'
12
+
13
+ export function hasPairedReads(features: ChainData) {
14
+ for (const f of features.chains.values()) {
15
+ if (f[0].flags & 1) {
16
+ return true
17
+ }
18
+ }
19
+ return false
20
+ }
21
+
22
+ type LGV = LinearGenomeViewModel
23
+
24
+ export default async function drawFeats(
25
+ self: {
26
+ setLastDrawnOffsetPx: (n: number) => void
27
+ drawInter?: boolean
28
+ drawLongRange?: boolean
29
+ setError: (e: unknown) => void
30
+ colorBy?: { type: string }
31
+ height: number
32
+ chainData?: ChainData
33
+ lineWidthSetting: number
34
+ },
35
+ ctx: CanvasRenderingContext2D,
36
+ ) {
37
+ const { chainData } = self
38
+ if (!chainData) {
39
+ return
40
+ }
41
+ const displayHeight = self.height
42
+ const view = getContainingView(self) as LGV
43
+ const { assemblyManager } = getSession(self)
44
+ self.setLastDrawnOffsetPx(view.offsetPx)
45
+ ctx.lineWidth = self.lineWidthSetting
46
+ const { chains, stats } = chainData
47
+ const hasPaired = hasPairedReads(chainData)
48
+ const assemblyName = view.assemblyNames[0]
49
+ const asm = assemblyManager.get(assemblyName)
50
+ const type = self.colorBy?.type || 'insertSizeAndOrientation'
51
+
52
+ function draw(
53
+ k1: {
54
+ strand: number
55
+ refName: string
56
+ start: number
57
+ end: number
58
+ tlen?: number
59
+ pair_orientation?: string
60
+ },
61
+ k2: { strand: number; refName: string; start: number; end: number },
62
+ longRange?: boolean,
63
+ ) {
64
+ const s1 = k1.strand
65
+ const s2 = k2.strand
66
+ const f1 = s1 === -1
67
+ const f2 = s2 === -1
68
+
69
+ const p1 = f1 ? k1.start : k1.end
70
+ const p2 = hasPaired ? (f2 ? k2.start : k2.end) : f2 ? k2.end : k2.start
71
+
72
+ const r1 = view.bpToPx({ refName: k1.refName, coord: p1 })
73
+ const r2 = view.bpToPx({ refName: k2.refName, coord: p2 })
74
+
75
+ if (r1 && r2) {
76
+ const radius = (r2.offsetPx - r1.offsetPx) / 2
77
+ const absrad = Math.abs(radius)
78
+ const p = r1.offsetPx - view.offsetPx
79
+
80
+ // bezier (used for non-long-range arcs) requires moveTo before beginPath
81
+ // arc (used for long-range) requires moveTo after beginPath (or else a
82
+ // unwanted line at y=0 is rendered along with the arc)
83
+ if (longRange) {
84
+ ctx.moveTo(p, 0)
85
+ ctx.beginPath()
86
+ } else {
87
+ ctx.beginPath()
88
+ ctx.moveTo(p, 0)
89
+ }
90
+
91
+ if (longRange) {
92
+ ctx.strokeStyle = 'red'
93
+ } else {
94
+ if (hasPaired) {
95
+ if (type === 'insertSizeAndOrientation') {
96
+ ctx.strokeStyle = getInsertSizeAndOrientationColor(k1, k2, stats)
97
+ } else if (type === 'orientation') {
98
+ ctx.strokeStyle = getOrientationColor(k1)
99
+ } else if (type === 'insertSize') {
100
+ ctx.strokeStyle = getInsertSizeColor(k1, k2, stats) || 'grey'
101
+ } else if (type === 'gradient') {
102
+ ctx.strokeStyle = `hsl(${
103
+ Math.log10(Math.abs(p1 - p2)) * 10
104
+ },50%,50%)`
105
+ }
106
+ } else {
107
+ if (type === 'orientation' || type === 'insertSizeAndOrientation') {
108
+ if (s1 === -1 && s2 === 1) {
109
+ ctx.strokeStyle = 'navy'
110
+ } else if (s1 === 1 && s2 === -1) {
111
+ ctx.strokeStyle = 'green'
112
+ } else {
113
+ ctx.strokeStyle = 'grey'
114
+ }
115
+ } else if (type === 'gradient') {
116
+ ctx.strokeStyle = `hsl(${
117
+ Math.log10(Math.abs(p1 - p2)) * 10
118
+ },50%,50%)`
119
+ }
120
+ }
121
+ }
122
+
123
+ const destX = p + radius * 2
124
+ const destY = Math.min(displayHeight, absrad)
125
+ if (longRange) {
126
+ ctx.arc(p + radius, 0, absrad, 0, Math.PI)
127
+ } else {
128
+ ctx.bezierCurveTo(p, destY, destX, destY, destX, 0)
129
+ }
130
+ ctx.stroke()
131
+ } else if (r1 && self.drawInter) {
132
+ // draws a vertical line off to middle of nowhere if the second end not found
133
+ const p = r1.offsetPx - view.offsetPx
134
+ ctx.strokeStyle = 'purple'
135
+ ctx.beginPath()
136
+ ctx.moveTo(p, 0)
137
+ ctx.lineTo(p, displayHeight)
138
+ ctx.stroke()
139
+ }
140
+ }
141
+
142
+ for (let i = 0; i < chains.length; i++) {
143
+ let chain = chains[i]
144
+
145
+ if (chain.length === 1 && self.drawLongRange) {
146
+ // singleton feature
147
+ const f = chain[0]
148
+
149
+ // special case where we look at RPOS/RNEXT
150
+ if (hasPaired) {
151
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
152
+ const refName = asm?.getCanonicalRefName(f.next_ref!) || f.next_ref!
153
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
154
+ const coord = f.next_pos!
155
+ draw(
156
+ f,
157
+ {
158
+ refName,
159
+ start: coord,
160
+ end: coord,
161
+ strand: f.strand,
162
+ },
163
+ true,
164
+ )
165
+ }
166
+
167
+ // special case where we look at SA
168
+ else {
169
+ const suppAlns = featurizeSA(f.SA, f.id, f.strand, f.name)
170
+ const features = [f, ...suppAlns].sort((a, b) => a.clipPos - b.clipPos)
171
+ for (let i = 0; i < features.length - 1; i++) {
172
+ const f = features[i]
173
+ const v1 = features[i + 1]
174
+ draw(
175
+ f,
176
+ {
177
+ refName: asm?.getCanonicalRefName(v1.refName) || v1.refName,
178
+ start: v1.start,
179
+ end: v1.end,
180
+ strand: v1.strand,
181
+ },
182
+ true,
183
+ )
184
+ }
185
+ }
186
+ } else {
187
+ if (!hasPaired) {
188
+ chain.sort((a, b) => a.clipPos - b.clipPos)
189
+ chain = chain.filter(f => !(f.flags & 256))
190
+ } else {
191
+ // ignore split/supplementary reads for hasPaired=true for now
192
+ chain = chain.filter(f => !(f.flags & 2048))
193
+ }
194
+ for (let i = 0; i < chain.length - 1; i++) {
195
+ draw(chain[i], chain[i + 1], false)
196
+ }
197
+ }
198
+ }
199
+ }
@@ -0,0 +1,23 @@
1
+ import PluginManager from '@jbrowse/core/PluginManager'
2
+ import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'
3
+
4
+ // locals
5
+ import ReactComponent from './components/ReactComponent'
6
+ import configSchemaF from './configSchema'
7
+ import stateModelF from './model'
8
+
9
+ export default function register(pluginManager: PluginManager) {
10
+ pluginManager.addDisplayType(() => {
11
+ const configSchema = configSchemaF(pluginManager)
12
+ return new DisplayType({
13
+ name: 'LinearReadArcsDisplay',
14
+ displayName: 'Arc display',
15
+ configSchema,
16
+ stateModel: stateModelF(configSchema),
17
+ trackType: 'AlignmentsTrack',
18
+ viewType: 'LinearGenomeView',
19
+ subDisplay: { type: 'LinearAlignmentsDisplay', lowerPanel: true },
20
+ ReactComponent,
21
+ })
22
+ })
23
+ }