Skip to content

Commit bb7e9aa

Browse files
Missing file/duplicate file issue
1 parent 0a54839 commit bb7e9aa

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

oxo2-dataload/oxo2-sssom2json/src/main/java/uk/ac/ebi/spot/oxo/sssom2json/SSSOM2JSON.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ public static void main(String[] args) throws IOException {
118118
private static void processMappingSets(String inputDirectory, String outputDirectory) throws IOException {
119119
Stream<Path> directoriesOfMappingSets = getDirectories(inputDirectory);
120120

121+
// List<Path> listOfDirectoriesOfMappingSets = directoriesOfMappingSets.collect(Collectors.toList());
122+
121123
String mappingSetDirectory = outputDirectory + File.separator + "mappingSet";
122124
String mappingDirectory = outputDirectory + File.separator + "mapping";
123125

@@ -142,14 +144,24 @@ private static void processMappingSets(String inputDirectory, String outputDirec
142144

143145
private static Stream<Path> getDirectories(String inputDirectory) throws IOException {
144146
try (Stream<Path> paths = Files.walk(Paths.get(inputDirectory))) {
145-
return paths.filter(Files::isDirectory).collect(Collectors.toList()).stream();
146-
147+
return paths
148+
.filter(Files::isDirectory)
149+
.map(path -> {
150+
try {
151+
return path.toRealPath();
152+
} catch (IOException e) {
153+
return path.toAbsolutePath().normalize();
154+
}
155+
})
156+
.distinct()
157+
.collect(Collectors.toList())
158+
.stream();
147159
} catch (IOException e) {
148160
logger.error("Error traversing input directory", e);
149161
throw new IOException("Error traversing input directory", e);
150162
}
151163
}
152-
164+
153165
private static Options getOptions() {
154166
Options options = new Options();
155167

oxo2-dataload/oxo2-sssom2json/src/main/java/uk/ac/ebi/spot/oxo/sssom2json/parser/TSV2JSON.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public static void processDirectory(String directory, String mappingSetOutputDir
9494

9595
Map<String, MappingSet.Builder> filenameToExternalMetadataMap = readExternalMetadata(directory);
9696

97-
try (Stream<Path> paths = Files.walk(Paths.get(directory))) {
97+
try (Stream<Path> paths = Files.list(Paths.get(directory))) {
9898
paths
9999
.filter(Files::isRegularFile)
100100
.filter(path -> path.toString().endsWith(".tsv"))

0 commit comments

Comments
 (0)