Skip to content

Commit

Permalink
changing hardcoded "/" mac file seperator
Browse files Browse the repository at this point in the history
  • Loading branch information
MahdiSayadSadr committed Oct 6, 2022
1 parent 78c4f8e commit 2c283e5
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 16 deletions.
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
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("(/|\\\\\\\\)");

This comment has been minimized.

Copy link
@sa501428

sa501428 Oct 6, 2022

Member

@MahdiSayadSadr is this correct? should it be /|\\?

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

0 comments on commit 2c283e5

Please sign in to comment.