Skip to content

Commit a911587

Browse files
committed
If the chr is without read avoid the error and continue the process
1 parent d2e456f commit a911587

5 files changed

Lines changed: 38 additions & 50 deletions

File tree

SIP.iml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,7 @@
1717
<excludeFolder url="file://$MODULE_DIR$/target" />
1818
</content>
1919
<orderEntry type="sourceFolder" forTests="false" />
20-
<orderEntry type="module-library">
21-
<library name="Auto_Threshold-1.16.1.jar">
22-
<CLASSES>
23-
<root url="jar://$MODULE_DIR$/../jar/Auto_Threshold-1.16.1.jar!/" />
24-
</CLASSES>
25-
<JAVADOC />
26-
<SOURCES />
27-
</library>
28-
</orderEntry>
29-
<orderEntry type="module-library">
30-
<library name="MorphoLibJ_-1.3.3.jar">
31-
<CLASSES>
32-
<root url="jar://$MODULE_DIR$/../jar/MorphoLibJ_-1.3.3.jar!/" />
33-
</CLASSES>
34-
<JAVADOC />
35-
<SOURCES />
36-
</library>
37-
</orderEntry>
3820
<orderEntry type="inheritedJdk" />
39-
<orderEntry type="module-library">
40-
<library name="ij-1.52b.jar">
41-
<CLASSES>
42-
<root url="jar://$MODULE_DIR$/../jar/ij-1.52b.jar!/" />
43-
</CLASSES>
44-
<JAVADOC />
45-
<SOURCES />
46-
</library>
47-
</orderEntry>
48-
<orderEntry type="library" name="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER" level="application" />
4921
<orderEntry type="library" name="Maven: sc.fiji:Auto_Threshold:1.17.2" level="project" />
5022
<orderEntry type="library" name="Maven: net.imagej:ij:1.51n" level="project" />
5123
<orderEntry type="library" name="Maven: fr.inra.ijpb:MorphoLibJ_:1.4.0" level="project" />
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Manifest-Version: 1.0
2+
Main-Class: sipMain.Hic_main
3+

