@Override public void actionPerformed(ActionEvent udalost) { try { Evidence evidence = new Evidence(localPath); TableModel modelVipFirmy = new ModelStudenti(evidence); TableModel modelNeplaticiFirmy = new ModelStatickeStranky(evidence); TableModel modelVsechnyFirmy = new ModelOdevzdaneUkoly(evidence); TableModel modelPlaticiFirmy = new ModelPublikace(evidence); TableModel modelVipPlatFirmy = new ModelUkoly(evidence); PraceSDaty archiv = evidence.getArchiv(); Gui gui = new Gui( modelVipFirmy, modelNeplaticiFirmy, modelVsechnyFirmy, modelPlaticiFirmy, modelVipPlatFirmy, archiv, evidence, ftpClient, nacitani); } catch (Exception ex) { Logger.getLogger(Nacitani.class.getName()).log(Level.SEVERE, null, ex); } }
/** * Método utilizado para testar o encontro de uma evidência pelas autoridades. Método de teste * apenas */ public void testEvidenceInvestigation() { if (!evidences.isEmpty()) { if (successTest(opRisk, 0)) { Evidence evi = evidences.get(0); evi.getCause().getPlayer().setHeat(true, evi.getHeatInc()); evidences.remove(evi); } } }
/** @return */ public String toXML() { OptetPlugin optetPluginJAXB = new OptetPlugin(); for (Iterator iterator = categoriesList.iterator(); iterator.hasNext(); ) { Categories cates = (Categories) iterator.next(); com.thalesgroup.optet.plugin.template.jaxb.OptetPlugin.Categories categoriesJAXB = new com.thalesgroup.optet.plugin.template.jaxb.OptetPlugin.Categories(); categoriesJAXB.setName(cates.getName()); System.out.println("JAXB " + cates.getName()); Collection<Category> listcategory = cates.getCategories().values(); for (Iterator iterator2 = listcategory.iterator(); iterator2.hasNext(); ) { Category cat = (Category) iterator2.next(); com.thalesgroup.optet.plugin.template.jaxb.OptetPlugin.Categories.Category catJAXB = new com.thalesgroup.optet.plugin.template.jaxb.OptetPlugin.Categories.Category(); catJAXB.setName(cat.getName()); System.out.println("JAXB " + cat.getName()); Collection<Evidence> listevidence = cat.getMetrics().values(); for (Iterator iterator3 = listevidence.iterator(); iterator3.hasNext(); ) { Evidence evidence = (Evidence) iterator3.next(); com.thalesgroup.optet.plugin.template.jaxb.OptetPlugin.Categories.Category.Evidence evidenceJAXB = new com.thalesgroup.optet.plugin.template.jaxb.OptetPlugin.Categories.Category .Evidence(); evidenceJAXB.setName(evidence.getSummary()); System.out.println("JAXB " + evidence.getSummary()); catJAXB.getEvidence().add(evidenceJAXB); } categoriesJAXB.getCategory().add(catJAXB); } optetPluginJAXB.getCategories().add(categoriesJAXB); } JAXBContext jaxbContext; StringWriter stringWriter = new StringWriter(); try { jaxbContext = JAXBContext.newInstance(OptetPlugin.class); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); // output pretty printed jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); jaxbMarshaller.marshal(optetPluginJAXB, stringWriter); System.out.println("res " + stringWriter); } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); } // TODO Auto-generated method stub return stringWriter.toString(); }
/** * * Método a ser usado no update region para decrementar o timer de todas as evidencias na região * e remove-las caso o timer zere. */ private void decrementEvidenceTimer() { for (Iterator<Evidence> it = evidences.iterator(); it.hasNext(); ) { Evidence e = it.next(); if (!e.decrementTimer()) { e.setReg(null); it.remove(); System.out.println("Timer zerado, removendo evidencia"); } } }
public double[] calculatePriorMarginals(int nodeIndex) { Evidence evidence = getEvidence(); setEvidence(Evidence.tautology(evidence.getVariableSource())); double[] marginals = new double[evidence.getNumCategories(nodeIndex)]; for (int i = 0; i < getBayesIm().getNumColumns(nodeIndex); i++) { marginals[i] = getMarginal(nodeIndex, i); } setEvidence(evidence); return marginals; }
/** {@inheritDoc} */ @Override public Evidence[] mapEdgeToEvidence(Graph graph, Edge edge) { if (graph == null) throw new NullPointerException("graph cannot be null"); if (edge == null) throw new NullPointerException("edge cannot be null"); if (edge.metadata == null) return new Evidence[0]; Object evidences = edge.metadata.get("evidences"); if (evidences == null || !(evidences instanceof List)) return new Evidence[0]; List<Map> evidenceMap = typedList(((List) evidences), Map.class); List<Evidence> evidenceList = new ArrayList<Evidence>(); for (Map item : evidenceMap) { @SuppressWarnings("unchecked") Map<String, Object> evMap = (Map<String, Object>) item; Evidence ev = new Evidence(); ev.belStatement = getOrEmptyString("bel_statement", evMap).replace("\\\"", "\""); ev.summaryText = getOrEmptyString("summary_text", evMap); Citation citation = new Citation(); @SuppressWarnings("unchecked") Map<String, Object> citationMap = (Map<String, Object>) evMap.get("citation"); if (citationMap != null) { citation.id = getOrEmptyString("id", citationMap); citation.type = getOrEmptyString("type", citationMap); citation.name = getOrEmptyString("name", citationMap); } ev.citation = citation; BiologicalContext context = new BiologicalContext(); @SuppressWarnings("unchecked") Map<String, Object> contextMap = (Map<String, Object>) evMap.get("biological_context"); if (contextMap != null) { context.speciesCommonName = getOrEmptyString("species_common_name", contextMap); context.ncbiTaxId = getOrZero("ncbi_tax_id", contextMap); Set<String> varying = new HashSet<String>(contextMap.keySet()); varying.removeAll(asList("species_common_name", "ncbi_tax_id")); for (String key : varying) { context.variedAnnotations.put(key, contextMap.get(key)); } ev.biologicalContext = context; } evidenceList.add(ev); } return evidenceList.toArray(new Evidence[evidenceList.size()]); }
public double[] calculateUpdatedMarginals(int nodeIndex) { double[] marginals = new double[evidence.getNumCategories(nodeIndex)]; for (int i = 0; i < getBayesIm().getNumColumns(nodeIndex); i++) { marginals[i] = getMarginal(nodeIndex, i); } return marginals; }
/** {@inheritDoc} */ @Override public Evidence[] mapFromTable(CyEdge edge, CyTable table) { if (edge == null) throw new NullPointerException("edge cannot be null"); if (table == null) throw new NullPointerException("table cannot be null"); Set<String> nonAnnotationColumns = new HashSet<String>( asList( CyNetwork.SUID, NETWORK_SUID, NETWORK_NAME, EDGE_SUID, BEL_STATEMENT, SUMMARY_TEXT, CITATION_ID, CITATION_NAME, CITATION_TYPE, SPECIES)); Collection<CyRow> evidenceRows = table.getMatchingRows(EDGE_SUID, edge.getSUID()); List<Evidence> evidences = new ArrayList<Evidence>(evidenceRows.size()); if (!evidenceRows.isEmpty()) { for (CyRow evRow : evidenceRows) { Evidence e = new Evidence(); e.belStatement = evRow.get(BEL_STATEMENT, String.class); e.summaryText = evRow.get(SUMMARY_TEXT, String.class); e.citation = new Citation(); e.citation.id = evRow.get(CITATION_ID, String.class); e.citation.name = evRow.get(CITATION_NAME, String.class); e.citation.type = evRow.get(CITATION_TYPE, String.class); e.biologicalContext = new BiologicalContext(); e.biologicalContext.speciesCommonName = evRow.get(SPECIES, String.class); e.biologicalContext.variedAnnotations = new HashMap<String, Object>(); for (Entry<String, Object> columnValue : evRow.getAllValues().entrySet()) { if (nonAnnotationColumns.contains(columnValue.getKey())) continue; e.biologicalContext.variedAnnotations.put(columnValue.getKey(), columnValue.getValue()); } evidences.add(e); } } return evidences.toArray(new Evidence[evidences.size()]); }
private void storeEvidence() throws ObjectStoreException { for (Set<Evidence> annotationEvidence : goTermGeneToEvidence.values()) { List<String> evidenceRefIds = new ArrayList<String>(); Integer goAnnotationRefId = null; for (Evidence evidence : annotationEvidence) { Item goevidence = createItem("DOEvidence"); goevidence.setReference("code", evidenceCodes.get(evidence.getEvidenceCode())); List<String> publicationEvidence = evidence.getPublications(); if (!publicationEvidence.isEmpty()) { goevidence.setCollection("publications", publicationEvidence); } store(goevidence); evidenceRefIds.add(goevidence.getIdentifier()); goAnnotationRefId = evidence.getStoredAnnotationId(); } ReferenceList refIds = new ReferenceList("evidence", new ArrayList<String>(evidenceRefIds)); store(refIds, goAnnotationRefId); } }
public void setEvidence(Evidence evidence) { if (evidence == null) { throw new NullPointerException(); } if (evidence.getProposition().getVariableSource() != this) { throw new IllegalArgumentException( "Can only take evidence for " + "this particular object; please convert the evidence."); } this.evidence = evidence; }
public List<String[]> getInspectable() { List<String[]> list = new ArrayList<String[]>(); BioPAXNode.addNamesAndTypeAndID(list, cont); for (Evidence ev : cont.getEvidence()) { list.add(new String[] {"Evidence", ev.toString()}); } if (!cont.getInteractionType().isEmpty()) { String s = BioPAXNode.formatInString(cont.getInteractionType()); list.add(new String[] {"Interaction Type", s}); } if (cont.getControlType() != null) { list.add(new String[] {"Control Type", cont.getControlType().toString()}); } BioPAXNode.addDataSourceAndXrefAndComments(list, cont); return list; }
public void init() { categoriesList = new ArrayList<Categories>(); Categories categories = new Categories("static"); Category category = new Category("SoftwareComplexity", categories); Evidence evidence = new Evidence("SoftwareComplexityMetric", category); category.getMetrics().put(evidence.getSummary(), evidence); categories.getCategories().put(category.getName(), category); category = new Category("Maintainability", categories); categories.getCategories().put(category.getName(), category); evidence = new Evidence("MaintainabilityMetric", category); category.getMetrics().put(evidence.getSummary(), evidence); category = new Category("Reliability", categories); categories.getCategories().put(category.getName(), category); evidence = new Evidence("ReliabilityMetric", category); category.getMetrics().put(evidence.getSummary(), evidence); category = new Category("Security", categories); categories.getCategories().put(category.getName(), category); evidence = new Evidence("SecurityMetric", category); category.getMetrics().put(evidence.getSummary(), evidence); categoriesList.add(categories); categories = new Categories("runtime"); category = new Category("UnitTest", categories); categories.getCategories().put(category.getName(), category); category = new Category("CodeCoverage", categories); categories.getCategories().put(category.getName(), category); categoriesList.add(categories); }
@Override public Void doInBackground() throws Exception { setProgress(0); try { Thread.sleep(1000); } catch (InterruptedException ignore) { } setProgress(10); ftpClient.download(); setProgress(30); apiClient.downloadFile("admin/api/students", "studenti.csv"); setProgress(40); apiClient.downloadFile("admin/api/static/1", "menu.csv"); setProgress(48); apiClient.downloadFile("admin/api/statickat", "kategoriemenu.csv"); setProgress(54); apiClient.downloadFile("admin/api/publikace/1", "publikace.csv"); setProgress(61); apiClient.downloadFile("admin/api/publikacekat", "publikacekategorie.csv"); setProgress(70); apiClient.downloadFile("admin/api/skoly", "skoly.csv"); setProgress(75); apiClient.downloadFile("admin/api/fakulty", "fakulty.csv"); setProgress(79); apiClient.downloadFile("admin/api/skupiny", "skupinysemestrpredmet.csv"); setProgress(85); apiClient.downloadFile("admin/api/predmety", "predmet.csv"); setProgress(90); apiClient.downloadFile("admin/api/ukoly/1", "ukoly.csv"); setProgress(95); apiClient.downloadFile("admin/api/userukoly/1", "userukoly.csv"); setProgress(100); Evidence evidence = new Evidence(localPath); TableModel modelStudenti = new ModelStudenti(evidence); TableModel modelStatickeStranky = new ModelStatickeStranky(evidence); TableModel modelOdevzdaneUkoly = new ModelOdevzdaneUkoly(evidence); TableModel modelPublikace = new ModelPublikace(evidence); TableModel modelUkoly = new ModelUkoly(evidence); PraceSDaty archiv = evidence.getArchiv(); Gui gui = new Gui( modelStudenti, modelStatickeStranky, modelOdevzdaneUkoly, modelPublikace, modelUkoly, archiv, evidence, ftpClient, nacitani); return null; }
/** * This method takes an instantiated Bayes net (BayesIm) whose graph include all the variables * (observed and latent) and computes estimated counts using the data in the DataSet mixedData. * The counts that are estimated correspond to cells in the conditional probability tables of the * Bayes net. The outermost loop (indexed by j) is over the set of variables. If the variable has * no parents, each case in the dataset is examined and the count for the observed value of the * variables is increased by 1.0; if the value of the variable is missing the marginal * probabilities its values given the values of the variables that are available for that case are * used to increment the corresponding estimated counts. If a variable has parents then there is a * loop which steps through all possible sets of values of its parents. This loop is indexed by * the variable "row". Each case in the dataset is examined. It the variable and all its parents * have values in the case the corresponding estimated counts are incremented by 1.0. If the * variable or any of its parents have missing values, the joint marginal is computed for the * variable and the set of values of its parents corresponding to "row" and the corresponding * estimated counts are incremented by the appropriate probability. The estimated counts are * stored in the double[][][] array estimatedCounts. The count (possibly fractional) of the number * of times each combination of parent values occurs is stored in the double[][] array * estimatedCountsDenom. These two arrays are used to compute the estimated conditional * probabilities of the output Bayes net. */ private BayesIm expectation(BayesIm inputBayesIm) { // System.out.println("Entered method expectation."); int numCases = mixedData.getNumRows(); // StoredCellEstCounts estCounts = new StoredCellEstCounts(variables); int numVariables = allVariables.size(); RowSummingExactUpdater rseu = new RowSummingExactUpdater(inputBayesIm); for (int j = 0; j < numVariables; j++) { DiscreteVariable var = (DiscreteVariable) allVariables.get(j); String varName = var.getName(); Node varNode = graph.getNode(varName); int varIndex = inputBayesIm.getNodeIndex(varNode); int[] parentVarIndices = inputBayesIm.getParents(varIndex); // System.out.println("graph = " + graph); // for(int col = 0; col < var.getNumSplits(); col++) // System.out.println("Category " + col + " = " + var.getCategory(col)); // System.out.println("Updating estimated counts for node " + varName); // This segment is for variables with no parents: if (parentVarIndices.length == 0) { // System.out.println("No parents"); for (int col = 0; col < var.getNumCategories(); col++) { estimatedCounts[j][0][col] = 0.0; } for (int i = 0; i < numCases; i++) { // System.out.println("Case " + i); // If this case has a value for var if (mixedData.getInt(i, j) != -99) { estimatedCounts[j][0][mixedData.getInt(i, j)] += 1.0; // System.out.println("Adding 1.0 to " + varName + // " row 0 category " + mixedData[j][i]); } else { // find marginal probability, given obs data in this case, p(v=0) Evidence evidenceThisCase = Evidence.tautology(inputBayesIm); boolean existsEvidence = false; // Define evidence for updating by using the values of the other vars. for (int k = 0; k < numVariables; k++) { if (k == j) { continue; } Node otherVar = allVariables.get(k); if (mixedData.getInt(i, k) == -99) { continue; } existsEvidence = true; String otherVarName = otherVar.getName(); Node otherNode = graph.getNode(otherVarName); int otherIndex = inputBayesIm.getNodeIndex(otherNode); evidenceThisCase.getProposition().setCategory(otherIndex, mixedData.getInt(i, k)); } if (!existsEvidence) { continue; // No other variable contained useful data } rseu.setEvidence(evidenceThisCase); for (int m = 0; m < var.getNumCategories(); m++) { estimatedCounts[j][0][m] += rseu.getMarginal(varIndex, m); // System.out.println("Adding " + p + " to " + varName + // " row 0 category " + m); // find marginal probability, given obs data in this case, p(v=1) // estimatedCounts[j][0][1] += 0.5; } } } // Print estimated counts: // System.out.println("Estimated counts: "); // Print counts for each value of this variable with no parents. // for(int m = 0; m < var.getNumSplits(); m++) // System.out.print(" " + m + " " + estimatedCounts[j][0][m]); // System.out.println(); } else { // For variables with parents: int numRows = inputBayesIm.getNumRows(varIndex); for (int row = 0; row < numRows; row++) { int[] parValues = inputBayesIm.getParentValues(varIndex, row); estimatedCountsDenom[varIndex][row] = 0.0; for (int col = 0; col < var.getNumCategories(); col++) { estimatedCounts[varIndex][row][col] = 0.0; } for (int i = 0; i < numCases; i++) { // for a case where the parent values = parValues increment the estCount boolean parentMatch = true; for (int p = 0; p < parentVarIndices.length; p++) { if (parValues[p] != mixedData.getInt(i, parentVarIndices[p]) && mixedData.getInt(i, parentVarIndices[p]) != -99) { parentMatch = false; break; } } if (!parentMatch) { continue; // Not a matching case; go to next. } boolean parentMissing = false; for (int parentVarIndice : parentVarIndices) { if (mixedData.getInt(i, parentVarIndice) == -99) { parentMissing = true; break; } } if (mixedData.getInt(i, j) != -99 && !parentMissing) { estimatedCounts[j][row][mixedData.getInt(i, j)] += 1.0; estimatedCountsDenom[j][row] += 1.0; continue; // Next case } // for a case with missing data (either var or one of its parents) // compute the joint marginal // distribution for var & this combination of values of its parents // and update the estCounts accordingly // To compute marginals create the evidence boolean existsEvidence = false; Evidence evidenceThisCase = Evidence.tautology(inputBayesIm); // "evidenceVars" not used. // List<String> evidenceVars = new LinkedList<String>(); // for (int k = 0; k < numVariables; k++) { // //if(k == j) continue; // Variable otherVar = allVariables.get(k); // if (mixedData.getInt(i, k) == -99) { // continue; // } // existsEvidence = true; // String otherVarName = otherVar.getName(); // Node otherNode = graph.getNode(otherVarName); // int otherIndex = inputBayesIm.getNodeIndex( // otherNode); // evidenceThisCase.getProposition().setCategory( // otherIndex, mixedData.getInt(i, k)); // evidenceVars.add(otherVarName); // } if (!existsEvidence) { continue; } rseu.setEvidence(evidenceThisCase); estimatedCountsDenom[j][row] += rseu.getJointMarginal(parentVarIndices, parValues); int[] parPlusChildIndices = new int[parentVarIndices.length + 1]; int[] parPlusChildValues = new int[parentVarIndices.length + 1]; parPlusChildIndices[0] = varIndex; for (int pc = 1; pc < parPlusChildIndices.length; pc++) { parPlusChildIndices[pc] = parentVarIndices[pc - 1]; parPlusChildValues[pc] = parValues[pc - 1]; } for (int m = 0; m < var.getNumCategories(); m++) { parPlusChildValues[0] = m; /* if(varName.equals("X1") && i == 0 ) { System.out.println("Calling getJointMarginal with parvalues"); for(int k = 0; k < parPlusChildIndices.length; k++) { int pIndex = parPlusChildIndices[k]; Node pNode = inputBayesIm.getNode(pIndex); String pName = pNode.getName(); System.out.println(pName + " " + parPlusChildValues[k]); } } */ /* if(varName.equals("X1") && i == 0 ) { System.out.println("Evidence = " + evidenceThisCase); //int[] vars = {l1Index, x1Index}; Node nodex1 = inputBayesIm.getNode("X1"); int x1Index = inputBayesIm.getNodeIndex(nodex1); Node nodel1 = inputBayesIm.getNode("L1"); int l1Index = inputBayesIm.getNodeIndex(nodel1); int[] vars = {l1Index, x1Index}; int[] vals = {0, 0}; double ptest = rseu.getJointMarginal(vars, vals); System.out.println("Joint marginal (X1=0, L1 = 0) = " + p); } */ estimatedCounts[j][row][m] += rseu.getJointMarginal(parPlusChildIndices, parPlusChildValues); // System.out.println("Case " + i + " parent values "); // for (int pp = 0; pp < parentVarIndices.length; pp++) { // Variable par = (Variable) allVariables.get(parentVarIndices[pp]); // System.out.print(" " + par.getName() + " " + parValues[pp]); // } // System.out.println(); // System.out.println("Adding " + p + " to " + varName + // " row " + row + " category " + m); } // } } // Print estimated counts: // System.out.println("Estimated counts: "); // System.out.println(" Parent values: "); // for (int i = 0; i < parentVarIndices.length; i++) { // Variable par = (Variable) allVariables.get(parentVarIndices[i]); // System.out.print(" " + par.getName() + " " + parValues[i] + " "); // } // System.out.println(); // for(int m = 0; m < var.getNumSplits(); m++) // System.out.print(" " + m + " " + estimatedCounts[j][row][m]); // System.out.println(); } } // else } // j < numVariables BayesIm outputBayesIm = new MlBayesIm(bayesPm); for (int j = 0; j < nodes.length; j++) { DiscreteVariable var = (DiscreteVariable) allVariables.get(j); String varName = var.getName(); Node varNode = graph.getNode(varName); int varIndex = inputBayesIm.getNodeIndex(varNode); // int[] parentVarIndices = inputBayesIm.getParents(varIndex); int numRows = inputBayesIm.getNumRows(j); // System.out.println("Conditional probabilities for variable " + varName); int numCols = inputBayesIm.getNumColumns(j); if (numRows == 1) { double sum = 0.0; for (int m = 0; m < numCols; m++) { sum += estimatedCounts[j][0][m]; } for (int m = 0; m < numCols; m++) { condProbs[j][0][m] = estimatedCounts[j][0][m] / sum; // System.out.print(" " + condProbs[j][0][m]); outputBayesIm.setProbability(varIndex, 0, m, condProbs[j][0][m]); } // System.out.println(); } else { for (int row = 0; row < numRows; row++) { // int[] parValues = inputBayesIm.getParentValues(varIndex, // row); // int numCols = inputBayesIm.getNumColumns(j); // for (int p = 0; p < parentVarIndices.length; p++) { // Variable par = (Variable) allVariables.get(parentVarIndices[p]); // System.out.print(" " + par.getName() + " " + parValues[p]); // } // double sum = 0.0; // for(int m = 0; m < numCols; m++) // sum += estimatedCounts[j][row][m]; for (int m = 0; m < numCols; m++) { if (estimatedCountsDenom[j][row] != 0.0) { condProbs[j][row][m] = estimatedCounts[j][row][m] / estimatedCountsDenom[j][row]; } else { condProbs[j][row][m] = Double.NaN; } // System.out.print(" " + condProbs[j][row][m]); outputBayesIm.setProbability(varIndex, row, m, condProbs[j][row][m]); } // System.out.println(); } } } return outputBayesIm; }
/** * Returns an evidence object containing the proposition in evidence, with null Bayes IM and null * manipulation. */ private Evidence getEvidence() { return new Evidence(evidence.getProposition()); }
/** {@inheritDoc} */ public void process(Reader reader) throws ObjectStoreException, IOException { initialiseMapsForFile(); BufferedReader br = new BufferedReader(reader); String line = null; // loop through entire file while ((line = br.readLine()) != null) { if (line.startsWith("!")) { continue; } String[] array = line.split("\t", -1); // keep trailing empty Strings if (array.length < 13) { throw new IllegalArgumentException( "Not enough elements (should be > 13 not " + array.length + ") in line: " + line); } String taxonId = parseTaxonId(array[12]); Config config = configs.get(taxonId); if (config == null) { throw new NullPointerException( "No entry for organism with taxonId = '" + taxonId + "' found in config file."); } int readColumn = config.readColumn(); String productId = array[readColumn]; String goId = array[4]; String qualifier = array[3]; String strEvidence = array[6]; String withText = array[7]; if (StringUtils.isNotEmpty(strEvidence)) { storeEvidenceCode(strEvidence); } else { throw new IllegalArgumentException( "Evidence is a required column but not " + "found for doterm " + goId + " and productId " + productId); } // type of gene product, we're not interested in at the moment // String type = array[11]; String type = configs.get(taxonId).annotationType; // Wormbase has some proteins with UniProt accessions and some with WB:WP ids, // hack here to get just the UniProt ones. // if (("protein".equalsIgnoreCase(type) && !array[0].startsWith("UniProt")) // || (!"protein".equalsIgnoreCase(type) && array[0].startsWith("UniProt"))) { // continue; // } // create unique key for go annotation GoTermToGene key = new GoTermToGene(productId, goId, qualifier); String dataSourceCode = array[14]; Item organism = newOrganism(taxonId); String productIdentifier = newProduct(productId, type, organism, dataSourceCode, true, null); // null if resolver could not resolve an identifier if (productIdentifier != null) { // null if no pub found String pubRefId = newPublication(array[5]); // get evidence codes for this goterm|gene pair Set<Evidence> allEvidenceForAnnotation = goTermGeneToEvidence.get(key); // new evidence if (allEvidenceForAnnotation == null) { String goTermIdentifier = newGoTerm(goId, dataSourceCode); Evidence evidence = new Evidence(strEvidence, pubRefId); allEvidenceForAnnotation = new LinkedHashSet<Evidence>(); allEvidenceForAnnotation.add(evidence); goTermGeneToEvidence.put(key, allEvidenceForAnnotation); Integer storedAnnotationId = createGoAnnotation( productIdentifier, type, goTermIdentifier, organism, qualifier, withText, dataSourceCode); evidence.setStoredAnnotationId(storedAnnotationId); } else { boolean seenEvidenceCode = false; Integer storedAnnotationId = null; for (Evidence evidence : allEvidenceForAnnotation) { String evidenceCode = evidence.getEvidenceCode(); // already have evidence code, just add pub if (evidenceCode.equals(strEvidence)) { evidence.addPublicationRefId(pubRefId); seenEvidenceCode = true; } storedAnnotationId = evidence.storedAnnotationId; } if (!seenEvidenceCode) { Evidence evidence = new Evidence(strEvidence, pubRefId); evidence.storedAnnotationId = storedAnnotationId; allEvidenceForAnnotation.add(evidence); } } } } storeProductCollections(); storeEvidence(); }
/*! Query a value from this node * \param[in] query the query to the CPF or Evidence * \return the value or the sum of values or the evidence */ public Value query(int[] query) { if (_Evidence != null) { return _Evidence.getEvidenceValue(query[0]); } return getCPF().get(query); }
/** * * Método que retorna a evidência na região causada por uma determinada ação. Apenas deve * existir uma evidência por causa em uma determinada região. * * @param act Ação que causou a evidência * @return Retorna a evidência se ela existir, ou nulo se ela não existir. */ public Evidence getEvidenceByCause(Action act) { for (Evidence e : evidences) { if (e.getCauseType() == act.getClass()) return e; } return null; }