Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dhuson committed Feb 21, 2021
1 parent bc37523 commit 81da38a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
24 changes: 12 additions & 12 deletions src/megan/core/Document.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
8 changes: 5 additions & 3 deletions src/megan/core/MeganFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down Expand Up @@ -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;
}

Expand Down
5 changes: 2 additions & 3 deletions src/megan/daa/io/DAAParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 81da38a

Please sign in to comment.