Skip to content

Commit 7290bfe

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 7cd5f7d + 1b2fdff commit 7290bfe

25 files changed

+1003
-233
lines changed

src/org/broad/igv/data/AbstractDataSource.java

+14-12
Original file line numberDiff line numberDiff line change
@@ -139,23 +139,25 @@ private List<SummaryTile> getSummaryTilesForRange(String chr, int startLocation,
139139
}
140140
endLocation = Math.min(endLocation, chrLength);
141141

142-
// By definition there are 2^z tiles per chromosome, and 700 bins per tile, where z is the zoom level.
143-
//int maxZoom = (int) (Math.log(chrLength/700) / Globals.log2) + 1;
144-
//int z = Math.min(zReq, maxZoom);
145-
int z = zReq;
146-
int nTiles = (int) Math.pow(2, z);
147-
//double binSize = Math.max(1, (((double) chrLength) / nTiles) / 700);
148-
149142

150143
int adjustedStart = Math.max(0, startLocation);
151144
int adjustedEnd = Math.min(chrLength, endLocation);
152145

153146

154147
if (cacheSummaryTiles && !FrameManager.isGeneListMode() && !FrameManager.isExomeMode()) {
155-
double tileWidth = ((double) chrLength) / nTiles;
148+
149+
// By definition there are 2^z tiles per chromosome, and 700 bins per tile, where z is the zoom level.
150+
//int maxZoom = (int) (Math.log(chrLength/700) / Globals.log2) + 1;
151+
//int z = Math.min(zReq, maxZoom);
152+
int z = zReq;
153+
int virtualTileCount = (int) Math.pow(2, z);
154+
155+
double tileWidth = ((double) chrLength) / virtualTileCount;
156156
int startTile = (int) (adjustedStart / tileWidth);
157157
int endTile = (int) (Math.min(chrLength, adjustedEnd) / tileWidth) + 1;
158-
List<SummaryTile> tiles = new ArrayList(nTiles);
158+
List<SummaryTile> tiles = null;
159+
160+
tiles = new ArrayList(endTile - startTile + 1);
159161
for (int t = startTile; t <= endTile; t++) {
160162
int tileStart = (int) (t * tileWidth);
161163
int tileEnd = Math.min(chrLength, (int) ((t + 1) * tileWidth));
@@ -310,11 +312,11 @@ SummaryTile computeSummaryTile(String chr, int tileNumber, int startLocation, in
310312
private LocusScore getCompositeScore(Accumulator accumulator, int accumulatedStart, int accumulatedEnd) {
311313
LocusScore ls;
312314
if (accumulator.getNpts() == 1) {
313-
ls = new NamedScore(accumulatedStart, accumulatedEnd, accumulator.getData()[0], accumulator.getNames()[0]);
315+
ls = new NamedScore(accumulatedStart, accumulatedEnd, accumulator.getRepData()[0], accumulator.getRepProbes()[0]);
314316
} else {
315317
float value = accumulator.getValue();
316-
ls = new CompositeScore(accumulatedStart, accumulatedEnd, value, accumulator.getData(),
317-
accumulator.getNames(), windowFunction);
318+
ls = new CompositeScore(accumulatedStart, accumulatedEnd, value, accumulator.getRepData(),
319+
accumulator.getRepProbes(), windowFunction);
318320
}
319321
return ls;
320322

src/org/broad/igv/data/seg/SegmentFileParser.java

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
/*
2-
* Copyright (c) 2007-2011 by The Broad Institute of MIT and Harvard. All Rights Reserved.
2+
* Copyright (c) 2007-2012 The Broad Institute, Inc.
3+
* SOFTWARE COPYRIGHT NOTICE
4+
* This software and its documentation are the copyright of the Broad Institute, Inc. All rights are reserved.
5+
*
6+
* This software is supplied without any warranty or guaranteed support whatsoever. The Broad Institute is not responsible for its use, misuse, or functionality.
37
*
48
* This software is licensed under the terms of the GNU Lesser General Public License (LGPL),
59
* Version 2.1 which is available at http://www.opensource.org/licenses/lgpl-2.1.php.
6-
*
7-
* THE SOFTWARE IS PROVIDED "AS IS." THE BROAD AND MIT MAKE NO REPRESENTATIONS OR
8-
* WARRANTES OF ANY KIND CONCERNING THE SOFTWARE, EXPRESS OR IMPLIED, INCLUDING,
9-
* WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
10-
* PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, WHETHER
11-
* OR NOT DISCOVERABLE. IN NO EVENT SHALL THE BROAD OR MIT, OR THEIR RESPECTIVE
12-
* TRUSTEES, DIRECTORS, OFFICERS, EMPLOYEES, AND AFFILIATES BE LIABLE FOR ANY DAMAGES
13-
* OF ANY KIND, INCLUDING, WITHOUT LIMITATION, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
14-
* ECONOMIC DAMAGES OR INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF WHETHER
15-
* THE BROAD OR MIT SHALL BE ADVISED, SHALL HAVE OTHER REASON TO KNOW, OR IN FACT
16-
* SHALL KNOW OF THE POSSIBILITY OF THE FOREGOING.
1710
*/
1811
package org.broad.igv.data.seg;
1912

@@ -189,7 +182,7 @@ public SegmentedAsciiDataSet loadSegments(ResourceLocator locator, Genome genome
189182
throw new RuntimeException(e);
190183
}
191184
} finally {
192-
if (reader == null) {
185+
if (reader != null) {
193186
reader.close();
194187
}
195188
}
+155
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
/*
2+
* Copyright (c) 2007-2012 The Broad Institute, Inc.
3+
* SOFTWARE COPYRIGHT NOTICE
4+
* This software and its documentation are the copyright of the Broad Institute, Inc. All rights are reserved.
5+
*
6+
* This software is supplied without any warranty or guaranteed support whatsoever. The Broad Institute is not responsible for its use, misuse, or functionality.
7+
*
8+
* This software is licensed under the terms of the GNU Lesser General Public License (LGPL),
9+
* Version 2.1 which is available at http://www.opensource.org/licenses/lgpl-2.1.php.
10+
*/
11+
12+
package org.broad.igv.dev;
13+
14+
import java.sql.ResultSet;
15+
import java.sql.SQLException;
16+
17+
/**
18+
* User: jacob
19+
* Date: 2012-Aug-30
20+
*/
21+
public class GenDataParser {
22+
23+
public final byte getByte(ResultSet rs, int index) throws SQLException {
24+
return rs.getByte(index + 1);
25+
}
26+
27+
public final byte getByte(ResultSet rs, String label) throws SQLException {
28+
return rs.getByte(label);
29+
}
30+
31+
public final byte getByte(String[] array, int index) throws NumberFormatException {
32+
return Byte.valueOf(array[index]);
33+
}
34+
35+
public final short getShort(ResultSet rs, int index) throws SQLException {
36+
return rs.getShort(index + 1);
37+
}
38+
39+
public final short getShort(ResultSet rs, String label) throws SQLException {
40+
return rs.getShort(label);
41+
}
42+
43+
public final short getShort(String[] array, int index) throws NumberFormatException {
44+
return Short.valueOf(array[index]);
45+
}
46+
47+
public final int getInt(ResultSet rs, int index) throws SQLException {
48+
return rs.getInt(index + 1);
49+
}
50+
51+
public final int getInt(ResultSet rs, String label) throws SQLException {
52+
return rs.getInt(label);
53+
}
54+
55+
public final int getInt(String[] array, int index) throws NumberFormatException {
56+
return Integer.valueOf(array[index]);
57+
}
58+
59+
public final double getDouble(ResultSet rs, int index) throws SQLException {
60+
return rs.getDouble(index + 1);
61+
}
62+
63+
public final double getDouble(ResultSet rs, String label) throws SQLException {
64+
return rs.getDouble(label);
65+
}
66+
67+
public final double getDouble(String[] array, int index) throws NumberFormatException {
68+
return Double.valueOf(array[index]);
69+
}
70+
71+
public final float getFloat(ResultSet rs, int index) throws SQLException {
72+
return rs.getFloat(index + 1);
73+
}
74+
75+
public final float getFloat(ResultSet rs, String label) throws SQLException {
76+
return rs.getFloat(label);
77+
}
78+
79+
public final float getFloat(String[] array, int index) throws NumberFormatException {
80+
return Float.valueOf(array[index]);
81+
}
82+
83+
public final String getString(ResultSet rs, int index) throws SQLException {
84+
return rs.getString(index + 1);
85+
}
86+
87+
public final String getString(ResultSet rs, String label) throws SQLException {
88+
return rs.getString(label);
89+
}
90+
91+
public final String getString(String[] array, int index) throws NumberFormatException {
92+
return array[index];
93+
}
94+
95+
// public final byte getByte(Object obj, int index) throws SQLException{
96+
// if(obj instanceof ResultSet){
97+
// return ((ResultSet) obj).getByte(index + 1);
98+
// }else if(obj instanceof String[]){
99+
// return Byte.valueOf(((String[]) obj)[index]);
100+
// }else{
101+
// throw new IllegalArgumentException("Input must be a ResultSet or String[]");
102+
// }
103+
// }
104+
//
105+
// public final short getShort(Object obj, int index) throws SQLException{
106+
// if(obj instanceof ResultSet){
107+
// return ((ResultSet) obj).getShort(index + 1);
108+
// }else if(obj instanceof String[]){
109+
// return Short.valueOf(((String[]) obj)[index]);
110+
// }else{
111+
// throw new IllegalArgumentException("Input must be a ResultSet or String[]");
112+
// }
113+
// }
114+
//
115+
// public final int getInt(Object obj, int index) throws SQLException{
116+
// if(obj instanceof ResultSet){
117+
// return ((ResultSet) obj).getInt(index + 1);
118+
// }else if(obj instanceof String[]){
119+
// return Integer.valueOf(((String[]) obj)[index]);
120+
// }else{
121+
// throw new IllegalArgumentException("Input must be a ResultSet or String[]");
122+
// }
123+
// }
124+
//
125+
// public final float getFloat(Object obj, int index) throws SQLException{
126+
// if(obj instanceof ResultSet){
127+
// return ((ResultSet) obj).getFloat(index + 1);
128+
// }else if(obj instanceof String[]){
129+
// return Float.valueOf(((String[]) obj)[index]);
130+
// }else{
131+
// throw new IllegalArgumentException("Input must be a ResultSet or String[]");
132+
// }
133+
// }
134+
//
135+
// public final double getDouble(Object obj, int index) throws SQLException{
136+
// if(obj instanceof ResultSet){
137+
// return ((ResultSet) obj).getDouble(index + 1);
138+
// }else if(obj instanceof String[]){
139+
// return Double.valueOf(((String[]) obj)[index]);
140+
// }else{
141+
// throw new IllegalArgumentException("Input must be a ResultSet or String[]");
142+
// }
143+
// }
144+
//
145+
// public final String getString(Object obj, int index) throws SQLException{
146+
// if(obj instanceof ResultSet){
147+
// return ((ResultSet) obj).getString(index + 1);
148+
// }else if(obj instanceof String[]){
149+
// return ((String[]) obj)[index];
150+
// }else{
151+
// throw new IllegalArgumentException("Input must be a ResultSet or String[]");
152+
// }
153+
// }
154+
//
155+
}

src/org/broad/igv/dev/IParser.java

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (c) 2007-2012 The Broad Institute, Inc.
3+
* SOFTWARE COPYRIGHT NOTICE
4+
* This software and its documentation are the copyright of the Broad Institute, Inc. All rights are reserved.
5+
*
6+
* This software is supplied without any warranty or guaranteed support whatsoever. The Broad Institute is not responsible for its use, misuse, or functionality.
7+
*
8+
* This software is licensed under the terms of the GNU Lesser General Public License (LGPL),
9+
* Version 2.1 which is available at http://www.opensource.org/licenses/lgpl-2.1.php.
10+
*/
11+
12+
package org.broad.igv.dev;
13+
14+
import org.broad.igv.exceptions.ParserException;
15+
16+
/**
17+
* User: jacob
18+
* Date: 2012-Aug-30
19+
*/
20+
public interface IParser<TContainer, TIndex> {
21+
22+
byte getByte(TContainer obj, TIndex index) throws ParserException;
23+
24+
short getShort(TContainer obj, TIndex index) throws ParserException;
25+
26+
int getInt(TContainer obj, TIndex index) throws ParserException;
27+
28+
float getFloat(TContainer obj, TIndex index) throws ParserException;
29+
30+
double getDouble(TContainer obj, TIndex index) throws ParserException;
31+
32+
String getString(TContainer obj, TIndex index) throws ParserException;
33+
34+
/**
35+
* Return the number of data objects contained.
36+
* For an array, this would be the length
37+
*
38+
* @param obj
39+
* @return
40+
* @throws ParserException
41+
*/
42+
int size(TContainer obj) throws ParserException;
43+
}

0 commit comments

Comments
 (0)