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  // ReadCoverage.java
20  // Since: 2010/05/25
21  //
22  // $URL$ 
23  // $Author$
24  //--------------------------------------
25  package org.utgenome.gwt.utgb.client.bio;
26  
27  /**
28   * Read coverage histogram
29   * 
30   * @author leo
31   * 
32   */
33  public class ReadCoverage extends Interval {
34  
35  	/**
36  	 * 
37  	 */
38  	private static final long serialVersionUID = 1L;
39  
40  	private String name = "read coverage";
41  	/**
42  	 * Coverage of each pixel position
43  	 */
44  	public int[] coverage;
45  	public int pixelWidth;
46  
47  	public int maxHeight = 0;
48  	public int minHeight = 0;
49  
50  	public ReadCoverage() {
51  	}
52  
53  	public ReadCoverage(int start, int end, int pixelWidth, int[] coverage) {
54  		super(start, end);
55  		this.pixelWidth = pixelWidth;
56  		this.coverage = coverage;
57  
58  		for (int each : coverage) {
59  			if (maxHeight < each)
60  				maxHeight = each;
61  			if (minHeight > each)
62  				minHeight = each;
63  		}
64  	}
65  
66  	@Override
67  	public void accept(OnGenomeDataVisitor visitor) {
68  		visitor.visitReadCoverage(this);
69  	}
70  
71  	public void setName(String name) {
72  		this.name = name;
73  	}
74  
75  	@Override
76  	public String getName() {
77  		return name;
78  	}
79  }