-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from theosanderson/sweep/refactor/color-and-co…
…don-mapping Refactor getColor and codon mapping into separate files
- Loading branch information
Showing
3 changed files
with
161 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
8391e35
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
genbank-view – ./
gensplore.genomium.org
genbank-view-git-main-theosanderson.vercel.app
genbank-view.vercel.app
genbank-view-theosanderson.vercel.app
gensplore.theo.io