View Javadoc

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  // Read.java
20  // Since: May 16, 2010
21  //
22  // $URL$ 
23  // $Author$
24  //--------------------------------------
25  package org.utgenome.gwt.utgb.client.bio;
26  
27  /**
28   * An interval with starnd information
29   * 
30   * @author leo
31   * 
32   */
33  public class Read extends Interval {
34  
35  	public static enum ReadType {
36  		INTERVAL, BED, SAM, BAM, BSS, WIG, URI
37  	}
38  
39  	/**
40  	 * 
41  	 */
42  	private static final long serialVersionUID = 1L;
43  
44  	private String name;
45  	private String color;
46  	private byte strand = '+';
47  
48  	public Read() {
49  		super();
50  	}
51  
52  	public Read(int start, int end) {
53  		super(start, end);
54  	}
55  
56  	public Read(String name, int start, int end) {
57  		super(start, end);
58  		this.name = name;
59  	}
60  
61  	protected Read(Read other) {
62  		super(other.start, other.end);
63  		this.name = other.name;
64  		this.color = other.color;
65  		this.strand = other.strand;
66  	}
67  
68  	@Override
69  	public String getName() {
70  		return name;
71  	}
72  
73  	public void setName(String name) {
74  		this.name = name;
75  	}
76  
77  	@Override
78  	public String getColor() {
79  		return color;
80  	}
81  
82  	public void setColor(String color) {
83  		this.color = color;
84  	}
85  
86  	public char getStrand() {
87  		return (char) strand;
88  	}
89  
90  	@Override
91  	public boolean isSense() {
92  		return '+' == strand;
93  	}
94  
95  	@Override
96  	public boolean isAntiSense() {
97  		return '-' == strand;
98  	}
99  
100 	public void setStrand(String strand) {
101 		if (strand != null && strand.length() > 0)
102 			this.strand = (byte) strand.charAt(0);
103 	}
104 
105 	@Override
106 	public void accept(OnGenomeDataVisitor visitor) {
107 		visitor.visitRead(this);
108 	}
109 
110 }