View Javadoc

1   /*--------------------------------------------------------------------------
2    *  Copyright 2010 utgenome.org
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   *--------------------------------------------------------------------------*/
16  //--------------------------------------
17  // utgb-core Project
18  //
19  // EnhancedGeneticVariation.java
20  // Since: 2010/10/20
21  //
22  //--------------------------------------
23  package org.utgenome.util.sv;
24  
25  import org.utgenome.gwt.utgb.client.bio.AminoAcid;
26  
27  public class EnhancedGeneticVariation extends GeneticVariation {
28  
29  	/**
30  	 * mutation types (e.g., non-coding, missense, synonymous, non-sense, frame-shift, splice-site mutation, etc.)
31  	 * 
32  	 * @author leo
33  	 * 
34  	 */
35  	public enum MutationType {
36  		NA("N/A"), NC("non coding"), MS("missense"), SN("synonymous"), NS("non-sense mutation"), FS("frame-shift mutation"), SS("splice-site muatation");
37  
38  		public final String description;
39  
40  		private MutationType(String description) {
41  			this.description = description;
42  		}
43  	}
44  
45  	public enum MutationPosition {
46  		NA("N/A"), InterGenic("inter-genic"), UTR5("5'-UTR"), UTR3("3'-UTR"), Intron("intron"), NonCodingExon("non-coding exon"), FirstExon("first coding exon"), Exon(
47  				"coding exon"), LastExon("last coding exon"), SS5("splice site at 5'-end"), SS3("splice site at 3'-end");
48  
49  		public final String description;
50  
51  		private MutationPosition(String description) {
52  			this.description = description;
53  		}
54  	}
55  
56  	public EnhancedGeneticVariation(GeneticVariation v) {
57  		super(v);
58  	}
59  
60  	private static final long serialVersionUID = 1L;
61  
62  	// additional annotations
63  	public MutationPosition mutationPosition;
64  
65  	public String strand;
66  	public String geneName;
67  	public AminoAcid refAA;
68  	public AminoAcid altAA;
69  	public String refCodon;
70  	public String altCodon;
71  
72  	public MutationType getMutationType() {
73  		switch (mutationPosition) {
74  		case NA:
75  		case InterGenic:
76  		case UTR5:
77  		case UTR3:
78  		case Intron:
79  		case NonCodingExon:
80  			return MutationType.NC;
81  		case SS3:
82  		case SS5:
83  			return MutationType.SS;
84  		}
85  
86  		if (refAA == null && altAA == null)
87  			return MutationType.NC;
88  
89  		if (variationType != VariationType.Mutation) {
90  			return MutationType.FS;
91  		}
92  
93  		if (refAA == altAA)
94  			return MutationType.SN;
95  
96  		if (!refAA.isStopCodon() && altAA.isStopCodon()) {
97  			return MutationType.NS;
98  		}
99  		else
100 			return MutationType.MS;
101 	}
102 
103 }