Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fixes #996

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/juicebox/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.io.File;

public class MainWindow extends JFrame {

Expand Down Expand Up @@ -420,11 +421,11 @@ public void exitActionPerformed() {
if (option == 0) {
setVisible(false);
dispose();
String autoSaveFileName = DirectoryManager.getHiCDirectory() + "/" +
String autoSaveFileName = DirectoryManager.getHiCDirectory() + File.separator +
System.nanoTime() + ".review.autosave.assembly";
try {
autoSaveFileName = DirectoryManager.getHiCDirectory() + "/" +
(SuperAdapter.getDatasetTitle().split(".+?/(?=[^/]+$)")[1]).split("\\.(?=[^\\.]+$)")[0] +
autoSaveFileName = DirectoryManager.getHiCDirectory() + File.separator +
(SuperAdapter.getDatasetTitle().split(".+?(/|\\\\)(?=[^(/|\\\\)]+$)")[1]).split("\\.(?=[^\\.]+$)")[0] +
".review.autosave.assembly";
} catch (Exception e) {
System.err.println("Unable to get desired file name");
Expand Down
3 changes: 2 additions & 1 deletion src/juicebox/assembly/AssemblyStateTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import juicebox.HiCGlobals;
import juicebox.gui.SuperAdapter;

import java.io.File;
import java.util.Stack;

/**
Expand All @@ -48,7 +49,7 @@ public AssemblyStateTracker(AssemblyScaffoldHandler assemblyScaffoldHandler, Sup
redoStack = new Stack<>();
this.initialAssemblyScaffoldHandler = assemblyScaffoldHandler;
this.superAdapter = superAdapter;
this.autoSaveFileName = DirectoryManager.getHiCDirectory() + "/" + (SuperAdapter.getDatasetTitle().split(".+?/(?=[^/]+$)")[1]).split("\\.(?=[^\\.]+$)")[0] + ".review.autosave";
this.autoSaveFileName = DirectoryManager.getHiCDirectory() + File.separator + (SuperAdapter.getDatasetTitle().split(".+?(/|\\\\)(?=[^(/|\\\\)]+$)")[1]).split("\\.(?=[^\\.]+$)")[0] + ".review.autosave";
}

public AssemblyScaffoldHandler getAssemblyHandler() {
Expand Down
5 changes: 3 additions & 2 deletions src/juicebox/data/AbstractDatasetReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.File;

/**
* Abstract base class for methods that can be shared by V1 and V2 readers.
Expand Down Expand Up @@ -63,9 +64,9 @@ public double[] readEigenvector(String chrName, HiCZoom zoom, int number, String

// If there's an eigenvector file load it
String rootPath = FileUtils.getParent(path);
String folder = rootPath + "/" + chrName;
String folder = rootPath + File.separator + chrName;
String eigenFile = "eigen" + "_" + chrName + "_" + chrName + "_" + zoom.getBinSize() + "_" + type + ".wig";
String fullPath = folder + "/" + eigenFile;
String fullPath = folder + File.separator + eigenFile;

if (FileUtils.resourceExists(fullPath)) {
System.out.println("Reading " + fullPath);
Expand Down
3 changes: 2 additions & 1 deletion src/juicebox/data/Dataset.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.*;
import java.io.File;

/**
* @author jrobinso
Expand Down Expand Up @@ -384,7 +385,7 @@ private String convertStats(String oldStats) {
" <tr> <td> Experiment #:</td> <td>";
String filename = reader.getPath();
boolean mapq30 = filename.lastIndexOf("_30") > 0;
String[] parts = filename.split("/");
String[] parts = filename.split("(/|\\\\\\\\)");
newStats += parts[parts.length - 2];
newStats += "</td></tr>";
newStats += "<tr> <td> Restriction Enzyme:</td><td>";
Expand Down
7 changes: 4 additions & 3 deletions src/juicebox/gui/SuperAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import java.io.File;

/**
* Created by muhammadsaadshamim on 8/4/15.
Expand Down Expand Up @@ -391,8 +392,8 @@ private static boolean genomesAreCompatible(Dataset dataset1, Dataset dataset2)
return true;
}

String[] g1 = dataset1.getGenomeId().split("/");
String[] g2 = dataset2.getGenomeId().split("/");
String[] g1 = dataset1.getGenomeId().split(File.separator);
String[] g2 = dataset2.getGenomeId().split(File.separator);
if (g1[g1.length - 1].equalsIgnoreCase(g2[g2.length - 1])) {
return true;
}
Expand Down Expand Up @@ -725,7 +726,7 @@ private void updateTitle() {
if (controlTitle != null && controlTitle.length() > 0) {
newTitle += " (control=" + controlTitle + ")";
try {
fileVersions += "/" + hic.getControlDataset().getVersion();
fileVersions += File.separator + hic.getControlDataset().getVersion();
} catch (Exception ignored) {
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/juicebox/tools/clt/juicer/MotifFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.io.File;

/**
* Created by muhammadsaadshamim on 9/4/15.
Expand Down Expand Up @@ -272,7 +273,7 @@ private void retrieveAllBEDFiles(String path) throws IOException {
String inferredBEDFilesPath = path + "/inferred";

// if the '/' was already included
if (path.endsWith("/")) {
if (path.endsWith(File.separator)) {
uniqueBEDFilesPath = path + "unique";
inferredBEDFilesPath = path + "inferred";
}
Expand Down
3 changes: 2 additions & 1 deletion src/juicebox/tools/clt/old/BPToFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
import java.io.File;


public class BPToFragment extends JuiceboxCLT {
Expand Down Expand Up @@ -84,7 +85,7 @@ private static void bpToFrag(String fragmentFile, String inputFile, String outpu
String nextLine;
while ((nextLine = reader.readLine()) != null) {
String path = nextLine.trim();
int lastSlashIdx = path.lastIndexOf("/");
int lastSlashIdx = path.lastIndexOf(File.separator);
if (lastSlashIdx < 0) lastSlashIdx = path.lastIndexOf("\\"); // Windows convention
String fn = lastSlashIdx < 0 ? path : path.substring(lastSlashIdx);

Expand Down
5 changes: 3 additions & 2 deletions src/juicebox/tools/clt/old/LibraryComplexity.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.Locale;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.io.File;

public class LibraryComplexity extends JuiceboxCLT {

Expand Down Expand Up @@ -231,9 +232,9 @@ public void run() {
Future<Long> futureUniqueReads = executor.submit(taskUniqueReads);
Future<Long> futureDupReadPairs = executor.submit(taskDupReadPairs);

File f = new File(localWorkingDirectory + "/" + fileName);
File f = new File(localWorkingDirectory + File.separator + fileName);
if (f.exists()) {
BufferedReader reader = new BufferedReader(new FileReader(localWorkingDirectory + "/" + fileName));
BufferedReader reader = new BufferedReader(new FileReader(localWorkingDirectory + File.separator + fileName));
String line = reader.readLine();
boolean done = false;
while (line != null && !done) {
Expand Down
3 changes: 2 additions & 1 deletion src/juicebox/tools/dev/APAvsDistance.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.io.File;


/**
Expand Down Expand Up @@ -219,7 +220,7 @@ public void run() {
XYSeries XYresults = new XYSeries("APA Result: " + resolution);
for (int i = 0; i < numBuckets; i++) {
APA apa = new APA();
apa.initializeDirectly(hicFilePaths, PeaksFile, SaveFolderPath + "/" + (int) minPeakDist + "-" + (int) maxPeakDist, new int[]{resolution}, minPeakDist, maxPeakDist);
apa.initializeDirectly(hicFilePaths, PeaksFile, SaveFolderPath + File.separator + (int) minPeakDist + "-" + (int) maxPeakDist, new int[]{resolution}, minPeakDist, maxPeakDist);
windows[i] = minPeakDist + "-" + maxPeakDist;
System.out.println("Bucket:" + (i + 1) + " Window: " + windows[i]);

Expand Down
3 changes: 2 additions & 1 deletion src/juicebox/tools/dev/TriplesAPA.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.*;
import java.io.File;

public class TriplesAPA extends JuicerCLT {
public TriplesAPA() {
Expand Down Expand Up @@ -155,7 +156,7 @@ public void process(String chr, List<IntraChromTriple> tripleList) {
int min = Collections.min(plot3D.values());

int limit = Math.max((2 * max) / 3, min * 2);
System.out.println(chr + " max/min/limit vals: " + max + "/" + min + "/" + limit);
System.out.println(chr + " max/min/limit vals: " + max + File.separator + min + File.separator + limit);
for (String key : plot3D.keySet()) {
int val = plot3D.get(key);
if (val > limit) {
Expand Down
3 changes: 2 additions & 1 deletion src/juicebox/track/LoadAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.io.File;


/**
Expand Down Expand Up @@ -253,7 +254,7 @@ private ArrayList<String> getAvaliableXmlResourses() throws Exception {
jar.close();
} else { // Run with IDE
System.out.println("Within IDE");
URL url = MainWindow.class.getResource("/" + resourses_path);
URL url = MainWindow.class.getResource(File.separator + resourses_path);
if (url != null) {
try {
final File apps = new File(url.toURI());
Expand Down
2 changes: 1 addition & 1 deletion src/juicebox/windowui/SaveAssemblyDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void menuOptions() {
assemblyFileExporter.exportAssemblyFile();
}

String autoSaveFileName = DirectoryManager.getHiCDirectory() + "/" + (SuperAdapter.getDatasetTitle().split(".+?/(?=[^/]+$)")[1]).split("\\.(?=[^\\.]+$)")[0] + ".review.autosave.assembly";
String autoSaveFileName = DirectoryManager.getHiCDirectory() + File.separator + (SuperAdapter.getDatasetTitle().split(".+?(/|\\\\)(?=[^(/|\\\\)]+$)")[1]).split("\\.(?=[^\\.]+$)")[0] + ".review.autosave.assembly";
File autoSaveFile = new File(autoSaveFileName);
autoSaveFile.delete();
}
Expand Down