protected void write(Organism organism) throws ApplicationException { // write out nodeDegree objects NodeDegrees nodeDegrees = new NodeDegrees(Data.CORE, organism.getId()); nodeDegrees.setDegrees(degreesInOrganism); cache.putNodeDegrees(nodeDegrees); // update datasetInfo DatasetInfo datasetInfo = cache.getDatasetInfo(organism.getId()); datasetInfo.setNumInteractingGenes(numConnectedGenes); cache.putDatasetInfo(datasetInfo); }
public void processOrganism(Organism organism) throws Exception { logger.info( String.format( "computing degrees for organism %d (%s)", organism.getId(), organism.getName())); allocDataStructures(organism); computeDegrees(organism); countNodesWithPositiveDegree(); write(organism); log(); }
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; }
protected void allocDataStructures(Organism organism) throws ApplicationException { // annotation matrix NodeIds nodeIds = cache.getNodeIds(organism.getId()); numGenes = nodeIds.getNodeIds().length; degreesInOrganism = new DenseVector(numGenes); }
private EnrichmentEngineRequestDto createEnrichmentRequest( RelatedGenesEngineResponseDto response) { if (human.getOntology() == null) { return null; } EnrichmentEngineRequestDto request = new EnrichmentEngineRequestDto(); request.setProgressReporter(NullProgressReporter.instance()); request.setMinCategories(MIN_CATEGORIES); request.setqValueThreshold(Q_VALUE_THRESHOLD); request.setOrganismId(human.getId()); request.setOntologyId(human.getOntology().getId()); Set<Long> nodes = new HashSet<Long>(); for (NetworkDto network : response.getNetworks()) { for (InteractionDto interaction : network.getInteractions()) { nodes.add(interaction.getNodeVO1().getId()); nodes.add(interaction.getNodeVO2().getId()); } } request.setNodes(nodes); return request; }
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; }
protected void computeDegrees(Organism organism) throws ApplicationException { Collection<Collection<Long>> groupedNetworks = getAllNetworks(organism); degreesInOrganism.zero(); DenseVector degreesInNetwork = new DenseVector(numGenes); for (Collection<Long> networks : groupedNetworks) { for (long networkId : networks) { degreesInNetwork.zero(); Network network = cache.getNetwork(Data.CORE, organism.getId(), networkId); SymMatrix networkData = network.getData(); networkData.columnSums(degreesInNetwork.getData()); degreesInOrganism.add(degreesInNetwork); } } }
public void setNetworks(Set<String> n) { Map<InteractionNetworkGroup, Collection<InteractionNetwork>> groupMembers = new HashMap<InteractionNetworkGroup, Collection<InteractionNetwork>>(); Collection<InteractionNetworkGroup> groups = human.getInteractionNetworkGroups(); Set<String> notHandled = n; for (InteractionNetworkGroup group : groups) { if (n.contains(group.getName())) { notHandled.remove(group.getName()); List<InteractionNetwork> networkMembers = new ArrayList<InteractionNetwork>(); Collection<InteractionNetwork> networks = group.getInteractionNetworks(); for (InteractionNetwork network : networks) { networkMembers.add(network); } if (networkMembers.size() > 0) { groupMembers.put(group, networkMembers); } } } networks = groupMembers; }