Package uk.ac.cam.ch.wwmm.ptclib.io

Examples of uk.ac.cam.ch.wwmm.ptclib.io.ResourceGetter


        } else {
          File f = new File(new File(Oscar3Props.getInstance().workspace, "chemnamedict"), Oscar3Props.getInstance().chemNameDict);
          if(f.exists()) {
            myChemNameDict.readFromFile(f);       
          } else {
            myChemNameDict.readXML(new ResourceGetter("uk/ac/cam/ch/wwmm/oscar3/chemnamedict/resources/").getXMLDocument("defaultCompounds.xml"));
            if(!("none".equals(Oscar3Props.getInstance().workspace))) {
              File ff = new File(new File(Oscar3Props.getInstance().workspace, "chemnamedict"), Oscar3Props.getInstance().chemNameDict);
              myChemNameDict.writeToFile(ff);
            }
          }
View Full Code Here


   *
   * @throws Exception
   */
  public static void importChEBI() throws Exception {
    long time = System.currentTimeMillis();
    ResourceGetter rg = new ResourceGetter("uk/ac/cam/ch/wwmm/oscar3/chemnamedict/resources/");
   
    Set<String> stops = rg.getStringSet("ChEBIStop.txt");
   
    OBOOntology o = OBOOntology.getInstance();

    Map<String,Set<String>> relatedBySource = new HashMap<String,Set<String>>();
   
View Full Code Here

    }*/
  }
 
  public static void main(String [] args) throws Exception {
    ChemNameDict cnd = new ChemNameDict();
    cnd.readXML(new ResourceGetter("uk/ac/cam/ch/wwmm/oscar3/chemnamedict/resources/").getXMLDocument("defaultCompounds.xml"));
  //fetchChEBI(new PrintWriter(System.out));
    ChemNameDictSingleton.purge();
    System.out.println("Importing dict");
    ChemNameDictSingleton.importDict(cnd);
    System.out.println("Importing ChEBI");
View Full Code Here

   *
   * @param modelName The model to load.
   */
  public static void loadModelFromResources(String modelName) {
    try {     
      Document modelDoc = new ResourceGetter("uk/ac/cam/ch/wwmm/oscar3/models/resources/").getXMLDocument(modelName + ".xml");
      restoreModel(modelDoc);
    } catch (Exception e) {
      throw new Error(e);
    }   
  }
View Full Code Here

   * regexes and bad names.
   *
   * @throws Exception
   */
  public PrunePubChemSynonyms() throws Exception {
    ResourceGetter rg = new ResourceGetter("uk/ac/cam/ch/wwmm/oscar3/newpc/resources/");
    patterns = new ArrayList<Pattern>();
    for(String line: rg.getStrings("stopRegexes.txt")) {
      patterns.add(Pattern.compile(line));
    }
    stopNames = new HashSet<String>();
    for(String s : rg.getStrings("stopNames.txt")) stopNames.add(s.trim());
  }
View Full Code Here

public final class OPSINTestServlet extends HttpServlet  {

  @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    ResourceGetter rg = new ResourceGetter("uk/ac/cam/ch/wwmm/oscar3server/resources/");
    response.setContentType("text/plain");
    PrintWriter out = response.getWriter();
    List<String> testSuite;
    try {
      testSuite = rg.getStrings("opsinTest.txt");     
    } catch (Exception e) {
      e.printStackTrace(out);
      return;
    }
    int total = 0;
View Full Code Here

  /** Prints out a useful help message.
   *
   *
   */
  private static void printUsage() throws Exception {
    System.out.println(new ResourceGetter("uk/ac/cam/ch/wwmm/oscar3/resources/").getString("usage.txt"));
  }
View Full Code Here

   * @param sheetName The filename of the XSLT stylesheet to use.
   * @return The results of the XSL transform.
   */
  public static Document runXSLOnInline(Document inline, String sheetName) {
    try {
      Document xslDoc = new ResourceGetter("uk/ac/cam/ch/wwmm/oscar3/misc/resources/").getXMLDocument(sheetName);
      XSLTransform xslt = new XSLTransform(xslDoc);
      Nodes n = xslt.transform(inline);
      return XSLTransform.toDocument(n);
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

  private static OnAnnotated myInstance;
  private XSLTransform xslt;
 
  private OnAnnotated() {
    try {
      ResourceGetter rg = new ResourceGetter("uk/ac/cam/ch/wwmm/ptc/experimental/resources/");
      Document xsltDoc = rg.getXMLDocument("toSciXML.xsl");
      xslt = new XSLTransform(xsltDoc);     
    } catch (Exception e) {
      throw new Error(e);
    }
  }
View Full Code Here

*
*/
final class DSOtoOBO {

  public static OBOOntology readDSO() throws Exception {
    ResourceGetter rg = new ResourceGetter("uk/ac/cam/ch/wwmm/oscar3/terms/resources/");
    String parentID = null;
   
    //Map<String,OntologyTerm> termsByID = new HashMap<String,OntologyTerm>();
   
    OBOOntology oo = new OBOOntology();
   
   
    int id = 0;
    for(String string : rg.getStrings("ptcontology.dso")) {
      if(string.matches("\\[.*\\]")) {
        id++;
        String termID = "PTCO:" + padInt(id, 6);
        String name = string.substring(1, string.length()-1);
        oo.addTerm(new OntologyTerm(termID, name));
View Full Code Here

TOP

Related Classes of uk.ac.cam.ch.wwmm.ptclib.io.ResourceGetter

Copyright © 2018 www.massapicom. 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.