Skip to content

Commit

Permalink
Update src/components/SingleRow.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Aug 3, 2023
1 parent c35a32b commit d21b0aa
Showing 1 changed file with 1 addition and 154 deletions.
155 changes: 1 addition & 154 deletions src/components/SingleRow.jsx
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit d21b0aa

Please sign in to comment.