Skip to content

Commit 359bdb9

Browse files
Merge 25.2 to develop
2 parents bb6bec2 + a5239d2 commit 359bdb9

18 files changed

+139
-19
lines changed

panoramapublic/src/org/labkey/panoramapublic/proteomexchange/validator/SpecLibValidator.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@
3131
import java.util.ArrayList;
3232
import java.util.Collections;
3333
import java.util.Comparator;
34+
import java.util.HashMap;
3435
import java.util.HashSet;
3536
import java.util.List;
37+
import java.util.Map;
3638
import java.util.Objects;
3739
import java.util.Set;
3840
import java.util.stream.Collectors;
@@ -210,6 +212,16 @@ private void validateLibrarySources(List<LibSourceFile> sources, FileContentServ
210212
// folder as well as any subfolders containing documents that have the library
211213
Set<Container> containers = getDocsWithLibrary().stream().map(dl -> dl.getRun().getContainer()).collect(Collectors.toSet());
212214
containers.add(expAnnotations.getContainer());
215+
Set<Path> rawFilesDirPaths = new HashSet<>();
216+
for (Container container: containers)
217+
{
218+
var rawFilesDirPath = DataValidator.getRawFilesDirPath(container, fcs);
219+
// We will look in the "RawFiles" directory only if it exists.
220+
if (Files.exists(rawFilesDirPath))
221+
{
222+
rawFilesDirPaths.add(rawFilesDirPath);
223+
}
224+
}
213225

214226
List<SpecLibSourceFile> spectrumFiles = new ArrayList<>();
215227
List<SpecLibSourceFile> idFiles = new ArrayList<>();
@@ -220,7 +232,7 @@ private void validateLibrarySources(List<LibSourceFile> sources, FileContentServ
220232
if (source.hasSpectrumSourceFile() && !checkedFiles.contains(ssf))
221233
{
222234
checkedFiles.add(ssf);
223-
Path path = getPath(ssf, containers, source.isMaxQuantSearch(), fcs);
235+
Path path = getPath(ssf, rawFilesDirPaths, source.isMaxQuantSearch(), fcs);
224236
SpecLibSourceFile sourceFile = new SpecLibSourceFile(ssf, SPECTRUM);
225237
sourceFile.setSpecLibValidationId(getId());
226238
sourceFile.setPath(path != null ? path.toString() : DataFile.NOT_FOUND);
@@ -230,7 +242,7 @@ private void validateLibrarySources(List<LibSourceFile> sources, FileContentServ
230242
if (source.hasIdFile() && !checkedFiles.contains(idFile))
231243
{
232244
checkedFiles.add(idFile);
233-
Path path = getPath(idFile, containers, false, fcs);
245+
Path path = getPath(idFile, rawFilesDirPaths, false, fcs);
234246
SpecLibSourceFile sourceFile = new SpecLibSourceFile(idFile, PEPTIDE_ID);
235247
sourceFile.setSpecLibValidationId(getId());
236248
sourceFile.setPath(path != null ? path.toString() : DataFile.NOT_FOUND);
@@ -241,11 +253,10 @@ private void validateLibrarySources(List<LibSourceFile> sources, FileContentServ
241253
setIdFiles(idFiles);
242254
}
243255

244-
private Path getPath(String name, Set<Container> containers, boolean isMaxquant, FileContentService fcs)
256+
private Path getPath(String name, Set<Path> rawFilesDirPaths, boolean isMaxquant, FileContentService fcs)
245257
{
246-
for (Container container: containers)
258+
for (Path rawFilesDir: rawFilesDirPaths)
247259
{
248-
java.nio.file.Path rawFilesDir = DataValidator.getRawFilesDirPath(container, fcs);
249260
Path path = findInDirectoryTree(rawFilesDir, name, isMaxquant);
250261
if (path != null)
251262
{

0 commit comments

Comments
 (0)