1 /*-------------------------------------------------------------------------- 2 * Copyright 2009 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 // Ribbon.java 20 // Since: 2010/05/20 21 // 22 // $URL$ 23 // $Author$ 24 //-------------------------------------- 25 package org.utgenome.gwt.utgb.client.ribbon; 26 27 import java.util.ArrayList; 28 import java.util.List; 29 30 /** 31 * Ribbon is a coordinate for representing insertions to reference and deletions to reference, 32 * 33 * <pre> 34 * xOffset: 1 2 3 4 5 6 7 8 9 35 * normal coordinate: 1 2 3 4 5 6 7 8 9 36 * - - - - - - - - - 37 * -cigar: 9M 38 * 39 * [insertion] 40 * xOffset: 1 2 3 4 5 6 7 8 9 10 11 41 * ribbon coordinate: 1 2 3 - - - - - 4 5 6 42 * / \ 43 * - - - - - - 44 * -insertion(pos:4, length:5) 45 * -cigar: 3M5I3M 46 * 47 * 48 * 49 * [deletion] 50 * xOffset: 1 2 3 4 5 6 7 8 9 10 11 51 * ribbon coordinate: 1 2 3 7 8 9 10 11 12 13 14 52 * - - - - - - - - - - - 53 * / \ 54 * --- 55 * 3.1 3.2 3.3 56 * -deletion(pos:4, length:3) 57 * -cigar: 3M3D7M 58 * </pre> 59 * 60 * @author leo 61 * 62 */ 63 public class Ribbon { 64 65 public static enum CreaseType { 66 INSERTION, DELETION 67 } 68 69 /** 70 * A crease is a point where insertion or deletion occurs. 71 * 72 * @author leo 73 * 74 */ 75 public static class Crease { 76 public int x; 77 public int length; 78 public CreaseType type; 79 80 private Crease(int x, int length, CreaseType type) { 81 this.x = x; 82 this.length = length; 83 this.type = type; 84 } 85 86 public boolean overlap(int start, int length) { 87 88 return false; 89 } 90 91 public static Crease newInsertion(int x, int length) { 92 return new Crease(x, length, CreaseType.INSERTION); 93 } 94 95 public static Crease newDeletion(int x, int length) { 96 return new Crease(x, length, CreaseType.DELETION); 97 } 98 } 99 100 private List<Crease> crease = new ArrayList<Crease>(); 101 102 public Ribbon() { 103 104 } 105 106 public List<Crease> getCreaseInRange(int start, int end) { 107 ArrayList<Crease> result = new ArrayList<Crease>(); 108 for (Crease each : crease) { 109 110 } 111 return result; 112 } 113 114 }