コード例 #1
0
  private void initialize() {
    try {
      dataSetManager = new DataSetManager();
      dataSetManager.addDataSetFactory(
          new LuceneDataSetFactory<Object, Object, Object>(
              dataSetManager,
              null,
              new FileUtils(),
              new NullCytoscapeUtils<Object, Object, Object>(),
              null),
          Collections.emptyMap());
      data = dataSetManager.open(DirectorySettings.getGeneManiaDirectory());

      human = getHumanOrganism(data);
      networkUtils = new NetworkUtils();

      cache =
          new DataCache(
              new SynchronizedObjectCache(
                  new MemObjectCache(data.getObjectCache(NullProgressReporter.instance(), false))));
      mania = new Mania2(cache);
      setGeneLimit(DEFAULT_GENE_LIMIT);
      setCombiningMethod(DEFAULT_COMBINING_METHOD);
      setNetworks(new HashSet<String>(Arrays.asList(DEFAULT_NETWORKS)));
    } catch (Exception e) {
      LOG.error(e);
    }
  }
コード例 #2
0
 private static boolean validGene(String geneName)
     throws SAXException, DataStoreException, ApplicationException {
   Gene gene = data.getCompletionProvider(human).getGene(geneName);
   if (gene == null) {
     return false;
   }
   return true;
 }
コード例 #3
0
 private Organism getHumanOrganism(DataSet data) throws DataStoreException {
   String human = "H. Sapiens";
   human = human.toLowerCase();
   List<Organism> organisms = data.getMediatorProvider().getOrganismMediator().getAllOrganisms();
   for (Organism organism : organisms) {
     String organismName = organism.getName();
     String organismAlias = organism.getAlias();
     if (organismName.toLowerCase().equals(human) || organismAlias.toLowerCase().equals(human)) {
       return organism;
     }
   }
   return null;
 }
コード例 #4
0
 private RelatedGenesEngineRequestDto createRequest() throws ApplicationException {
   RelatedGenesEngineRequestDto request = new RelatedGenesEngineRequestDto();
   request.setNamespace(GeneMania.DEFAULT_NAMESPACE);
   request.setOrganismId(human.getId());
   request.setInteractionNetworks(collapseNetworks(networks));
   Set<Long> nodes = new HashSet<Long>();
   for (String geneName : genes) {
     nodes.add(data.getCompletionProvider(human).getNodeId(geneName));
   }
   request.setPositiveNodes(nodes);
   request.setLimitResults(geneLimit);
   request.setCombiningMethod(combiningMethod);
   request.setScoringMethod(org.genemania.type.ScoringMethod.DISCRIMINANT);
   return request;
 }