Package Test

Source Code of Test.SaraTestGalaxyToLoni

package Test;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

import CLInterface.ConverterConfig;
import Galaxy.Tree.Tool.Tool;
import Galaxy.Tree.Tool.Command.Command;
import Galaxy.Tree.Tool.Command.ParsedCommand;
import Galaxy.Tree.Workflow.Workflow;
import Galaxy.Toolbox.GalaxyToolDatabase;
import Galaxy.Visitor.Local.GalaxyToLoniWorkflowConverter;
import LONI.tree.workflow.Pipeline;
import Specification.GalaxySpecification;
import Specification.LoniSpecification;

public class SaraTestGalaxyToLoni {

  public static void testGalaxyJSON(String path, String output){
    System.out.println("==="+path+"===");
   
    Workflow G;
    try {
      G = GalaxySpecification.getJSONParser().parse(new File(path));
      //GalaxySpecification.populateTools(G);
     
      try {
        GalaxySpecification.getJSONGenerator().generate(G, output);
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
   
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
   
  }
  public static void testGalaxyXML(String path, String output){
    System.out.println("==="+path+"===");
    Tool G;
    try {
      G = GalaxySpecification.getXMLParser().parse(new File(path));
      try {
        GalaxySpecification.getXMLGenerator().generate(G, output);
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
   
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
   
  }
 
  public static void testGalaxyConvert(String path, String output){
    System.out.println("==="+path+"===");
    Workflow G;
    try {
      G = GalaxySpecification.getJSONParser().parse(new File(path));
      GalaxyToLoniWorkflowConverter glc = new GalaxyToLoniWorkflowConverter();
      Pipeline pipeline = (Pipeline) glc.visit(G);
     
      try {
        LoniSpecification.getXMLGenerator().generate(pipeline, output);
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
   
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
   
  }
 
  public static void testLoniXML(String path, String output){
    System.out.println("==="+path+"===");
    Pipeline G;
    try {
      G = LoniSpecification.getXMLParser().parse(new File(path));
      try {
        LoniSpecification.getXMLGenerator().generate(G, output);
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
   
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
   
  }
  public static void testGalaxyWebServiceConvert(String path, String output){
    System.out.println("==="+path+"===");
    Workflow G;
    try {
      G = GalaxySpecification.getJSONParser().parse(new File(path));
      Galaxy.Visitor.Webservice.GalaxyToLoniWorkflowConverter glc;
      glc = new Galaxy.Visitor.Webservice.GalaxyToLoniWorkflowConverter();
      Pipeline pipeline = (Pipeline) glc.visit(G);
     
      try {
        LoniSpecification.getXMLGenerator().generate(pipeline, output);
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
   
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
   
  }
 
 
  public static void main(String[] args){
    //testJSON("data/test2.ga");
   
    ConverterConfig.GALAXY_INPUT_DIR =  "/home/viper/workspace/pipelineconverter/data/Galaxy/input/dummy-galaxy-dir/";
    ConverterConfig.GALAXY_OUTPUT_DIR = "/home/viper/workspace/pipelineconverter/data/Galaxy/output/db/";
   
    //ConverterConfig.GALAXY_INPUT_DIR =  "/home/grimmjaw/Documents/College/CS130/Pipelines/galaxy-dist/";
    //ConverterConfig.GALAXY_OUTPUT_DIR = "/home/grimmjaw/workspace/pipelineconverter/data/Galaxy/output/db/";
   
   
    GalaxyToolDatabase tooldb;
    tooldb = new GalaxyToolDatabase();
    //testGalaxyJSON("data/Galaxy/input/gal2.ga", "data/Galaxy/output/gal2.ga");
   
    //testLoniXML("data/Loni/input/loni1.pipe", "data/Loni/output/loni1.pipe");
   
    testGalaxyJSON("data/Galaxy/input/capspace1.ga","data/Galaxy/output/capspace1.ga");
    testGalaxyJSON("data/Galaxy/input/capspace2.ga","data/Galaxy/output/capspace2.ga");
    testGalaxyJSON("data/Galaxy/input/capspace3.ga","data/Galaxy/output/capspace3.ga");
    testGalaxyJSON("data/Galaxy/input/capspace4.ga","data/Galaxy/output/capspace4.ga");
    testGalaxyJSON("data/Galaxy/input/capspace5.ga","data/Galaxy/output/capspace5.ga");
    testGalaxyJSON("data/Galaxy/input/fasta1.ga","data/Galaxy/output/fasta1.ga");
    testGalaxyJSON("data/Galaxy/input/fasta2.ga","data/Galaxy/output/fasta2.ga");
    testGalaxyJSON("data/Galaxy/input/tool-test/joiner.ga", "data/Galaxy/output/tool-test/joiner.ga");
   
    /*
    testGalaxyConvert("data/Galaxy/input/capspace1.ga", "data/Galaxy/output/capspace1.pipe");
    testGalaxyConvert("data/Galaxy/input/capspace2.ga", "data/Galaxy/output/capspace2.pipe");
    testGalaxyConvert("data/Galaxy/input/capspace3.ga", "data/Galaxy/output/capspace3.pipe");
    testGalaxyConvert("data/Galaxy/input/capspace4.ga", "data/Galaxy/output/capspace4.pipe");
    testGalaxyConvert("data/Galaxy/input/capspace5.ga", "data/Galaxy/output/capspace5.pipe");
    testGalaxyConvert("data/Galaxy/input/fasta0.ga", "data/Galaxy/output/fasta0.pipe");
    testGalaxyConvert("data/Galaxy/input/fasta1.ga", "data/Galaxy/output/fasta1.pipe");
    testGalaxyConvert("data/Galaxy/input/fasta2.ga", "data/Galaxy/output/fasta2.pipe");
    testGalaxyConvert("data/Galaxy/input/fxnlfasta0.ga", "data/Galaxy/output/fxnlfasta0.pipe");
    testGalaxyConvert("data/Galaxy/input/tool-test/megablast_xml_parser.ga", "data/Galaxy/output/tool-test/megablast_xml_parser.pipe");
    testGalaxyConvert("data/Galaxy/input/tool-test/pass.ga", "data/Galaxy/output/tool-test/pass.pipe");
    testGalaxyConvert("data/Galaxy/input/tool-test/maf_reverse_complement.ga", "data/Galaxy/output/tool-test/maf_reverse_complement.pipe");
    testGalaxyConvert("data/Galaxy/input/tool-test/ldtools.ga", "data/Galaxy/output/tool-test/ldtools.pipe");
    //testGalaxyConvert("data/Galaxy/input/tool-test/joiner.ga", "data/Galaxy/output/tool-test/joiner.pipe");
    */
    testGalaxyWebServiceConvert("data/Galaxy/input/capspace1.ga", "data/Galaxy/output/capspace1.pipe");
    testGalaxyWebServiceConvert("data/Galaxy/input/capspace2.ga", "data/Galaxy/output/capspace2.pipe");
    testGalaxyWebServiceConvert("data/Galaxy/input/capspace3.ga", "data/Galaxy/output/capspace3.pipe");
    testGalaxyWebServiceConvert("data/Galaxy/input/capspace4.ga", "data/Galaxy/output/capspace4.pipe");
    testGalaxyWebServiceConvert("data/Galaxy/input/capspace5.ga", "data/Galaxy/output/capspace5.pipe");
    testGalaxyWebServiceConvert("data/Galaxy/input/fasta0.ga", "data/Galaxy/output/fasta0.pipe");
    testGalaxyWebServiceConvert("data/Galaxy/input/fasta1.ga", "data/Galaxy/output/fasta1.pipe");
    testGalaxyWebServiceConvert("data/Galaxy/input/fasta2.ga", "data/Galaxy/output/fasta2.pipe");
    testGalaxyWebServiceConvert("data/Galaxy/input/fxnlfasta0.ga", "data/Galaxy/output/fxnlfasta0.pipe");
    testGalaxyWebServiceConvert("data/Galaxy/input/tool-test/megablast_xml_parser.ga", "data/Galaxy/output/tool-test/megablast_xml_parser.pipe");
    testGalaxyWebServiceConvert("data/Galaxy/input/tool-test/pass.ga", "data/Galaxy/output/tool-test/pass.pipe");
    testGalaxyWebServiceConvert("data/Galaxy/input/tool-test/maf_reverse_complement.ga", "data/Galaxy/output/tool-test/maf_reverse_complement.pipe");
    testGalaxyWebServiceConvert("data/Galaxy/input/tool-test/ldtools.ga", "data/Galaxy/output/tool-test/ldtools.pipe");
   
    //testLoniXML("data/Loni/input/modulegroup1.pipe", "data/Loni/output/modulegroup1.pipe");
    //testLoniXML("data/Loni/input/modulegroup2.pipe", "data/Loni/output/modulegroup2.pipe");
    //testLoniXML("data/Loni/input/modulegroup3.pipe", "data/Loni/output/modulegroup3.pipe");
   
    //testLoniXML("data/Loni/input/loni1.pipe", "data/Loni/output/loni1.pipe");
    //testLoniXML("data/Loni/input/loni2.pipe", "data/Loni/output/loni2.pipe");
   
 
  }
}
TOP

Related Classes of Test.SaraTestGalaxyToLoni

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.