From d21b0aa5313fc684841f5c02987ed40b061889f8 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Thu, 3 Aug 2023 22:51:49 +0000 Subject: [PATCH 1/5] Update src/components/SingleRow.jsx --- src/components/SingleRow.jsx | 155 +---------------------------------- 1 file changed, 1 insertion(+), 154 deletions(-) diff --git a/src/components/SingleRow.jsx b/src/components/SingleRow.jsx index 958f838..1a2f706 100644 --- a/src/components/SingleRow.jsx +++ b/src/components/SingleRow.jsx @@ -1,160 +1,7 @@ import ColorHash from "color-hash"; -import { getReverseComplement, filterFeatures } from "../utils"; +import { getReverseComplement, filterFeatures, getColor, codonToAminoAcid } from "../utils"; var colorHash = new ColorHash({ lightness: [0.75, 0.9, 0.7, 0.8] }); -const getColor = (feature, product) => { - switch (feature.type) { - case "CDS": - switch (feature.name) { - case "S": - return "#ff7373"; - case "nsp3": - return "#d3ffce"; - - case "leader": - return "#ff7f50"; - - case "nsp2": - return "#ddffdd"; - - case "nsp4": - return "#ff7373"; - - case "N": - return "#7fffd4"; - case "E": - return "#ff7f50"; - case "M": - return "#eeee88"; - case "nsp12; RdRp": - return "#ff7f50"; - case "nsp6": - return "#ee99ee"; - case "nsp7": - return "#99ee99"; - - case "nsp8": - return "#ff7373"; - case "nsp10": - return "#d3ffce"; - - case "nsp14": - return "#ff7f50"; - case "nsp15": - return "#ddffdd"; - case "nsp16": - return "#ffeeee"; - case "nsp13": - return "#ff7f50"; - - default: - return colorHash.hex(feature.name + product + feature.type); - } - case "gene": - return "blue"; - case "misc_feature": - return "green"; - case "5'UTR": - return "orange"; - case "3'UTR": - return "orange"; - default: - return colorHash.hex(feature.name + product + feature.type); - } -}; - -const codonToAminoAcid = (codon) => { - switch (codon) { - case "TTT": - case "TTC": - return "F"; - case "TTA": - case "TTG": - case "CTT": - case "CTC": - case "CTA": - case "CTG": - return "L"; - case "ATT": - case "ATC": - case "ATA": - return "I"; - case "ATG": - return "M"; - case "GTT": - case "GTC": - case "GTA": - case "GTG": - return "V"; - case "TCT": - case "TCC": - case "TCA": - case "TCG": - case "AGT": - case "AGC": - return "S"; - case "CCT": - case "CCC": - case "CCA": - case "CCG": - return "P"; - case "ACT": - case "ACC": - case "ACA": - case "ACG": - return "T"; - case "GCT": - case "GCC": - case "GCA": - case "GCG": - return "A"; - case "TAT": - case "TAC": - return "Y"; - case "TAA": - case "TAG": - case "TGA": - return "*"; - case "CAT": - case "CAC": - return "H"; - case "CAA": - case "CAG": - return "Q"; - case "AAT": - case "AAC": - return "N"; - case "AAA": - case "AAG": - return "K"; - case "GAT": - case "GAC": - return "D"; - case "GAA": - case "GAG": - return "E"; - case "TGT": - case "TGC": - return "C"; - case "TGG": - return "W"; - case "CGT": - case "CGC": - case "CGA": - case "CGG": - case "AGA": - case "AGG": - return "R"; - case "GGT": - case "GGC": - case "GGA": - case "GGG": - return "G"; - default: - return "X"; - } -}; - const SingleRow = ({ parsedSequence, rowStart, From 53020e442d313765ee20de4642e150a313603747 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Thu, 3 Aug 2023 22:52:14 +0000 Subject: [PATCH 2/5] sweep: Create src/utils/getColor.js --- src/utils/getColor.js | 65 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/utils/getColor.js diff --git a/src/utils/getColor.js b/src/utils/getColor.js new file mode 100644 index 0000000..e5f3273 --- /dev/null +++ b/src/utils/getColor.js @@ -0,0 +1,65 @@ +import ColorHash from "color-hash"; +var colorHash = new ColorHash({ lightness: [0.75, 0.9, 0.7, 0.8] }); + +const getColor = (feature, product) => { + switch (feature.type) { + case "CDS": + switch (feature.name) { + case "S": + return "#ff7373"; + case "nsp3": + return "#d3ffce"; + + case "leader": + return "#ff7f50"; + + case "nsp2": + return "#ddffdd"; + + case "nsp4": + return "#ff7373"; + + case "N": + return "#7fffd4"; + case "E": + return "#ff7f50"; + case "M": + return "#eeee88"; + case "nsp12; RdRp": + return "#ff7f50"; + case "nsp6": + return "#ee99ee"; + case "nsp7": + return "#99ee99"; + + case "nsp8": + return "#ff7373"; + case "nsp10": + return "#d3ffce"; + + case "nsp14": + return "#ff7f50"; + case "nsp15": + return "#ddffdd"; + case "nsp16": + return "#ffeeee"; + case "nsp13": + return "#ff7f50"; + + default: + return colorHash.hex(feature.name + product + feature.type); + } + case "gene": + return "blue"; + case "misc_feature": + return "green"; + case "5'UTR": + return "orange"; + case "3'UTR": + return "orange"; + default: + return colorHash.hex(feature.name + product + feature.type); + } +}; + +export default getColor; \ No newline at end of file From f0e05905cf2007e27a1f0eb9d9cb0b3a2ebb1daa Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Thu, 3 Aug 2023 22:52:44 +0000 Subject: [PATCH 3/5] sweep: Create src/utils/codonMapping.js --- src/utils/codonMapping.js | 93 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 src/utils/codonMapping.js diff --git a/src/utils/codonMapping.js b/src/utils/codonMapping.js new file mode 100644 index 0000000..f622374 --- /dev/null +++ b/src/utils/codonMapping.js @@ -0,0 +1,93 @@ +const codonToAminoAcid = (codon) => { + switch (codon) { + case "TTT": + case "TTC": + return "F"; + case "TTA": + case "TTG": + case "CTT": + case "CTC": + case "CTA": + case "CTG": + return "L"; + case "ATT": + case "ATC": + case "ATA": + return "I"; + case "ATG": + return "M"; + case "GTT": + case "GTC": + case "GTA": + case "GTG": + return "V"; + case "TCT": + case "TCC": + case "TCA": + case "TCG": + case "AGT": + case "AGC": + return "S"; + case "CCT": + case "CCC": + case "CCA": + case "CCG": + return "P"; + case "ACT": + case "ACC": + case "ACA": + case "ACG": + return "T"; + case "GCT": + case "GCC": + case "GCA": + case "GCG": + return "A"; + case "TAT": + case "TAC": + return "Y"; + case "TAA": + case "TAG": + case "TGA": + return "*"; + case "CAT": + case "CAC": + return "H"; + case "CAA": + case "CAG": + return "Q"; + case "AAT": + case "AAC": + return "N"; + case "AAA": + case "AAG": + return "K"; + case "GAT": + case "GAC": + return "D"; + case "GAA": + case "GAG": + return "E"; + case "TGT": + case "TGC": + return "C"; + case "TGG": + return "W"; + case "CGT": + case "CGC": + case "CGA": + case "CGG": + case "AGA": + case "AGG": + return "R"; + case "GGT": + case "GGC": + case "GGA": + case "GGG": + return "G"; + default: + return "X"; + } +}; + +export default codonToAminoAcid; \ No newline at end of file From 4bfff528693a1914ebe7e2d88acbcdde6e6a75f2 Mon Sep 17 00:00:00 2001 From: Theo Sanderson Date: Thu, 3 Aug 2023 23:56:12 +0100 Subject: [PATCH 4/5] Update SingleRow.jsx --- src/components/SingleRow.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/SingleRow.jsx b/src/components/SingleRow.jsx index 1a2f706..7e6f039 100644 --- a/src/components/SingleRow.jsx +++ b/src/components/SingleRow.jsx @@ -1,5 +1,7 @@ import ColorHash from "color-hash"; -import { getReverseComplement, filterFeatures, getColor, codonToAminoAcid } from "../utils"; +import { getReverseComplement, filterFeatures, } from "../utils"; +import getColor from "../utils/getColor"; +import codonMapping from "../utils/codonMapping"; var colorHash = new ColorHash({ lightness: [0.75, 0.9, 0.7, 0.8] }); const SingleRow = ({ From 3d28ae0433589940698cd1a0d1bb089d616cb862 Mon Sep 17 00:00:00 2001 From: Theo Sanderson Date: Thu, 3 Aug 2023 23:59:25 +0100 Subject: [PATCH 5/5] Update SingleRow.jsx --- src/components/SingleRow.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SingleRow.jsx b/src/components/SingleRow.jsx index 7e6f039..d8ef2ad 100644 --- a/src/components/SingleRow.jsx +++ b/src/components/SingleRow.jsx @@ -1,7 +1,7 @@ import ColorHash from "color-hash"; import { getReverseComplement, filterFeatures, } from "../utils"; import getColor from "../utils/getColor"; -import codonMapping from "../utils/codonMapping"; +import codonToAminoAcid from "../utils/codonMapping"; var colorHash = new ColorHash({ lightness: [0.75, 0.9, 0.7, 0.8] }); const SingleRow = ({