Skip to content

Commit 45975b8

Browse files
committed
Correcting proble due to new version of cooltools. Now it should work with the most recent cooler and cooltools versions too.
1 parent 936b6be commit 45975b8

4 files changed

Lines changed: 46 additions & 21 deletions

File tree

dependency-reduced-pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>SIP</groupId>
55
<artifactId>SIP</artifactId>
6-
<version>1.6.4</version>
6+
<version>1.6.5</version>
77
<developers>
88
<developer>
99
<id>axpoulet</id>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77
<groupId>SIP</groupId>
88
<artifactId>SIP</artifactId>
9-
<version>1.6.4</version>
9+
<version>1.6.5</version>
1010

1111
<dependencies>
1212

src/main/java/plop/test/TestCoolFormat.java

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,33 @@
66
import java.util.ArrayList;
77
import java.util.HashMap;
88

9+
import plop.multiProcesing.ProcessCoolerDumpData;
10+
import plop.process.CoolerDumpData;
911
import plop.process.MultiResProcess;
12+
import plop.utils.CoolerExpected;
1013
import plop.utils.SIPObject;
1114
@SuppressWarnings("unused")
1215
public class TestCoolFormat {
1316

1417
public static void main(String[] args) throws IOException, InterruptedException {
1518
String chr = "chr21";
1619
//String input = "/home/plop/Desktop/SIP/testCooler/GM12878_4DNFIXP4QG5B.mcool";
17-
String input = "/home/plop/Desktop/CoolTest21";
18-
String output = "/home/plop/Desktop/CoolTest21Bis";
19-
String expectedFile = "/home/plop/Desktop/chr21Cooler/expected.txt";
20-
String fileChr = "/home/plop/Desktop/w_hg19.sizes";
21-
String cooler = "/home/plop/anaconda3/bin/cooler";
22-
String cooltools = "/home/plop/anaconda3/bin/cooltools";
20+
String input = "//home/plop/Desktop/coolTest/MCF7_863.mcool";
21+
String output = "/home/plop/Desktop/coolTest/test";
22+
String expectedFile = "/home/plop/Desktop/coolTest/test/expected.txt";
23+
String fileChr = "/home/plop/Desktop/coolTest/chr22.txt";
24+
String cooler = "/home/plop/anaconda3/envs/cooler/bin/cooler";
25+
String cooltools = "/home/plop/anaconda3/envs/cooler/bin/cooltools";
2326
HashMap<String,Integer> chrsize = readChrSizeFile(fileChr);
24-
int resolution = 5000;
27+
int resolution = 40000;
2528
int matrixSize = 2000;
26-
//CoolerExpected expected = new CoolerExpected(input, resolution, matrixSize);
29+
int cpu = 5;
30+
//CoolerExpected expected = new CoolerExpected(cooltools, input, resolution, matrixSize,cpu);
2731
//expected.dumpExpected(expectedFile);
2832
//CoolerExpected expected = new CoolerExpected(expectedFile, matrixSize);
2933
//expected.parseExpectedFile();
3034
//ArrayList<Double> plop = expected.getExpected(chr);
31-
//CoolerDumpData cooler = new CoolerDumpData(input, resolution, plop);
35+
//CoolerDumpData coolerD = new CoolerDumpData(cooler,input);
3236
//run(resolution,matrixSize,matrixSize/2,chr,output, cooler, 46709983);
3337

3438
int diagSize = 5;
@@ -40,20 +44,21 @@ public static void main(String[] args) throws IOException, InterruptedException
4044
double saturatedPixel = 0.01;
4145
ArrayList<Integer> factor = new ArrayList<Integer>();
4246
factor.add(1);
43-
factor.add(2);
44-
factor.add(5);
45-
boolean keepTif = false;
46-
int cpu = 1;
47+
//factor.add(2);
48+
//factor.add(5);
49+
boolean keepTif = true;
50+
4751

48-
SIPObject sip = new SIPObject(input,output, chrsize, gauss, min, max, resolution, saturatedPixel, thresholdMax, diagSize, matrixSize, nbZero,factor,0.03,keepTif,false);
52+
SIPObject sip = new SIPObject(input,output, chrsize, gauss, min, max, resolution, saturatedPixel, thresholdMax,
53+
diagSize, matrixSize, nbZero,factor,0.03,keepTif,false);
4954
sip.setIsGui(false);
5055
sip.setIsCooler(true);
51-
sip.setIsProcessed(true);
56+
sip.setIsProcessed(false);
5257

5358

54-
//ProcessCoolerDumpData processDumpData = new ProcessCoolerDumpData();
55-
// go(String coolTools, String cooler, SIPObject sip, String coolFile, HashMap<String,Integer> chrSize,int nbCPU)
56-
//processDumpData.go(cooltools, cooler, sip, input, chrsize,2);
59+
ProcessCoolerDumpData processDumpData = new ProcessCoolerDumpData();
60+
//go(String coolTools, String cooler, SIPObject sip, String coolFile, HashMap<String,Integer> chrSize,int nbCPU)
61+
processDumpData.go(cooltools, cooler, sip, input, chrsize,2);
5762
MultiResProcess multi = new MultiResProcess(sip, cpu, keepTif,fileChr);
5863
multi.run();
5964

src/main/java/plop/utils/CoolerExpected.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,23 @@ public boolean dumpExpected(String expected){
6969
new ReturnFlux(process.getErrorStream()).start();
7070
exitValue=process.waitFor();
7171

72+
if(_logError.contains("Error")){
73+
System.out.println(_logError);
74+
System.out.println("cooltools error !!!!");
75+
System.exit(0);
76+
}
77+
}else if(_logError.contains("Error") && _logError.contains("No such command")){
78+
runtime = Runtime.getRuntime();
79+
_logError ="";
80+
System.out.println(_logError);
81+
cmd = this._coolTools+" expected-cis "+_coolFile+" -p "+_cpu+" --ignore-diags 0 -o "+expected;
82+
System.out.println(cmd);
83+
process = runtime.exec(cmd);
84+
85+
new ReturnFlux(process.getInputStream()).start();
86+
new ReturnFlux(process.getErrorStream()).start();
87+
exitValue=process.waitFor();
88+
7289
if(_logError.contains("Error")){
7390
System.out.println(_logError);
7491
System.out.println("cooltools error !!!!");
@@ -91,7 +108,10 @@ public void parseExpectedFile() throws IOException {
91108
String line = br.readLine();
92109
for (line = null; (line = br.readLine()) != null;){
93110
String [] tline = line.split("\t");
94-
if(Integer.parseInt(tline[1]) < this._imgSize) {
111+
int a = Integer.parseInt(tline[2]);
112+
if(!tline[1].equals(tline[0]))
113+
a = Integer.parseInt(tline[2]);
114+
if(a < this._imgSize) {
95115
if(!tline[tline.length-1].equals("nan")){
96116
if (_hashExpected.containsKey(tline[0])){
97117
ArrayList<Double> lExpected = _hashExpected.get(tline[0]);

0 commit comments

Comments
 (0)