Skip to content

Commit

Permalink
always output citations file
Browse files Browse the repository at this point in the history
  • Loading branch information
GuyBaele committed May 15, 2024
1 parent f84235f commit 581f665
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions src/dr/app/beast/BeastMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public BeastMain(File inputFile, BeastConsoleApp consoleApp, int maxErrorCount,

String fileName = inputFile.getName();

final Logger infoLogger = Logger.getLogger("dr.app.beast");
final Logger infoLogger = Logger.getLogger("dr.apps.beast");
try {

FileReader fileReader = new FileReader(inputFile);
Expand Down Expand Up @@ -133,11 +133,14 @@ public boolean isLoggable(LogRecord record) {
});
infoLogger.addHandler(errorHandler);

if (System.getProperty("citations.filename") != null) {
/*if (System.getProperty("citations.filename") != null) {
FileOutputStream citationStream = new FileOutputStream(System.getProperty("citations.filename"));
Handler citationHandler = new MessageLogHandler(citationStream);
Logger.getLogger("dr.apps.beast").addHandler(citationHandler);
}
}*/
FileOutputStream citationStream = new FileOutputStream("citations.txt");

This comment has been minimized.

Copy link
@msuchard

msuchard May 15, 2024

Member

can we use the XML file_stem name (like we do for the *.ops report) to make the citation file? my issue is: peeps will lose track of which citations.txt refers to their actual analysis.

This comment has been minimized.

Copy link
@msuchard

msuchard May 15, 2024

Member

This comment has been minimized.

Copy link
@rambaut

rambaut May 15, 2024

Contributor

If the citations.filename property is set then it should use that file name. Otherwise - yes - take the stem of the input XML file by default. Possibly add a command line option 'no_citations' to turn it off.

This comment has been minimized.

Copy link
@rambaut

rambaut May 15, 2024

Contributor

I.e., a citations.off = true property is set by the command line option.

Handler citationHandler = new MessageLogHandler(citationStream);
Logger.getLogger("dr.app.beast").addHandler(citationHandler);

logger.setUseParentHandlers(false);

Expand Down
10 changes: 5 additions & 5 deletions src/dr/app/beast/BeastParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ private void loadProperties(Class c, String parsersFile, boolean verbose, boolea

@Override
protected void executingRunnable() {
Logger.getLogger("dr.apps.beast").info("\nCitations for this analysis: ");
Logger.getLogger("dr.app.beast").info("\nCitations for this analysis: ");

Map<String, Set<Pair<String, String>>> categoryMap = new LinkedHashMap<String, Set<Pair<String, String>>>();

Expand All @@ -222,22 +222,22 @@ protected void executingRunnable() {
}

for (String category : categoryMap.keySet()) {
Logger.getLogger("dr.apps.beast").info("\n"+category.toUpperCase());
Logger.getLogger("dr.app.beast").info("\n"+category.toUpperCase());
Set<Pair<String, String>> pairSet = categoryMap.get(category);

for (Pair<String, String>keyPair : pairSet) {
Logger.getLogger("dr.apps.beast").info(keyPair.second + ":");
Logger.getLogger("dr.app.beast").info(keyPair.second + ":");

for (Citation citation : getCitationStore().get(keyPair)) {
Logger.getLogger("dr.apps.beast").info("\t" + citation.toString());
Logger.getLogger("dr.app.beast").info("\t" + citation.toString());
}
}
}

// clear the citation store so all the same citations don't get cited again
getCitationStore().clear();

Logger.getLogger("dr.apps.beast").info("\n");
Logger.getLogger("dr.app.beast").info("\n");

}

Expand Down

0 comments on commit 581f665

Please sign in to comment.