@jbrowse/plugin-alignments 2.4.1 → 2.5.0

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 (193) hide show
  1. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.d.ts +4 -5
  2. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +88 -126
  3. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js.map +1 -1
  4. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureFlags.d.ts +5 -0
  5. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureFlags.js +44 -0
  6. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureFlags.js.map +1 -0
  7. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureSuppAligns.d.ts +5 -0
  8. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureSuppAligns.js +37 -0
  9. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureSuppAligns.js.map +1 -0
  10. package/dist/AlignmentsFeatureDetail/index.d.ts +5 -2
  11. package/dist/AlignmentsFeatureDetail/util.d.ts +8 -0
  12. package/dist/AlignmentsFeatureDetail/util.js +27 -0
  13. package/dist/AlignmentsFeatureDetail/util.js.map +1 -0
  14. package/dist/AlignmentsTrack/configSchemaF.d.ts +74 -0
  15. package/dist/AlignmentsTrack/configSchemaF.js +19 -0
  16. package/dist/AlignmentsTrack/configSchemaF.js.map +1 -0
  17. package/dist/AlignmentsTrack/index.js +2 -15
  18. package/dist/AlignmentsTrack/index.js.map +1 -1
  19. package/dist/BamAdapter/BamAdapter.d.ts +1 -1
  20. package/dist/BamAdapter/BamAdapter.js +2 -2
  21. package/dist/BamAdapter/BamAdapter.js.map +1 -1
  22. package/dist/BamAdapter/configSchema.d.ts +50 -1
  23. package/dist/CramAdapter/CramAdapter.d.ts +1 -1
  24. package/dist/CramAdapter/CramAdapter.js +1 -1
  25. package/dist/CramAdapter/CramAdapter.js.map +1 -1
  26. package/dist/CramAdapter/CramTestAdapters.js +2 -2
  27. package/dist/CramAdapter/CramTestAdapters.js.map +1 -1
  28. package/dist/CramAdapter/configSchema.d.ts +40 -1
  29. package/dist/HtsgetBamAdapter/configSchema.d.ts +26 -1
  30. package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.d.ts +0 -1
  31. package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +2 -2
  32. package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.js.map +1 -1
  33. package/dist/LinearAlignmentsDisplay/models/configSchema.d.ts +39 -1
  34. package/dist/LinearAlignmentsDisplay/models/model.d.ts +8 -4
  35. package/dist/LinearAlignmentsDisplay/models/model.js +7 -3
  36. package/dist/LinearAlignmentsDisplay/models/model.js.map +1 -1
  37. package/dist/LinearPileupDisplay/components/ColorByModifications.d.ts +0 -1
  38. package/dist/LinearPileupDisplay/components/ColorByTag.d.ts +0 -1
  39. package/dist/LinearPileupDisplay/components/LinearPileupDisplayBlurb.d.ts +0 -1
  40. package/dist/LinearPileupDisplay/components/SetFeatureHeight.d.ts +0 -1
  41. package/dist/LinearPileupDisplay/components/SetMaxHeight.d.ts +0 -1
  42. package/dist/LinearPileupDisplay/components/SetMaxHeight.js +3 -5
  43. package/dist/LinearPileupDisplay/components/SetMaxHeight.js.map +1 -1
  44. package/dist/LinearPileupDisplay/components/SortByTag.d.ts +0 -1
  45. package/dist/LinearPileupDisplay/configSchema.d.ts +57 -1
  46. package/dist/LinearPileupDisplay/model.d.ts +109 -51
  47. package/dist/LinearPileupDisplay/model.js +21 -24
  48. package/dist/LinearPileupDisplay/model.js.map +1 -1
  49. package/dist/LinearReadArcsDisplay/components/ReactComponent.d.ts +0 -1
  50. package/dist/LinearReadArcsDisplay/configSchema.d.ts +62 -1
  51. package/dist/LinearReadArcsDisplay/drawFeats.js +2 -2
  52. package/dist/LinearReadArcsDisplay/drawFeats.js.map +1 -1
  53. package/dist/LinearReadArcsDisplay/model.d.ts +82 -33
  54. package/dist/LinearReadCloudDisplay/components/ReactComponent.d.ts +0 -1
  55. package/dist/LinearReadCloudDisplay/configSchema.d.ts +50 -1
  56. package/dist/LinearReadCloudDisplay/drawFeats.d.ts +2 -0
  57. package/dist/LinearReadCloudDisplay/drawFeats.js +4 -4
  58. package/dist/LinearReadCloudDisplay/drawFeats.js.map +1 -1
  59. package/dist/LinearReadCloudDisplay/model.d.ts +69 -30
  60. package/dist/LinearSNPCoverageDisplay/components/Tooltip.d.ts +0 -1
  61. package/dist/LinearSNPCoverageDisplay/models/configSchema.d.ts +79 -1
  62. package/dist/LinearSNPCoverageDisplay/models/model.d.ts +52 -27
  63. package/dist/LinearSNPCoverageDisplay/models/model.js +1 -1
  64. package/dist/LinearSNPCoverageDisplay/models/model.js.map +1 -1
  65. package/dist/MismatchParser/index.js +2 -2
  66. package/dist/MismatchParser/index.js.map +1 -1
  67. package/dist/PileupRenderer/PileupLayoutSession.d.ts +1 -1
  68. package/dist/PileupRenderer/PileupRenderer.d.ts +1 -1
  69. package/dist/PileupRenderer/PileupRenderer.js +10 -1
  70. package/dist/PileupRenderer/PileupRenderer.js.map +1 -1
  71. package/dist/PileupRenderer/configSchema.d.ts +87 -1
  72. package/dist/SNPCoverageAdapter/SNPCoverageAdapter.d.ts +1 -1
  73. package/dist/SNPCoverageAdapter/SNPCoverageAdapter.js +2 -2
  74. package/dist/SNPCoverageAdapter/SNPCoverageAdapter.js.map +1 -1
  75. package/dist/SNPCoverageAdapter/configSchema.d.ts +10 -1
  76. package/dist/SNPCoverageAdapter/generateCoverageBins.js +50 -46
  77. package/dist/SNPCoverageAdapter/generateCoverageBins.js.map +1 -1
  78. package/dist/SNPCoverageRenderer/SNPCoverageRenderer.js +1 -1
  79. package/dist/SNPCoverageRenderer/SNPCoverageRenderer.js.map +1 -1
  80. package/dist/SNPCoverageRenderer/configSchema.d.ts +42 -1
  81. package/dist/shared/FilterByTag.d.ts +0 -1
  82. package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.d.ts +4 -5
  83. package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +88 -126
  84. package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js.map +1 -1
  85. package/esm/AlignmentsFeatureDetail/AlignmentsFeatureFlags.d.ts +5 -0
  86. package/esm/AlignmentsFeatureDetail/AlignmentsFeatureFlags.js +38 -0
  87. package/esm/AlignmentsFeatureDetail/AlignmentsFeatureFlags.js.map +1 -0
  88. package/esm/AlignmentsFeatureDetail/AlignmentsFeatureSuppAligns.d.ts +5 -0
  89. package/esm/AlignmentsFeatureDetail/AlignmentsFeatureSuppAligns.js +31 -0
  90. package/esm/AlignmentsFeatureDetail/AlignmentsFeatureSuppAligns.js.map +1 -0
  91. package/esm/AlignmentsFeatureDetail/index.d.ts +5 -2
  92. package/esm/AlignmentsFeatureDetail/util.d.ts +8 -0
  93. package/esm/AlignmentsFeatureDetail/util.js +22 -0
  94. package/esm/AlignmentsFeatureDetail/util.js.map +1 -0
  95. package/esm/AlignmentsTrack/configSchemaF.d.ts +74 -0
  96. package/esm/AlignmentsTrack/configSchemaF.js +16 -0
  97. package/esm/AlignmentsTrack/configSchemaF.js.map +1 -0
  98. package/esm/AlignmentsTrack/index.js +3 -16
  99. package/esm/AlignmentsTrack/index.js.map +1 -1
  100. package/esm/BamAdapter/BamAdapter.d.ts +1 -1
  101. package/esm/BamAdapter/BamAdapter.js +2 -2
  102. package/esm/BamAdapter/BamAdapter.js.map +1 -1
  103. package/esm/BamAdapter/configSchema.d.ts +50 -1
  104. package/esm/CramAdapter/CramAdapter.d.ts +1 -1
  105. package/esm/CramAdapter/CramAdapter.js +1 -1
  106. package/esm/CramAdapter/CramAdapter.js.map +1 -1
  107. package/esm/CramAdapter/CramTestAdapters.js +1 -1
  108. package/esm/CramAdapter/CramTestAdapters.js.map +1 -1
  109. package/esm/CramAdapter/configSchema.d.ts +40 -1
  110. package/esm/HtsgetBamAdapter/configSchema.d.ts +26 -1
  111. package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.d.ts +0 -1
  112. package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +2 -2
  113. package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.js.map +1 -1
  114. package/esm/LinearAlignmentsDisplay/models/configSchema.d.ts +39 -1
  115. package/esm/LinearAlignmentsDisplay/models/model.d.ts +8 -4
  116. package/esm/LinearAlignmentsDisplay/models/model.js +7 -3
  117. package/esm/LinearAlignmentsDisplay/models/model.js.map +1 -1
  118. package/esm/LinearPileupDisplay/components/ColorByModifications.d.ts +0 -1
  119. package/esm/LinearPileupDisplay/components/ColorByTag.d.ts +0 -1
  120. package/esm/LinearPileupDisplay/components/LinearPileupDisplayBlurb.d.ts +0 -1
  121. package/esm/LinearPileupDisplay/components/SetFeatureHeight.d.ts +0 -1
  122. package/esm/LinearPileupDisplay/components/SetMaxHeight.d.ts +0 -1
  123. package/esm/LinearPileupDisplay/components/SetMaxHeight.js +3 -5
  124. package/esm/LinearPileupDisplay/components/SetMaxHeight.js.map +1 -1
  125. package/esm/LinearPileupDisplay/components/SortByTag.d.ts +0 -1
  126. package/esm/LinearPileupDisplay/configSchema.d.ts +57 -1
  127. package/esm/LinearPileupDisplay/model.d.ts +109 -51
  128. package/esm/LinearPileupDisplay/model.js +21 -24
  129. package/esm/LinearPileupDisplay/model.js.map +1 -1
  130. package/esm/LinearReadArcsDisplay/components/ReactComponent.d.ts +0 -1
  131. package/esm/LinearReadArcsDisplay/configSchema.d.ts +62 -1
  132. package/esm/LinearReadArcsDisplay/drawFeats.js +2 -2
  133. package/esm/LinearReadArcsDisplay/drawFeats.js.map +1 -1
  134. package/esm/LinearReadArcsDisplay/model.d.ts +82 -33
  135. package/esm/LinearReadCloudDisplay/components/ReactComponent.d.ts +0 -1
  136. package/esm/LinearReadCloudDisplay/configSchema.d.ts +50 -1
  137. package/esm/LinearReadCloudDisplay/drawFeats.d.ts +2 -0
  138. package/esm/LinearReadCloudDisplay/drawFeats.js +4 -4
  139. package/esm/LinearReadCloudDisplay/drawFeats.js.map +1 -1
  140. package/esm/LinearReadCloudDisplay/model.d.ts +69 -30
  141. package/esm/LinearSNPCoverageDisplay/components/Tooltip.d.ts +0 -1
  142. package/esm/LinearSNPCoverageDisplay/models/configSchema.d.ts +79 -1
  143. package/esm/LinearSNPCoverageDisplay/models/model.d.ts +52 -27
  144. package/esm/LinearSNPCoverageDisplay/models/model.js +1 -1
  145. package/esm/LinearSNPCoverageDisplay/models/model.js.map +1 -1
  146. package/esm/MismatchParser/index.js +2 -2
  147. package/esm/MismatchParser/index.js.map +1 -1
  148. package/esm/PileupRenderer/PileupLayoutSession.d.ts +1 -1
  149. package/esm/PileupRenderer/PileupRenderer.d.ts +1 -1
  150. package/esm/PileupRenderer/PileupRenderer.js +10 -1
  151. package/esm/PileupRenderer/PileupRenderer.js.map +1 -1
  152. package/esm/PileupRenderer/configSchema.d.ts +87 -1
  153. package/esm/SNPCoverageAdapter/SNPCoverageAdapter.d.ts +1 -1
  154. package/esm/SNPCoverageAdapter/SNPCoverageAdapter.js +2 -2
  155. package/esm/SNPCoverageAdapter/SNPCoverageAdapter.js.map +1 -1
  156. package/esm/SNPCoverageAdapter/configSchema.d.ts +10 -1
  157. package/esm/SNPCoverageAdapter/generateCoverageBins.js +50 -46
  158. package/esm/SNPCoverageAdapter/generateCoverageBins.js.map +1 -1
  159. package/esm/SNPCoverageRenderer/SNPCoverageRenderer.js +1 -1
  160. package/esm/SNPCoverageRenderer/SNPCoverageRenderer.js.map +1 -1
  161. package/esm/SNPCoverageRenderer/configSchema.d.ts +42 -1
  162. package/esm/shared/FilterByTag.d.ts +0 -1
  163. package/package.json +2 -2
  164. package/src/AlignmentsFeatureDetail/AlignmentsFeatureDetail.tsx +109 -183
  165. package/src/AlignmentsFeatureDetail/AlignmentsFeatureFlags.tsx +62 -0
  166. package/src/AlignmentsFeatureDetail/AlignmentsFeatureSuppAligns.tsx +51 -0
  167. package/src/AlignmentsFeatureDetail/__snapshots__/index.test.tsx.snap +4 -4
  168. package/src/AlignmentsFeatureDetail/util.ts +27 -0
  169. package/src/AlignmentsTrack/configSchemaF.ts +22 -0
  170. package/src/AlignmentsTrack/index.ts +3 -24
  171. package/src/BamAdapter/BamAdapter.ts +5 -2
  172. package/src/CramAdapter/CramAdapter.ts +4 -1
  173. package/src/CramAdapter/CramTestAdapters.ts +1 -1
  174. package/src/LinearAlignmentsDisplay/components/AlignmentsDisplay.tsx +2 -2
  175. package/src/LinearAlignmentsDisplay/models/model.tsx +11 -3
  176. package/src/LinearPileupDisplay/components/SetMaxHeight.tsx +3 -5
  177. package/src/LinearPileupDisplay/model.ts +38 -36
  178. package/src/LinearReadArcsDisplay/drawFeats.ts +2 -2
  179. package/src/LinearReadCloudDisplay/drawFeats.ts +6 -5
  180. package/src/LinearSNPCoverageDisplay/models/model.ts +1 -1
  181. package/src/MismatchParser/index.ts +2 -2
  182. package/src/PileupRenderer/PileupLayoutSession.ts +1 -1
  183. package/src/PileupRenderer/PileupRenderer.ts +15 -6
  184. package/src/SNPCoverageAdapter/SNPCoverageAdapter.ts +5 -2
  185. package/src/SNPCoverageAdapter/generateCoverageBins.ts +58 -55
  186. package/src/SNPCoverageRenderer/SNPCoverageRenderer.ts +1 -1
  187. package/dist/NestedFrequencyTable.d.ts +0 -14
  188. package/dist/NestedFrequencyTable.js +0 -94
  189. package/dist/NestedFrequencyTable.js.map +0 -1
  190. package/esm/NestedFrequencyTable.d.ts +0 -14
  191. package/esm/NestedFrequencyTable.js +0 -91
  192. package/esm/NestedFrequencyTable.js.map +0 -1
  193. package/src/NestedFrequencyTable.ts +0 -113
