From 81da38a64f3e2856a0a3239f9939d0fdb2fdb9f8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 21 Feb 2021 18:56:08 +0100 Subject: [PATCH] bug fix --- src/megan/core/Document.java | 24 ++++++++++++------------ src/megan/core/MeganFile.java | 8 +++++--- src/megan/daa/io/DAAParser.java | 5 ++--- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/megan/core/Document.java b/src/megan/core/Document.java index b2c3ec0a..8570a2b9 100644 --- a/src/megan/core/Document.java +++ b/src/megan/core/Document.java @@ -974,19 +974,19 @@ public int getPairedReadSuffixLength() { public BlastMode getBlastMode() { BlastMode blastMode = dataTable.getBlastMode(); if (blastMode == BlastMode.Unknown) { - if (meganFile.isDAAFile()) { - dataTable.setBlastMode(0, DAAParser.getBlastMode(meganFile.getFileName())); - } else if (meganFile.isRMA3File()) { - try (final RMA3File rma3File = new RMA3File(meganFile.getFileName(), "r")) { - dataTable.setBlastMode(0, rma3File.getBlastMode()); - } catch (IOException ignored) { - } - } else if (meganFile.isRMA6File()) { - try (final RMA6File rma6File = new RMA6File(meganFile.getFileName(), "r")) { - dataTable.setBlastMode(0, rma6File.getHeaderSectionRMA6().getBlastMode()); - } catch (IOException ignored) { + if (meganFile.isDAAFile()) { + dataTable.setBlastMode(0, DAAParser.getBlastMode(meganFile.getFileName())); + } else if (meganFile.isRMA3File()) { + try (final RMA3File rma3File = new RMA3File(meganFile.getFileName(), "r")) { + dataTable.setBlastMode(0, rma3File.getBlastMode()); + } catch (IOException ignored) { + } + } else if (meganFile.isRMA6File()) { + try (final RMA6File rma6File = new RMA6File(meganFile.getFileName(), "r")) { + dataTable.setBlastMode(0, rma6File.getHeaderSectionRMA6().getBlastMode()); + } catch (IOException ignored) { + } } - } } if (blastMode == BlastMode.Unknown && !meganFile.isMeganSummaryFile() && meganFile.hasDataConnector() && !meganFile.isMeganServerFile()) { diff --git a/src/megan/core/MeganFile.java b/src/megan/core/MeganFile.java index 9f3c64bd..c7316a43 100644 --- a/src/megan/core/MeganFile.java +++ b/src/megan/core/MeganFile.java @@ -66,8 +66,8 @@ public void setFileFromExistingFile(String fileName, boolean readOnly) { this.fileName = fileName; this.readOnly = readOnly; - if (fileName.contains("::")) - meganServerFile = true; + meganServerFile = fileName.contains("::"); + if (fileName.toLowerCase().endsWith(".rma1")) { fileType = Type.RMA1_FILE; } else if (fileName.toLowerCase().endsWith(".rma2")) { @@ -173,8 +173,10 @@ public String getFileName() { } public void setFileName(String fileName) { - if (fileName == null || !fileName.equals(this.fileName)) + if (fileName == null || !fileName.equals(this.fileName)) { connector = null; + meganServerFile=false; + } this.fileName = fileName; } diff --git a/src/megan/daa/io/DAAParser.java b/src/megan/daa/io/DAAParser.java index 0d227542..2d30c865 100644 --- a/src/megan/daa/io/DAAParser.java +++ b/src/megan/daa/io/DAAParser.java @@ -137,10 +137,9 @@ public static jloda.util.BlastMode getBlastMode(String fileName) { try { DAAParser daaParser = new DAAParser(fileName); return daaParser.getBlastMode(); - } catch (IOException e) { - Basic.caught(e); - return jloda.util.BlastMode.Unknown; + } catch (IOException ignored) { } + return jloda.util.BlastMode.Unknown; } /**