@teselagen/ove 0.5.12 → 0.5.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ove",
3
- "version": "0.5.12",
3
+ "version": "0.5.14",
4
4
  "main": "./src/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -12,7 +12,7 @@
12
12
  "dependencies": {
13
13
  "@teselagen/sequence-utils": "0.3.24",
14
14
  "@teselagen/range-utils": "0.3.7",
15
- "@teselagen/ui": "0.4.9",
15
+ "@teselagen/ui": "0.4.11",
16
16
  "@teselagen/file-utils": "0.3.16",
17
17
  "@teselagen/bounce-loader": "0.3.11",
18
18
  "@teselagen/bio-parsers": "0.4.18",
@@ -3,14 +3,10 @@ import React from "react";
3
3
  // import CutsiteFilter from "../CutsiteFilter";
4
4
  // import { Tabs, Tab, Button, InputGroup, Intent } from "@blueprintjs/core";
5
5
 
6
- export default class AlignmentTool extends React.Component {
7
- // state={selectedTab: "virtualDigest"}
8
- render() {
9
- const { height = "100%" } = this.props;
10
- return (
11
- <div style={{ height, overflow: "auto", padding: 10 }}>
12
- <div>Add an alignment file (.gb, .fasta, .ab)</div>
13
- </div>
14
- );
15
- }
16
- }
6
+ export default ({ height = "100%" }) => {
7
+ return (
8
+ <div style={{ height, overflow: "auto", padding: 10 }}>
9
+ <div>Add an alignment file (.gb, .fasta, .ab)</div>
10
+ </div>
11
+ );
12
+ };
@@ -36,8 +36,8 @@ function AASliver(props) {
36
36
  path = isFiller
37
37
  ? "25,0 49,0 60,50 49,100 25,100 38,50 25,0"
38
38
  : isTruncatedStart
39
- ? // ? "0,0 50,0 60,50 50,100 00,100 16,50 0,0"
40
- `M ${roundedCorner / 3}, 0
39
+ ? // ? "0,0 50,0 60,50 50,100 00,100 16,50 0,0"
40
+ `M ${roundedCorner / 3}, 0
41
41
  L ${50 - roundedCorner / 3}, 0
42
42
  Q 50 0 ${50 + roundedCorner * dirX1} ${roundedCorner * dirY1}
43
43
  L ${60 - roundedCorner * dirX1}, ${50 - roundedCorner * dirY1}
@@ -59,9 +59,9 @@ function AASliver(props) {
59
59
  L ${roundedCorner * dirX2}, ${roundedCorner * dirY2}
60
60
  Q 0 0 ${roundedCorner / 3} 0
61
61
  z`
62
- : isTruncatedEnd
63
- ? // ? "24,0 74,0 84,50 74,100 24,100 40,50 24,0"
64
- `M ${24 + roundedCorner / 3}, 0
62
+ : isTruncatedEnd
63
+ ? // ? "24,0 74,0 84,50 74,100 24,100 40,50 24,0"
64
+ `M ${24 + roundedCorner / 3}, 0
65
65
  L ${74 - roundedCorner / 3}, 0
66
66
  Q 74 0 ${74 + roundedCorner * dirX1} ${roundedCorner * dirY1}
67
67
  L ${84 - roundedCorner * dirX1}, ${50 - roundedCorner * dirY1}
@@ -83,7 +83,7 @@ function AASliver(props) {
83
83
  L ${24 + roundedCorner * dirX2}, ${roundedCorner * dirY2}
84
84
  Q 24 0 ${24 + roundedCorner / 3} 0
85
85
  z`
86
- : `M ${roundedCorner / 3}, 0
86
+ : `M ${roundedCorner / 3}, 0
87
87
  L ${74 - roundedCorner / 3}, 0
88
88
  Q 74 0 ${74 + roundedCorner * dirX1} ${roundedCorner * dirY1}
89
89
  L ${84 - roundedCorner * dirX1}, ${50 - roundedCorner * dirY1}
@@ -130,10 +130,10 @@ function AASliver(props) {
130
130
  isFiller
131
131
  ? "25,0 49,0 60,50 49,100 25,100 38,50 25,0"
132
132
  : isTruncatedStart
133
- ? "0,0 50,0 60,50 50,100 00,100 16,50 0,0"
134
- : isTruncatedEnd
135
- ? "24,0 74,0 84,50 74,100 24,100 40,50 24,0"
136
- : "0,0 74,0 85,50 74,100 0,100 16,50 0,0"
133
+ ? "0,0 50,0 60,50 50,100 00,100 16,50 0,0"
134
+ : isTruncatedEnd
135
+ ? "24,0 74,0 84,50 74,100 24,100 40,50 24,0"
136
+ : "0,0 74,0 85,50 74,100 0,100 16,50 0,0"
137
137
  }
138
138
  strokeWidth="5"
139
139
  fill={color || "gray"}
@@ -148,7 +148,8 @@ function AASliver(props) {
148
148
  />
149
149
  ))}
150
150
 
151
- {!isFiller && (
151
+ {/* isTruncatedEnd && isTruncatedStart is the special case of a single base exon */}
152
+ {(!isFiller || (isTruncatedEnd && isTruncatedStart)) && (
152
153
  <text
153
154
  fontSize={25}
154
155
  stroke="black"
@@ -57,31 +57,55 @@ class Translation extends React.Component {
57
57
  );
58
58
 
59
59
  //we then loop over all the amino acids in the sub range and draw them onto the row
60
+ let prevAaSliver;
61
+ let nextAaSliver = aminoAcidsForSubrange[1];
62
+ // The last index in the sequence
63
+ const lastIndex = aminoAcidsForSubrange.length - 1;
64
+
60
65
  const translationSVG = aminoAcidsForSubrange.map(
61
66
  function (aminoAcidSliver, index) {
67
+ if (aminoAcidSliver.positionInCodon === null) {
68
+ prevAaSliver = aminoAcidSliver;
69
+ nextAaSliver = aminoAcidsForSubrange[index + 2];
70
+ return (
71
+ <rect
72
+ x={index * charWidth}
73
+ y={height / 2 - height / 16}
74
+ width={charWidth}
75
+ height={height / 8}
76
+ fill="grey"
77
+ stroke="black"
78
+ strokeWidth={1}
79
+ ></rect>
80
+ );
81
+ }
62
82
  const isEndFiller =
63
- index === 0 &&
83
+ (index === 0 || prevAaSliver?.positionInCodon === null) &&
64
84
  aminoAcidSliver.positionInCodon === (annotation.forward ? 2 : 0);
65
- // const isStartFiller = false
85
+
86
+ const isStartFiller =
87
+ (index === lastIndex || nextAaSliver?.positionInCodon === null) &&
88
+ aminoAcidSliver.positionInCodon === (annotation.forward ? 0 : 2);
89
+
66
90
  let isTruncatedEnd =
67
- index === 0 && aminoAcidSliver.positionInCodon === 1;
91
+ (index === 0 || prevAaSliver?.positionInCodon === null) &&
92
+ aminoAcidSliver.positionInCodon === 1;
68
93
  let isTruncatedStart =
69
- index === aminoAcidsForSubrange.length - 1 &&
94
+ (index === lastIndex || nextAaSliver?.positionInCodon === null) &&
70
95
  aminoAcidSliver.positionInCodon === 1;
96
+
71
97
  if (!annotation.forward) {
72
98
  const holder = isTruncatedEnd;
73
99
  isTruncatedEnd = isTruncatedStart;
74
100
  isTruncatedStart = holder;
75
101
  }
76
- const isStartFiller =
77
- index === aminoAcidsForSubrange.length - 1 &&
78
- aminoAcidSliver.positionInCodon === (annotation.forward ? 0 : 2);
79
-
80
102
  if (
81
103
  aminoAcidSliver.positionInCodon !== 1 &&
82
104
  !isStartFiller &&
83
105
  !isEndFiller
84
106
  ) {
107
+ prevAaSliver = aminoAcidSliver;
108
+ nextAaSliver = aminoAcidsForSubrange[index + 2];
85
109
  return null;
86
110
  }
87
111
  const { gapsInside, gapsBefore } = getGaps(aminoAcidSliver.codonRange);
@@ -103,9 +127,17 @@ class Translation extends React.Component {
103
127
  } else {
104
128
  color = aminoAcid.color;
105
129
  }
130
+ prevAaSliver = aminoAcidSliver;
131
+ nextAaSliver = aminoAcidsForSubrange[index + 2];
132
+
106
133
  return (
107
134
  <AASliver
108
- isFiller={isEndFiller || isStartFiller}
135
+ // isTruncatedEnd && isTruncatedStart is the special case of a single base exon
136
+ isFiller={
137
+ isEndFiller ||
138
+ isStartFiller ||
139
+ (isTruncatedEnd && isTruncatedStart)
140
+ }
109
141
  isTruncatedEnd={isTruncatedEnd}
110
142
  isTruncatedStart={isTruncatedStart}
111
143
  onClick={function (event) {