Commit 7c9fb0d1 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

command line interface added + README

parent 5f69799f
# Map generator
This code assemble resources into a single map.
## Requirements
* Java 8
* Maven 3.6
## Compilation
```
mvn -DskipTests=true clean install -pl biohackathon -am
```
The compiled runnable file will be located in biohackathon/target/biohackathon-1.0-jar-with-dependencies.jar.
## Execution
To get information about parameters just run:
```
java -jar biohackathon/target/biohackathon-1.0-jar-with-dependencies.jar
```
Sample usage:
```
java -jar biohackathon/target/biohackathon-1.0-jar-with-dependencies.jar --enrichr-file biohackathon/data/enrichr_output.txt --minerva-file biohackathon/data/example_pathway_to_pull.txt --text-mining-file biohackathon/data/brugada_output_file_omnipath.tsv --output-file output.xml
```
This diff is collapsed.
......@@ -37,6 +37,13 @@
<artifactId>converter-sbml</artifactId>
<version>1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-cli/commons-cli -->
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<build>
......
......@@ -3,6 +3,7 @@ package lcsb.mapviewer;
import java.io.ByteArrayInputStream;
import java.util.*;
import org.apache.commons.cli.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -18,14 +19,31 @@ public class Main {
public static void main(String[] args) {
logger.debug(Arrays.asList(args));
Options options = new Options();
Option enricherOption = new Option(null, "enrichr-file", true, "Enrichr output for wikipathway");
Option minervaOption = new Option(null, "minerva-file", true, "Minerva pathways");
Option outputOption = new Option(null, "output-file", true, "Output map in sbml format");
Option textMiningOption = new Option(null, "text-mining-file", true, "Text mining data");
enricherOption.setRequired(true);
minervaOption.setRequired(true);
outputOption.setRequired(true);
textMiningOption.setRequired(true);
String wikipathways = args[0];
String minervaPathways = args[1];
String network = args[2];
String output = args[3];
options.addOption(enricherOption)
.addOption(minervaOption)
.addOption(outputOption)
.addOption(textMiningOption);
HelpFormatter formatter = new HelpFormatter();
CommandLineParser parser = new DefaultParser();
try {
// parse the command line arguments
CommandLine line = parser.parse(options, args);
String wikipathways = line.getOptionValue("enrichr-file");
String minervaPathways = line.getOptionValue("minerva-file");
String network = line.getOptionValue("text-mining-file");
String output = line.getOptionValue("output-file");
PathwayMerger merger = new PathwayMerger();
PathwayFetcher fetcher = new PathwayFetcher();
......@@ -52,6 +70,9 @@ public class Main {
new ApplySimpleLayoutModelCommand(modelWithTextMining, reactions).execute();
new SbmlParser().model2File(modelWithTextMining, output);
} catch (ParseException exp) {
System.err.println("Parsing with input parameters: " + exp.getMessage());
formatter.printHelp("map_generator", options);
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment