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