src/multiProcesing/RunnableDumpDataHiC.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,16 @@ public void run(){
6767
_step = matrixSize/2;
6868
String nameRes = String.valueOf(res);
6969
nameRes = nameRes.replace("000", "");
70-
nameRes = nameRes+"kb";
71-
String outdir = this._outdir+File.separator+nameRes+File.separator+this._chrName+File.separator;
70+
nameRes = nameRes+"kb";
71+
String outdir = this._outdir+nameRes+File.separator+this._chrName+File.separator;
7272
File file = new File(outdir);
7373
if (file.exists()==false) file.mkdirs();
7474
int step = this._step*res;
7575
int j = matrixSize*res;
7676
String test = this._chrName+":0:"+j;
7777
String name = outdir+this._chrName+"_0_"+j+".txt";
7878
this._dumpData.getExpected(test,name,res);
79-
String normOutput = this._outdir+File.separator+nameRes+File.separator+"normVector";
79+
String normOutput = this._outdir+nameRes+File.separator+"normVector";
8080
file = new File(normOutput);
8181
if (file.exists()==false) file.mkdir();
8282
try {
@@ -89,21 +89,14 @@ public void run(){
8989
name = outdir+this._chrName+"_"+i+"_"+end+".txt";
9090
System.out.println("start dump "+this._chrName+" size "+this._chrSize+" dump "+dump+" res "+ nameRes);
9191
juicerTools = this._dumpData.dumpObservedMExpected(dump,name,res);
92-
if (juicerTools == false){
93-
System.out.print(dump+" "+"\n"+juicerTools+"\n");
94-
System.exit(0);
95-
}
9692
if(j+step > this._chrSize && j < this._chrSize){
9793
j= this._chrSize;
9894
i+=step;
9995
dump = this._chrName+":"+i+":"+j;
10096
name = outdir+this._chrName+"_"+i+"_"+j+".txt";
10197
System.out.println("start dump "+this._chrName+" size "+this._chrSize+" dump "+dump+" res "+ nameRes);
10298
juicerTools = this._dumpData.dumpObservedMExpected(dump,name,res);
103-
if (juicerTools == false){
104-
System.out.print(dump+" "+"\n"+juicerTools+"\n");
105-
System.exit(0);
106-
}
99+
107100
}
108101
}
109102
System.out.println("##### End dump "+this._chrName+" "+nameRes);

src/process/DumpData.java

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public class DumpData {
5252
* @param juiceboxTools: String: path of juicertoolsBox
5353
* @param hicFile: String: path to the HiC file
5454
* @param norm: String: type of normalisation
55-
* @param resolution: int: resolution of the bins
5655
*/
5756
public DumpData(String juiceboxTools,String hicFile, String norm) {
5857
this._juiceBoxTools = juiceboxTools;
@@ -84,7 +83,7 @@ public boolean dumpObservedMExpected(String chr, String output, int resolution)
8483
catch (IOException e) { e.printStackTrace();}
8584
catch (InterruptedException e) {e.printStackTrace();}
8685
observedMExpected(obs,output,resolution);
87-
if(_logError!=""){
86+
if(_logError.contains("Exception")) {
8887
System.out.println(_logError);
8988
System.exit(0);
9089
}
@@ -144,6 +143,7 @@ public boolean getExpected(String chr,String output,int resolution){
144143
Runtime runtime = Runtime.getRuntime();
145144
String expected = output.replaceAll(".txt", "_expected.txt");
146145
String cmd = "java"+" -jar "+this._juiceBoxTools+" dump expected "+this._normalisation+" "+this._hicFile+" "+chr+" BP "+resolution+" "+expected;
146+
//System.out.println(cmd);
147147
this._log = this._log+"\n"+expected+"\t"+cmd;
148148
Process process;
149149
try {
@@ -163,7 +163,7 @@ public boolean getExpected(String chr,String output,int resolution){
163163
} catch (IOException | InterruptedException e) {
164164
e.printStackTrace();
165165
}
166-
if(_logError!=""){
166+
if(_logError.contains("Exception")){
167167
System.out.println(_logError);
168168
System.exit(0);
169169
}
@@ -189,10 +189,30 @@ public boolean getNormVector(String chr,String output,int resolution) throws IOE
189189
new ReturnFlux(process.getErrorStream()).start();
190190
process.getOutputStream();
191191
exitValue=process.waitFor();
192-
if(_logError!=""){
192+
if(_logError!="" && _logError.contains("Exception") == false){
193+
System.out.println("VC vector not find, SIP is using "+this._normalisation+" for "+ chr+"\n"+_logError);
194+
runtime = Runtime.getRuntime();
195+
_logError ="";
196+
cmd = "java"+" -jar "+this._juiceBoxTools+" dump norm "+this._normalisation+" "+this._hicFile+" "+chr+" BP "+resolution+" "+output;
197+
//System.out.println(cmd);
198+
process = runtime.exec(cmd);
199+
200+
new ReturnFlux(process.getInputStream()).start();
201+
new ReturnFlux(process.getErrorStream()).start();
202+
exitValue=process.waitFor();
203+
204+
if(_logError.contains("Exception")){
205+
System.out.println(_logError);
206+
System.out.println("juicer tool error !!!! "+ chr+" "+cmd);
207+
System.exit(0);
208+
}
209+
}else if ( _logError.contains("Exception")){
193210
System.out.println(_logError);
211+
System.out.println("juicer tool error !!!! "+ chr+" "+cmd);
194212
System.exit(0);
213+
195214
}
215+
//System.out.println(_logError);
196216
return exitValue==0;
197217
}
198218

src/test/TestCallLoopsHicFile.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ public class TestCallLoopsHicFile{
3131

3232
@SuppressWarnings("unused")
3333
public static void main(String[] args) throws IOException, InterruptedException {
34-
String output= "/home/plop/Desktop/21";
34+
String output= "/home/plop/Desktop/TestErics";
3535
//output= "/home/plop/Bureau/SIPpaper/chr1/testNewNew";
3636

37-
String input = "https://hicfiles.s3.amazonaws.com/hiseq/imr90/in-situ/combined.hic";
37+
String input = "/home/plop/Desktop/SIP/Erics/MEGA_K562_WT_PMA_inter_30.hic";
3838
//input = "/home/plop/Bureau/SIPpaper/hicFileIer_0.hic"; //"https://hicfiles.s3.amazonaws.com/hiseq/gm12878/in-situ/combined_30.hic"; //";
3939
//String output= "/home/plop/Bureau/DataSetImageHiC/Hichip_H3k4me1";
4040
//String input= "/home/plop/Bureau/DataSetImageHiC/Hichip_H3k4me1/NT_H3K4me1_2Reps.cis18797450.allValidPairs.hic";
4141
//HumanGenomeHg19/chr2.size");
4242
//readChrSizeFile("/home/plop/Documents/Genome/HumanGenomeHg19/hg19_withoutChr.sizes");
4343
//chrsize = readChrSizeFile("/home/plop/Documents/Genome/mammals/HumanGenomeHg19/chr1.size");
44-
String fileChr = "/home/plop/Desktop/w_hg19.sizes";
44+
String fileChr = "/home/plop/Desktop/SIP/Erics/hg19_chromSizes.txt";
4545
HashMap<String,Integer> chrsize = readChrSizeFile(fileChr);
46-
String juiceBoxTools = "/home/plop/Tools/juicer_tools_1.13.02.jar";
46+
String juiceBoxTools = "/home/plop/Tools/juicer_tools_1.19.02.jar";
4747
int matrixSize = 2000;
48-
int resolution = 5000;
48+
int resolution = 10000;
4949
int diagSize = 5;
5050
double gauss = 1.5;
5151
double min = 2;
@@ -57,8 +57,8 @@ public static void main(String[] args) throws IOException, InterruptedException
5757

5858
ArrayList<Integer> factor = new ArrayList<Integer>();
5959
factor.add(1);
60-
factor.add(2);
61-
factor.add(5);
60+
//factor.add(2);
61+
//factor.add(5);
6262
boolean keepTif = true;
6363
int cpu = 1;
6464

0 commit comments

Comments
 (0)