de4ba8d79845e548863f520494e9cf15966fcb2b
[jalview.git] / src / jalview / json / binding / biojson / v1 / ColourSchemeMapper.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.json.binding.biojson.v1;
22
23 import jalview.datamodel.AnnotatedCollectionI;
24 import jalview.schemes.Blosum62ColourScheme;
25 import jalview.schemes.BuriedColourScheme;
26 import jalview.schemes.ClustalxColourScheme;
27 import jalview.schemes.ColourSchemeI;
28 import jalview.schemes.HelixColourScheme;
29 import jalview.schemes.HydrophobicColourScheme;
30 import jalview.schemes.NucleotideColourScheme;
31 import jalview.schemes.PIDColourScheme;
32 import jalview.schemes.PurinePyrimidineColourScheme;
33 import jalview.schemes.RNAHelicesColour;
34 import jalview.schemes.RNAInteractionColourScheme;
35 import jalview.schemes.StrandColourScheme;
36 import jalview.schemes.TCoffeeColourScheme;
37 import jalview.schemes.TaylorColourScheme;
38 import jalview.schemes.TurnColourScheme;
39 import jalview.schemes.ZappoColourScheme;
40
41 public class ColourSchemeMapper
42 {
43   public static ColourSchemeI getJalviewColourScheme(
44           String colourSchemeName, AnnotatedCollectionI annotCol)
45   {
46     switch (colourSchemeName.toUpperCase())
47     {
48     case "ZAPPO":
49       return new ZappoColourScheme();
50     case "TAYLOR":
51       return new TaylorColourScheme();
52     case "NUCLEOTIDE":
53       return new NucleotideColourScheme();
54     case "PURINE":
55     case "PURINE/PYRIMIDINE":
56       return new PurinePyrimidineColourScheme();
57     case "HELIX":
58     case "HELIX PROPENSITY":
59       return new HelixColourScheme();
60     case "TURN":
61     case "TURN PROPENSITY":
62       return new TurnColourScheme();
63     case "STRAND":
64     case "STRAND PROPENSITY":
65       return new StrandColourScheme();
66     case "BURIED":
67     case "BURIED INDEX":
68       return new BuriedColourScheme();
69     case "HYDRO":
70     case "HYDROPHOBIC":
71       return new HydrophobicColourScheme();
72     case "RNA INTERACTION TYPE":
73       return new RNAInteractionColourScheme();
74     case "PID":
75     case "% IDENTITY":
76       return new PIDColourScheme();
77     case "BLOSUM62":
78       return new Blosum62ColourScheme();
79     case "T-COFFEE SCORES":
80       return (annotCol != null) ? new TCoffeeColourScheme(annotCol) : null;
81     case "RNA HELICES":
82       return (annotCol != null) ? new RNAHelicesColour(annotCol) : null;
83     case "CLUSTAL":
84       return (annotCol != null) ? new ClustalxColourScheme(annotCol, null)
85               : null;
86     case "USER DEFINED":
87       return null;
88     default:
89       return null;
90     }
91   }
92 }