001    /**
002     * Copyright (C) 2010 The Roslin Institute <contact andy.law@roslin.ed.ac.uk>
003     *
004     * This file is part of the Ensembl Java API demonstration project developed by the
005     * Bioinformatics Group at The Roslin Institute, The Royal (Dick) School of
006     * Veterinary Studies, University of Edinburgh.
007     *
008     * This is free software: you can redistribute it and/or modify
009     * it under the terms of the GNU General Public License (version 3) as published by
010     * the Free Software Foundation.
011     *
012     * This software is distributed in the hope that it will be useful,
013     * but WITHOUT ANY WARRANTY; without even the implied warranty of
014     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015     * GNU General Public License for more details.
016     *
017     * You should have received a copy of the GNU General Public License
018     * in this software distribution. If not, see <http://www.gnu.org/licenses/gpl-3.0.html/>.
019     */
020    
021    package uk.ac.roslin.ensembl.config;
022    
023    import java.util.Collection;
024    import java.util.HashMap;
025    
026    /**
027     *
028     * @author tpaterso
029     */
030    public class FeatureType extends EnsemblType{
031    
032        //Commonly used annotated features
033        //typically annotated at 'toplevel'
034    
035        public static FeatureType exon;
036        public static FeatureType gene;
037        public static FeatureType repeat_feature;
038        public static FeatureType simple_feature;
039        public static FeatureType prediction_exon;
040        public static FeatureType prediction_transcript;
041        public static FeatureType transcript;
042        public static FeatureType dna_align_feature;
043        public static FeatureType protein_align_feature;
044    
045        //tables exist in the schema
046        //misc_feature, marker_feature, density_feature, qtl_feature, protein_feature
047        //and in the Perl API there are various other extensions of Feature
048    
049        //Features on DNA
050        public static FeatureType assembly_exception;
051        public static FeatureType density_feature;
052        //nb the Perl API treats these similar to marker Features -
053        //(i.e there is a ditag object analagous to a marker)
054        public static FeatureType ditag_feature;
055        public static FeatureType intron;
056        public static FeatureType karyotype_band;
057        //nb the PERL API has Markers and MarkerFeatures (the mapping of a Marker)
058        public static FeatureType marker_feature;
059        public static FeatureType misc_feature;
060        public static FeatureType qtl_feature;
061        public static FeatureType splicing_event;
062        
063        //Features on Peptide, i.e. cordinates are on the peptide
064        public static FeatureType protein_feature;
065        
066        //Pairwise alignment features
067        public static FeatureType dna_peptide_align_feature;
068        public static FeatureType peptide_dna_align_feature;
069    
070    
071        private FeatureType(String value) {
072            this.label = value;
073    
074        }
075    
076    
077        private static HashMap<String, FeatureType> typeListHash = FeatureType.initialize();
078    
079        public static Collection<FeatureType> getAllTypes() {
080            return typeListHash.values();
081        }
082    
083        private static HashMap<String, FeatureType> initialize() {
084    
085            HashMap<String, FeatureType> out = new HashMap<String, FeatureType>();
086    
087    
088            assembly_exception = new FeatureType("assembly_exception");
089            out.put(assembly_exception.toString(), assembly_exception);
090            density_feature = new FeatureType("density_feature");
091            out.put(density_feature.toString(), density_feature);
092            ditag_feature = new FeatureType("ditag_feature");
093            out.put(ditag_feature.toString(), ditag_feature);
094            dna_align_feature = new FeatureType("dna_align_feature");
095            out.put(dna_align_feature.toString(), dna_align_feature);
096            dna_peptide_align_feature = new FeatureType("dna_peptide_align_feature");
097            out.put(dna_peptide_align_feature.toString(), dna_peptide_align_feature);
098            peptide_dna_align_feature = new FeatureType("peptide_dna_align_feature");
099            out.put(peptide_dna_align_feature.toString(), peptide_dna_align_feature);
100            exon = new FeatureType("exon");
101            out.put(exon.toString(), exon);
102            gene = new FeatureType("gene");
103            out.put(gene.toString(), gene);
104            karyotype_band = new FeatureType("karyotype_band");
105            out.put(karyotype_band.toString(), karyotype_band);
106            marker_feature = new FeatureType("marker_feature");
107            out.put(marker_feature.toString(), marker_feature);
108            misc_feature = new FeatureType("misc_feature");
109            out.put(misc_feature.toString(), misc_feature);
110            prediction_exon = new FeatureType("prediction_exon");
111            out.put(prediction_exon.toString(), prediction_exon);
112            prediction_transcript = new FeatureType("prediction_transcript");
113            out.put(prediction_transcript.toString(), prediction_transcript);
114            protein_align_feature = new FeatureType("protein_align_feature");
115            out.put(protein_align_feature.toString(), protein_align_feature);
116            protein_feature = new FeatureType("protein_feature");
117            out.put(protein_feature.toString(), protein_feature);
118            repeat_feature = new FeatureType("repeat_feature");
119            out.put(repeat_feature.toString(), repeat_feature);
120            simple_feature = new FeatureType("simple_feature");
121            out.put(simple_feature.toString(), simple_feature);
122            splicing_event = new FeatureType("splicing_event");
123            out.put(splicing_event.toString(), splicing_event);
124            transcript = new FeatureType("transcript");
125            out.put(transcript.toString(), transcript);
126    
127            return out;
128    
129        }
130    
131        public static FeatureType getFeatureType(String value) {
132            return typeListHash.get(value);
133        }
134    }