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); } }
public List<Gene> getRelatedGenesByScore() throws ApplicationException, DataStoreException, NoRelatedGenesInfoException { options = runGeneManiaAlgorithm(); final Map<Gene, Double> scores = options.getScores(); ArrayList<Gene> relatedGenes = new ArrayList<Gene>(scores.keySet()); Collections.sort( relatedGenes, new Comparator<Gene>() { public int compare(Gene gene1, Gene gene2) { return -Double.compare(scores.get(gene1), scores.get(gene2)); } }); return relatedGenes; }