@@ -1,196 +1,121 @@
1
1
  import React, { useState } from 'react'
2
- import {
3
- Typography,
4
- Link,
5
- Paper,
6
- Checkbox,
7
- FormControlLabel,
8
- FormGroup,
9
- } from '@mui/material'
10
- import { makeStyles } from 'tss-react/mui'
2
+ import { Link, Paper } from '@mui/material'
11
3
  import { observer } from 'mobx-react'
12
- import { getSession } from '@jbrowse/core/util'
13
4
  import copy from 'copy-to-clipboard'
14
5
  import clone from 'clone'
15
- import {
16
- FeatureDetails,
17
- BaseCard,
18
- SimpleValue,
19
- } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail'
20
- import { parseCigar } from '../MismatchParser'
6
+ import { FeatureDetails } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail'
7
+ import { IAnyStateTreeNode } from 'mobx-state-tree'
21
8
 
22
- const useStyles = makeStyles()({
23
- compact: {
24
- paddingRight: 0,
25
- paddingTop: 0,
26
- paddingBottom: 0,
27
- },
28
- })
9
+ // locals
10
+ import { getTag, navToLoc } from './util'
11
+ import SupplementaryAlignments from './AlignmentsFeatureSuppAligns'
12
+ import AlignmentFlags from './AlignmentsFeatureFlags'
29
13
 
