/** * @param an * @return * @see net.sourceforge.ondex.core.ONDEXGraph#getConceptsOfAttributeName(net.sourceforge.ondex.core.AttributeName) */ public Set<ONDEXConcept> getConceptsOfAttributeName(AttributeName an) { return og.getConceptsOfAttributeName(an); }
@Override protected Set<ONDEXConcept> retrieveConceptAllAttributeName( AttributeName attributeName) { return parent.getConceptsOfAttributeName(attributeName); }
int counting(AttributeName an) { return graph.getConceptsOfAttributeName(an).size() + graph.getRelationsOfAttributeName(an).size(); } }.count();
@Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) return; int index = list.getSelectedIndex(); if (index > -1) { goButton.setEnabled(true); AttributeName attNameName = graph.getMetaData().getAttributeName(((JLabel) list.getModel().getElementAt(index)).getName()); Set<String> attValues = new HashSet<String>(); for (ONDEXConcept c : graph.getConceptsOfAttributeName(attNameName)) attValues.add(c.getAttribute(attNameName).getValue().toString()); text.setText(""); for (String value : attValues) { text.append(value + "\n"); } } } }
private Map<Integer, Set<Integer>> createTaxIdIndex() throws InvalidPluginArgumentException { Set<String> taxIds = new HashSet<String>(); taxIds.addAll(Arrays.asList((String[]) args.getObjectValueArray(TAX_ID_ARG))); Map<Integer, Set<Integer>> taxId2CidSet = new HashMap<Integer, Set<Integer>>(); Set<ONDEXConcept> allSequences = graph.getConceptsOfAttributeName(attN_seqType); Set<ONDEXConcept> allTaxId = graph.getConceptsOfAttributeName(attN_taxId); Set<ONDEXConcept> conceptsWithTaxIdAndSeq = BitSetFunctions.and(allSequences, allTaxId); System.out.println("Creating index"); for (ONDEXConcept queryConcept: conceptsWithTaxIdAndSeq) { Attribute attribute = queryConcept.getAttribute(attN_taxId); if (attribute != null) { String value = (String) attribute.getValue(); //if a tax is specified then limit if (taxIds.size() == 0 || taxIds.contains(value)) { int taxIdVal = Integer.valueOf(value); Set<Integer> setCon = taxId2CidSet.get(taxIdVal); if (setCon == null) { setCon = new HashSet<Integer>(); taxId2CidSet.put(taxIdVal, setCon); } setCon.add(queryConcept.getId()); } } } return taxId2CidSet; }
/** * Write all SMILES from graph into file * * @param tempDir * @param an * @return * @throws Exception */ private File writeSMILES(File tempDir, AttributeName an) throws Exception { File smilesFile = new File(tempDir.getAbsolutePath() + File.separator + System.currentTimeMillis() + ".smi"); if (!DEBUG) smilesFile.deleteOnExit(); // text-file output writer BufferedWriter writer = new BufferedWriter(new FileWriter(smilesFile)); // get all smiles into file for (ONDEXConcept c : graph.getConceptsOfAttributeName(an)) { Attribute attribute = c.getAttribute(an); ChemicalStructure cs = (ChemicalStructure) attribute.getValue(); String s = cs.getSMILES(); if (s != null) { writer.write(s.trim() + " " + c.getId() + "\n"); total++; } } // close writer writer.flush(); writer.close(); return smilesFile; }
Set<ONDEXConcept> taxIDName = graph.getConceptsOfAttributeName(taxId); Set<ONDEXConcept> newView = BitSetFunctions.copy(view); newView.retainAll(taxIDName);
public void start() { ONDEXGraphMetaData metadata = graph.getMetaData(); for (ConceptClass cc : metadata.getConceptClasses()) { System.out.println("ConceptClass " + cc.getId() + " " + cc.getFullname()); System.out.println("\tConcepts = " + graph.getConceptsOfConceptClass(cc).size()); } for (DataSource dataSource : metadata.getDataSources()) { System.out.println("DataSource " + dataSource.getId() + " " + dataSource.getFullname()); System.out.println("\tConcepts = " + graph.getConceptsOfDataSource(dataSource).size()); } for (AttributeName att : metadata.getAttributeNames()) { System.out.println("AttributeName " + att.getId() + " " + att.getFullname()); System.out.println("\tConcepts = " + graph.getConceptsOfAttributeName(att).size()); System.out.println("\tRelations = " + graph.getRelationsOfAttributeName(att).size()); } for (RelationType rt : metadata.getRelationTypes()) { System.out.println("RelationType " + rt.getId() + " " + rt.getFullname()); System.out.println("\tRelations = " + graph.getRelationsOfRelationType(rt).size()); } }
for (ONDEXConcept c : graph.getConceptsOfAttributeName(an_taxid)) { Attribute attribute = c.getAttribute(an_taxid); int tax_curr = Integer.parseInt((String) attribute.getValue());
DataOutputStream out = new DataOutputStream(new FileOutputStream(fileName)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out)); for (ONDEXConcept c : graph.getConceptsOfAttributeName(st)) { String accession = null; for (ConceptAccession ca : c.getConceptAccessions()) {
if (aog.getConceptsOfAttributeName(an).size() > 0 || aog.getRelationsOfAttributeName(an).size() > 0) anListModel.addAttributeName(an);
/** * returns a view of concepts that meet both criteria * * @param graph the currentGraph * @param taxId * @return concept that are of specified cc and have the specified att */ private Set<ONDEXConcept> getSet(ONDEXGraph graph, ConceptClass ccName, AttributeName sequenceTypeName, AttributeName taxId) { Set<ONDEXConcept> concepts = BitSetFunctions.copy(graph.getConceptsOfAttributeName(sequenceTypeName)); fireEventOccurred(new GeneralOutputEvent(concepts.size() + " concepts found with att " + sequenceTypeName.getId(), getCurrentMethodName())); if (taxId != null) { Set<ONDEXConcept> taxConcepts = graph.getConceptsOfAttributeName(taxId); fireEventOccurred(new GeneralOutputEvent(taxConcepts.size() + " concepts found with taxId ", getCurrentMethodName())); concepts.retainAll(taxConcepts); } if (ccName != null) { concepts.retainAll(graph.getConceptsOfConceptClass(ccName)); fireEventOccurred(new GeneralOutputEvent(concepts.size() + " concepts found with att " + sequenceTypeName.getId() + " and taxId and cc " + ccName.getId(), getCurrentMethodName())); } return concepts; }
vc = graph.getConcepts(); } else { vc = graph.getConceptsOfAttributeName(an);
/** * creates a new index of go annotations in concept accessions for a given graph. * @param aog the graph. * @param taxid the taxid for which the annotation should be indexed. */ public void analyzeGraphAccByTaxon(ONDEXGraph aog, int taxid) { init(); AttributeName an_taxid = aog.getMetaData().getAttributeName("TAXID"); DataSource dataSource_go = aog.getMetaData().getDataSource("GO"); for(ONDEXConcept c : aog.getConceptsOfAttributeName(an_taxid)) { String curr_taxidStr = (String) c.getAttribute(an_taxid).getValue(); int curr_taxid = Integer.parseInt(curr_taxidStr); if (curr_taxid == taxid) { for (ConceptAccession acc : c.getConceptAccessions()) { if (acc.getElementOf().equals(dataSource_go)) { String cid = c.getId()+""; String goID = acc.getAccession(); int goID_int = Integer.parseInt(goID.split(":")[1]); register(cid, goID_int); } } } } }
DataSource dataSource_go = aog.getMetaData().getDataSource("GO"); for(ONDEXConcept c : aog.getConceptsOfAttributeName(an_taxid)) { String curr_taxidStr = (String) c.getAttribute(an_taxid).getValue(); int curr_taxid = Integer.parseInt(curr_taxidStr);
if (aog.getConceptsOfAttributeName(an).size() > 0) { int option = JOptionPane.showInternalConfirmDialog(desktop.getDesktopPane(), "Detected appearance attributes. Do you like to load appearance now?", "Load appearance...", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE); if (option == JOptionPane.YES_OPTION) {
Set<ONDEXConcept> concepts = BitSetFunctions.copy(graph.getConceptsOfAttributeName(att)); if (super.getConceptType() != null) { concepts.retainAll(graph.getConceptsOfConceptClass(super.getConceptType()));
@Override public void start() throws Exception { Set<ONDEXConcept> conceptsWithNT = graph.getConceptsOfAttributeName(graph.getMetaData().getAttributeName("NA")); Set<ONDEXConcept> conceptsWithProteins = graph.getConceptsOfAttributeName(graph.getMetaData().getAttributeName("AA")); DecypherAlignment dcAlign = new DecypherAlignment( net.sourceforge.ondex.config.Config.ondexDir, getArguments().getUniqueValue(PROGRAM_DIR_ARG).toString(), 0, //cutff 0f, //% 0001f, //evalue 0, //bitscore Integer.MAX_VALUE, //max alignments false); Collection<Match> hits = dcAlign.query(graph, conceptsWithNT, conceptsWithProteins, BLASTAlignmentProgram.ALGO_BLASTX); RelationType h_s_s = graph.getMetaData().getRelationType("h_s_s"); EvidenceType ev = graph.getMetaData().createEvidenceType("BLASTx", "BLASTx", "BLASTx"); Set<EvidenceType> evs = new HashSet<EvidenceType>(); for (Match hit : hits) { //you might prefer to build an index query-->Hit if you want to take the best n ONDEXConcept query = graph.getConcept(hit.getQueryId()); ONDEXConcept hitTarget = graph.getConcept(hit.getTargetId()); ONDEXRelation relation = graph.createRelation(query, hitTarget, h_s_s, evs); //add some properties to the relations...etc } }
HashMap<Object, Integer> objectsToValues = new HashMap<Object, Integer>(); Set<ONDEXConcept> concepts = graph.getConceptsOfAttributeName(att); concepts.retainAll(conceptBase);
if ((anVisible = aog.getMetaData().getAttributeName(AppearanceSynchronizer.VISIBLE)) != null && aog.getConceptsOfAttributeName(anVisible).size() > 0) { option = JOptionPane.showConfirmDialog(OVTK2Desktop.getDesktopResources().getParentPane(), Config.language.getProperty("Dialog.Appearance.Found"), Config.language.getProperty("Dialog.Appearance.FoundTitle"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);