30
14
  const omit = ['clipPos', 'flags']
31
15
 
32
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
- function AlignmentFlags(props: { feature: any }) {
34
- const { classes } = useStyles()
35
- const { feature } = props
36
- const { flags } = feature
37
- const flagNames = [
38
- 'read paired',
39
- 'read mapped in proper pair',
40
- 'read unmapped',
41
- 'mate unmapped',
42
- 'read reverse strand',
43
- 'mate reverse strand',
44
- 'first in pair',
45
- 'second in pair',
46
- 'not primary alignment',
47
- 'read fails platform/vendor quality checks',
48
- 'read is PCR or optical duplicate',
49
- 'supplementary alignment',
50
- ]
51
- return (
52
- <BaseCard {...props} title="Flags">
53
- <SimpleValue name={'Flag'} value={flags} />
54
-
55
- <FormGroup>
56
- {flagNames.map((name, index) => {
57
- const val = flags & (1 << index)
58
- const key = `${name}_${val}`
59
- return (
60
- <FormControlLabel
61
- key={key}
62
- control={
63
- <Checkbox
64
- className={classes.compact}
65
- checked={Boolean(val)}
66
- name={name}
67
- readOnly
68
- />
69
- }
70
- label={name}
71
- />
72
- )
73
- })}
74
- </FormGroup>
75
- </BaseCard>
76
- )
16
+ const tags = {
17
+ AM: 'The smallest template-independent mapping quality in the template',
18
+ AS: 'Alignment score generated by aligner',
19
+ BC: 'Barcode sequence identifying the sample',
20
+ BQ: 'Offset to base alignment quality (BAQ)',
21
+ BZ: 'Phred quality of the unique molecular barcode bases in the {OX} tag',
22
+ CB: 'Cell identifier',
23
+ CC: 'Reference name of the next hit',
24
+ CM: 'Edit distance between the color sequence and the color reference (see also {NM})',
25
+ CO: 'Free-text comments',
26
+ CP: 'Leftmost coordinate of the next hit',
27
+ CQ: 'Color read base qualities',
28
+ CR: 'Cellular barcode sequence bases (uncorrected)',
29
+ CS: 'Color read sequence',
30
+ CT: 'Complete read annotation tag, used for consensus annotation dummy features',
31
+ CY: 'Phred quality of the cellular barcode sequence in the {CR} tag',
32
+ E2: 'The 2nd most likely base calls',
33
+ FI: 'The index of segment in the template',
34
+ FS: 'Segment suffix',
35
+ FZ: 'Flow signal intensities',
36
+ GC: 'Reserved for backwards compatibility reasons',
37
+ GQ: 'Reserved for backwards compatibility reasons',
38
+ GS: 'Reserved for backwards compatibility reasons',
39
+ H0: 'Number of perfect hits',
40
+ H1: 'Number of 1-difference hits (see also {NM})',
41
+ H2: 'Number of 2-difference hits',
42
+ HI: 'Query hit index',
43
+ IH: 'Query hit total count',
44
+ LB: 'Library',
45
+ MC: 'CIGAR string for mate/next segment',
46
+ MD: 'String encoding mismatched and deleted reference bases',
47
+ MF: 'Reserved for backwards compatibility reasons',
48
+ MI: 'Molecular identifier; a string that uniquely identifies the molecule from which the record was derived',
49
+ ML: 'Base modification probabilities',
50
+ MM: 'Base modifications / methylation ',
51
+ MQ: 'Mapping quality of the mate/next segment',
52
+ NH: 'Number of reported alignments that contain the query in the current record',
53
+ NM: 'Edit distance to the reference',
54
+ OA: 'Original alignment',
55
+ OC: 'Original CIGAR (deprecated; use {OA} instead)',
56
+ OP: 'Original mapping position (deprecated; use {OA} instead)',
57
+ OQ: 'Original base quality',
58
+ OX: 'Original unique molecular barcode bases',
59
+ PG: 'Program',
60
+ PQ: 'Phred likelihood of the template',
61
+ PT: 'Read annotations for parts of the padded read sequence',
62
+ PU: 'Platform unit',
63
+ Q2: 'Phred quality of the mate/next segment sequence in the {R2} tag',
64
+ QT: 'Phred quality of the sample barcode sequence in the {BC} tag',
65
+ QX: 'Quality score of the unique molecular identifier in the {RX} tag',
66
+ R2: 'Sequence of the mate/next segment in the template',
67
+ RG: 'Read group',
68
+ RT: 'Reserved for backwards compatibility reasons',
69
+ RX: 'Sequence bases of the (possibly corrected) unique molecular identifier',
70
+ S2: 'Reserved for backwards compatibility reasons',
71
+ SA: 'Other canonical alignments in a chimeric alignment',
72
+ SM: 'Template-independent mapping quality',
73
+ SQ: 'Reserved for backwards compatibility reasons',
74
+ TC: 'The number of segments in the template',
75
+ TS: 'Transcript strand',
76
+ U2: 'Phred probability of the 2nd call being wrong conditional on the best being wrong',
77
+ UQ: 'Phred likelihood of the segment, conditional on the mapping being correct',
77
78
  }
78
79
 
79
80
  function Formatter({ value }: { value: unknown }) {
80
81
  const [show, setShow] = useState(false)
81
82
  const [copied, setCopied] = useState(false)
82
83
  const display = String(value)
83
- if (display.length > 100) {
84
- return (
85
- <>
86
- <button
87
- type="button"
88
- onClick={() => {
89
- copy(display)
90
- setCopied(true)
91
- setTimeout(() => {
92
- setCopied(false)
93
- }, 700)
94
- }}
95
- >
96
- {copied ? 'Copied to clipboard' : 'Copy'}
97
- </button>
98
- <button type="button" onClick={() => setShow(val => !val)}>
99
- {show ? 'Show less' : 'Show more'}
100
- </button>
101
- <div>{show ? display : `${display.slice(0, 100)}...`}</div>
102
- </>
103
- )
104
- }
105
- return <div>{display}</div>
106
- }
107
-
108
- // utility function to get length of alignment from cigar
109
- function getLengthOnRef(cigar: string) {
110
- const cigarOps = parseCigar(cigar)
111
- let lengthOnRef = 0
112
- for (let i = 0; i < cigarOps.length; i += 2) {
113
- const len = +cigarOps[i]
114
- const op = cigarOps[i + 1]
115
- if (op !== 'H' && op !== 'S' && op !== 'I') {
116
- lengthOnRef += len
117
- }
118
- }
119
- return lengthOnRef
120
- }
121
-
122
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
123
- function SupplementaryAlignments(props: { tag: string; model: any }) {
124
- const { tag, model } = props
125
- const session = getSession(model)
126
- return (
127
- <BaseCard {...props} title="Supplementary alignments">
128
- <Typography>List of supplementary alignment locations</Typography>
129
- <ul>
130
- {tag
131
- .split(';')
132
- .filter(SA => !!SA)
133
- .map((SA, index) => {
134
- const [saRef, saStart, saStrand, saCigar] = SA.split(',')
135
- const saLength = getLengthOnRef(saCigar)
136
- const extra = Math.floor(saLength / 5)
137
- const start = +saStart
138
- const end = +saStart + saLength
139
- const locString = `${saRef}:${Math.max(1, start - extra)}-${
140
- end + extra
141
- }`
142
- const displayStart = start.toLocaleString('en-US')
143
- const displayEnd = end.toLocaleString('en-US')
144
- const displayString = `${saRef}:${displayStart}-${displayEnd} (${saStrand})`
145
- return (
146
- <li key={`${locString}-${index}`}>
147
- <Link
148
- onClick={async event => {
149
- event.preventDefault()
150
- const { view } = model
151
- try {
152
- if (view) {
153
- await view.navToLocString(locString)
154
- } else {
155
- throw new Error(
156
- 'No view associated with this view anymore',
157
- )
158
- }
159
- } catch (e) {
160
- console.error(e)
161
- session.notify(`${e}`)
162
- }
163
- }}
164
- href="#"
165
- >
166
- {displayString}
167
- </Link>
168
- </li>
169
- )
170
- })}
171
- </ul>
172
- </BaseCard>
84
+ return display.length > 100 ? (
85
+ <>
86
+ <button
87
+ type="button"
88
+ onClick={() => {
89
+ copy(display)
90
+ setCopied(true)
91
+ setTimeout(() => setCopied(false), 700)
92
+ }}
93
+ >
94
+ {copied ? 'Copied to clipboard' : 'Copy'}
95
+ </button>
96
+ <button type="button" onClick={() => setShow(val => !val)}>
97
+ {show ? 'Show less' : 'Show more'}
98
+ </button>
99
+ <div>{show ? display : `${display.slice(0, 100)}...`}</div>
100
+ </>
101
+ ) : (
102
+ <div>{display}</div>
173
103
  )
174
104
  }
175
105
 
176
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
177
- function PairLink({ locString, model }: { locString: string; model: any }) {
178
- const session = getSession(model)
106
+ function PairLink({
107
+ locString,
108
+ model,
109
+ }: {
110
+ locString: string
111
+ model: IAnyStateTreeNode
112
+ }) {
179
113
  return (
180
114
  <Link
181
- onClick={async () => {
182
- const { view } = model
183
- if (!view) {
184
- throw new Error(
185
- 'No view associated with this feature detail panel anymore',
186
- )
187
- }
188
- try {
189
- await view.navToLocString(locString)
190
- } catch (e) {
191
- console.error(e)
192
- session.notify(`${e}`)
193
- }
115
+ onClick={event => {
116
+ event.preventDefault()
117
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
118
+ navToLoc(locString, model)
194
119
  }}
195
120
  href="#"
196
121
  >
@@ -199,24 +124,27 @@ function PairLink({ locString, model }: { locString: string; model: any }) {
199
124
  )
200
125
  }
201
126
 
202
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
203
- function AlignmentFeatureDetails(props: { model: any }) {
127
+ export default observer(function AlignmentFeatureDetails(props: {
128
+ model: IAnyStateTreeNode
129
+ }) {
204
130
  const { model } = props
205
131
  const feat = clone(model.featureData)
206
- const SA = (feat.tags && feat.tags.SA) || feat.SA
132
+ const SA = getTag('SA', feat) as string
207
133
  return (
208
134
  <Paper data-testid="alignment-side-drawer">
209
135
  <FeatureDetails
210
136
  {...props}
211
137
  omit={omit}
138
+ // @ts-expect-error
139
+ descriptions={{ ...tags, tags }}
212
140
  feature={feat}
213
- formatter={(value, key) => {
214
- return key === 'next_segment_position' ? (
141
+ formatter={(value, key) =>
142
+ key === 'next_segment_position' ? (
215
143
  <PairLink model={model} locString={value as string} />
216
144
  ) : (
217
145
  <Formatter value={value} />
218
146
  )
219
- }}
147
+ }
220
148
  />
221
149
  {SA ? <SupplementaryAlignments model={model} tag={SA} /> : null}
222
150
  {feat.flags !== undefined ? (
@@ -224,6 +152,4 @@ function AlignmentFeatureDetails(props: { model: any }) {
224
152
  ) : null}
225
153
  </Paper>
226
154
  )
227
- }
228
-
229
- export default observer(AlignmentFeatureDetails)
155
+ })
@@ -0,0 +1,62 @@
1
+ import React from 'react'
2
+ import { Checkbox, FormControlLabel, FormGroup } from '@mui/material'
3
+ import { makeStyles } from 'tss-react/mui'
4
+ import {
5
+ BaseCard,
6
+ SimpleValue,
7
+ } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail'
8
+
9
+ const useStyles = makeStyles()({
10
+ compact: {
11
+ paddingRight: 0,
12
+ paddingTop: 0,
13
+ paddingBottom: 0,
14
+ },
15
+ })
16
+
17
+ const flagNames = [
18
+ 'read paired',
19
+ 'read mapped in proper pair',
20
+ 'read unmapped',
21
+ 'mate unmapped',
22
+ 'read reverse strand',
23
+ 'mate reverse strand',
24
+ 'first in pair',
25
+ 'second in pair',
26
+ 'not primary alignment',
27
+ 'read fails platform/vendor quality checks',
28
+ 'read is PCR or optical duplicate',
29
+ 'supplementary alignment',
30
+ ]
31
+
32
+ export default function AlignmentFlags(props: { feature: { flags: number } }) {
33
+ const { classes } = useStyles()
34
+ const { feature } = props
35
+ const { flags } = feature
36
+
37
+ return (
38
+ <BaseCard {...props} title="Flags">
39
+ <SimpleValue name="Flag" value={flags} />
40
+ <FormGroup>
41
+ {flagNames.map((name, idx) => {
42
+ const val = flags & (1 << idx)
43
+ const key = `${name}_${val}`
44
+ return (
45
+ <FormControlLabel
46
+ key={key}
47
+ control={
48
+ <Checkbox
49
+ className={classes.compact}
50
+ checked={Boolean(val)}
51
+ name={name}
52
+ readOnly
53
+ />
54
+ }
55
+ label={name}
56
+ />
57
+ )
58
+ })}
59
+ </FormGroup>
60
+ </BaseCard>
61
+ )
62
+ }
@@ -0,0 +1,51 @@
1
+ import React from 'react'
2
+ import { Typography, Link } from '@mui/material'
3
+ import { BaseCard } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail'
4
+ import { getLengthOnRef } from '../MismatchParser'
5
+ import { IAnyStateTreeNode } from 'mobx-state-tree'
6
+ import { navToLoc } from './util'
7
+
8
+ export default function SupplementaryAlignments(props: {
9
+ tag: string
10
+ model: IAnyStateTreeNode
11
+ }) {
12
+ const { tag, model } = props
13
+ return (
14
+ <BaseCard {...props} title="Supplementary alignments">
15
+ <Typography>List of supplementary alignment locations</Typography>
16
+ <ul>
17
+ {tag
18
+ .split(';')
19
+ .filter(SA => !!SA)
20
+ .map((SA, index) => {
21
+ const [saRef, saStart, saStrand, saCigar] = SA.split(',')
22
+ const saLength = getLengthOnRef(saCigar)
23
+ const extra = Math.floor(saLength / 5)
24
+ const start = +saStart
25
+ const end = +saStart + saLength
26
+ const locString = `${saRef}:${Math.max(1, start - extra)}-${
27
+ end + extra
28
+ }`
29
+ const displayStart = start.toLocaleString('en-US')
30
+ const displayEnd = end.toLocaleString('en-US')
31
+ const displayString = `${saRef}:${displayStart}-${displayEnd} (${saStrand}) [${saLength}bp]`
32
+ return (
33
+ <li key={`${locString}-${index}`}>
34
+ <Link
35
+ onClick={async event => {
36
+ event.preventDefault()
37
+
38
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
39
+ navToLoc(locString, model)
40
+ }}
41
+ href="#"
42
+ >
43
+ {displayString}
44
+ </Link>
45
+ </li>
46
+ )
47
+ })}
48
+ </ul>
49
+ </BaseCard>
50
+ )
51
+ }
@@ -197,8 +197,9 @@ exports[`open up a widget 1`] = `
197
197
  class="css-1m8nxnb-field"
198
198
  >
199
199
  <div
200
- class="css-1q83rf3-fieldName"
201
- style="width: 96px;"
200
+ aria-label="Mapping quality of the mate/next segment"
201
+ class="css-18vnxxj-fieldDescription-fieldName"
202
+ data-mui-internal-clone-element="true"
202
203
  >
203
204
  MQ
204
205
  </div>
@@ -279,7 +280,7 @@ exports[`open up a widget 1`] = `
279
280
  </div>
280
281
  </div>
281
282
  <div
282
- class="css-1upvn7b-container2"
283
+ class="css-1lttu3w-container"
283
284
  >
284
285
  <button
285
286
  class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium css-sghohy-MuiButtonBase-root-MuiButton-root"
@@ -315,7 +316,6 @@ exports[`open up a widget 1`] = `
315
316
  />
316
317
  </button>
317
318
  </div>
318
- <br />
319
319
  </div>
320
320
  </div>
321
321
  </div>
@@ -0,0 +1,27 @@
1
+ import { getSession } from '@jbrowse/core/util'
2
+ import { IAnyStateTreeNode } from 'mobx-state-tree'
3
+
4
+ export function getTag(
5
+ tag: string,
6
+ feat: {
7
+ tags?: { [key: string]: unknown }
8
+ [key: string]: unknown
9
+ },
10
+ ) {
11
+ return feat.tags?.[tag] || feat[tag]
12
+ }
13
+
14
+ export async function navToLoc(locString: string, model: IAnyStateTreeNode) {
15
+ const session = getSession(model)
16
+ const { view } = model
17
+ try {
18
+ if (view) {
19
+ await view.navToLocString(locString)
20
+ } else {
21
+ throw new Error('No view associated with this view anymore')
22
+ }
23
+ } catch (e) {
24
+ console.error(e)
25
+ session.notify(`${e}`)
26
+ }
27
+ }
@@ -0,0 +1,22 @@
1
+ import { ConfigurationSchema } from '@jbrowse/core/configuration'
2
+ import { createBaseTrackConfig } from '@jbrowse/core/pluggableElementTypes'
3
+ import PluginManager from '@jbrowse/core/PluginManager'
4
+
5
+ /**
6
+ * #config AlignmentsTrack
7
+ * has very little config; most config and state logic is on the display
8
+ */
9
+ function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
10
+
11
+ export default function configSchemaFactory(pluginManager: PluginManager) {
12
+ return ConfigurationSchema(
13
+ 'AlignmentsTrack',
14
+ {},
15
+ {
16
+ /**
17
+ * #baseConfiguration
18
+ */
19
+ baseConfiguration: createBaseTrackConfig(pluginManager),
20
+ },
21
+ )
22
+ }
@@ -1,32 +1,11 @@
1
1
  import PluginManager from '@jbrowse/core/PluginManager'
2
2
  import TrackType from '@jbrowse/core/pluggableElementTypes/TrackType'
3
- import { ConfigurationSchema } from '@jbrowse/core/configuration'
4
- import {
5
- createBaseTrackConfig,
6
- createBaseTrackModel,
7
- } from '@jbrowse/core/pluggableElementTypes/models'
3
+ import { createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'
4
+ import configSchemaF from './configSchemaF'
8
5
 
9
- /**
10
- * #config AlignmentsTrack
11
- * has very little config; most config and state logic is on the display
12
- */
13
- function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
14
-
15
- function configSchemaFactory(pluginManager: PluginManager) {
16
- return ConfigurationSchema(
17
- 'AlignmentsTrack',
18
- {},
19
- {
20
- /**
21
- * #baseConfiguration
22
- */
23
- baseConfiguration: createBaseTrackConfig(pluginManager),
24
- },
25
- )
26
- }
27
6
  export default function register(pm: PluginManager) {
28
7
  pm.addTrackType(() => {
29
- const configSchema = configSchemaFactory(pm)
8
+ const configSchema = configSchemaF(pm)
30
9
  const track = new TrackType({
31
10
  name: 'AlignmentsTrack',
32
11
  displayName: 'Alignments track',
@@ -227,7 +227,10 @@ export default class BamAdapter extends BaseFeatureDataAdapter {
227
227
  }, signal)
228
228
  }
229
229
 
230
- async estimateRegionsStats(regions: Region[], opts?: BaseOptions) {
230
+ async getMultiRegionFeatureDensityStats(
231
+ regions: Region[],
232
+ opts?: BaseOptions,
233
+ ) {
231
234
  const { bam } = await this.configure()
232
235
  // this is a method to avoid calling on htsget adapters
233
236
  // @ts-expect-error
@@ -236,7 +239,7 @@ export default class BamAdapter extends BaseFeatureDataAdapter {
236
239
  const fetchSizeLimit = this.getConf('fetchSizeLimit')
237
240
  return { bytes, fetchSizeLimit }
238
241
  } else {
239
- return super.estimateRegionsStats(regions, opts)
242
+ return super.getMultiRegionFeatureDensityStats(regions, opts)
240
243
  }
241
244
  }
242
245
 
@@ -278,7 +278,10 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
278
278
  }
279
279
 
280
280
  // we return the configured fetchSizeLimit, and the bytes for the region
281
- async estimateRegionsStats(regions: Region[], opts?: BaseOptions) {
281
+ async getMultiRegionFeatureDensityStats(
282
+ regions: Region[],
283
+ opts?: BaseOptions,
284
+ ) {
282
285
  const bytes = await this.bytesForRegions(regions, opts)
283
286
  const fetchSizeLimit = this.getConf('fetchSizeLimit')
284
287
  return {
@@ -2,7 +2,7 @@ import { GenericFilehandle } from 'generic-filehandle'
2
2
  import { Observable } from 'rxjs'
3
3
  import SimpleFeature from '@jbrowse/core/util/simpleFeature'
4
4
  import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'
5
- import { ConfigurationSchema } from '@jbrowse/core/configuration/configurationSchema'
5
+ import { ConfigurationSchema } from '@jbrowse/core/configuration'
6
6
 
7
7
  // setup for Cram Adapter Testing
8
8
  export function parseSmallFasta(text: string) {
@@ -9,7 +9,7 @@ import { AlignmentsDisplayModel } from '../models/model'
9
9
 
10
10
  const useStyles = makeStyles()({
11
11
  resizeHandle: {
12
- height: 2,
12
+ height: 5,
13
13
  position: 'absolute',
14
14
  zIndex: 2,
15
15
  },
@@ -33,7 +33,7 @@ function AlignmentsDisplay({ model }: { model: AlignmentsDisplayModel }) {
33
33
  return delta
34
34
  }}
35
35
  className={classes.resizeHandle}
36
- style={{ top }}
36
+ style={{ top: top - 4 }}
37
37
  />
38
38
 
39
39
  <div
@@ -20,6 +20,7 @@ import {
20
20
  import { BaseDisplay } from '@jbrowse/core/pluggableElementTypes/models'
21
21
  import PluginManager from '@jbrowse/core/PluginManager'
22
22
  import { MenuItem } from '@jbrowse/core/ui'
23
+ import { FeatureDensityStats } from '@jbrowse/core/data_adapters/BaseAdapter'
23
24
 
24
25
  const minDisplayHeight = 20
25
26
 
@@ -161,6 +162,13 @@ function stateModelFactory(
161
162
  get height() {
162
163
  return self.heightPreConfig ?? getConf(self, 'height')
163
164
  },
165
+
166
+ get featureIdUnderMouse() {
167
+ return (
168
+ self.PileupDisplay.featureIdUnderMouse ||
169
+ self.SNPCoverageDisplay.featureIdUnderMouse
170
+ )
171
+ },
164
172
  }))
165
173
  .views(self => ({
166
174
  /**
@@ -234,9 +242,9 @@ function stateModelFactory(
234
242
  /**
235
243
  * #action
236
244
  */
237
- updateStatsLimit(stats: unknown) {
238
- self.PileupDisplay.updateStatsLimit(stats)
239
- self.SNPCoverageDisplay.updateStatsLimit(stats)
245
+ setFeatureDensityStatsLimit(stats?: FeatureDensityStats) {
246
+ self.PileupDisplay.setFeatureDensityStatsLimit(stats)
247
+ self.SNPCoverageDisplay.setFeatureDensityStatsLimit(stats)
240
248
  },
241
249
 
242
250
  /**