private boolean notAllowed(Object o) { if (o instanceof BioPAXElement) { for (int i = 0; i < NOT_ADVISED.length; i++) { if (((BioPAXElement) o).getModelInterface().equals( NOT_ADVISED[i])) { return true; // found } } } return false; }
private boolean notAllowed(Object o) { if (o instanceof BioPAXElement) { for (int i = 0; i < NOT_ADVISED.length; i++) { if (((BioPAXElement) o).getModelInterface().equals( NOT_ADVISED[i])) { return true; // found } } } return false; }
private boolean notAllowed(BioPAXElement bp) { for (int i = 0; i < NOT_ALLOWED.length; i++) { if (bp.getModelInterface().equals(NOT_ALLOWED[i])) { return true; // found } } return false; }
private boolean notAllowed(BioPAXElement bp) { for (int i = 0; i < NOT_ALLOWED.length; i++) { if (bp.getModelInterface().equals(NOT_ALLOWED[i])) { return true; // found } } return false; }
/** * Checks if the element is assignable to a variable of the desired type. * @param match current pattern match * @param ind mapped indices * @return true if the element is assignable to a variable of the desired type */ @Override public boolean satisfies(Match match, int... ind) { assert ind.length == 1; return clazz.isAssignableFrom(match.get(ind[0]).getModelInterface()); } }
private static String getParticipantTypes(Set<BioPAXElement> elements) { Set<String> set = new HashSet<String>(); for (BioPAXElement ele : elements) { String name = ele.getModelInterface().getName(); set.add(name.substring(name.lastIndexOf(".") + 1)); } List<String> list = new ArrayList<String>(set); Collections.sort(list); return concat(list); }
public void check(final Validation validation, BioPAXElement thing) { error(validation, thing, "not.specific.element", false, thing.getModelInterface().getSimpleName()); }
public void check(final Validation validation, BioPAXElement thing) { error(validation, thing, "not.allowed.element", false, thing.getModelInterface().getSimpleName()); }
public void check(BioPAXElement thing, boolean fix) { error(thing, "not.specific.element", false, thing.getModelInterface().getSimpleName()); }
public void check(BioPAXElement thing, boolean fix) { error(thing, "not.allowed.element", false, thing.getModelInterface().getSimpleName()); }
/** * Gets the type of the element. * @param entity entity to ask its type * @return type in string */ private String getEntityTypeString(BioPAXElement entity) { if(entity instanceof Group) { return ((Group) entity).groupTypeToString(); } else return entity.getModelInterface().getSimpleName(); }
private static String addIHOPLinks(BioPAXElement bpe) { List<String> synList = new ArrayList<String>(BioPaxUtil.getSynonymList(bpe)); List<ExternalLink> dbList = BioPaxUtil.getAllXRefs(bpe); if (!synList.isEmpty() || !dbList.isEmpty()) { String htmlLink = ExternalLinkUtil.createIHOPLink(bpe.getModelInterface().getSimpleName(), synList, dbList, BioPaxUtil.getOrganismTaxonomyId(bpe)); if (htmlLink != null) { return ("- " + htmlLink); } } return null; }
private static String ihopLinks(BioPAXElement bpe) { List<String> synList = new ArrayList<String>(getSynonyms(bpe)); List<ExternalLink> dbList = xrefToExternalLinks(bpe, Xref.class); String htmlLink = null; if (!synList.isEmpty() || !dbList.isEmpty()) { htmlLink = ExternalLinkUtil.createIHOPLink(bpe.getModelInterface().getSimpleName(), synList, dbList, getOrganismTaxonomyId(bpe)); } return htmlLink; }
private static String addIHOPLinks(CyNetwork network, BioPAXElement bpe) { List<String> synList = new ArrayList<String>(BioPaxUtil.getSynonyms(bpe)); List<ExternalLink> dbList = xrefToExternalLinks(bpe, Xref.class); if (!synList.isEmpty() || !dbList.isEmpty()) { String htmlLink = ExternalLinkUtil.createIHOPLink(bpe.getModelInterface().getSimpleName(), synList, dbList, BioPaxUtil.getOrganismTaxonomyId(network, bpe)); if (htmlLink != null) { return htmlLink; } } return null; }
public void check(final Validation validation, Model model) { Cluster<BioPAXElement> algorithm = new Cluster<BioPAXElement>() { @Override public boolean match(BioPAXElement a, BioPAXElement b) { return !a.equals(b) && a.getUri().equalsIgnoreCase(b.getUri()); } }; Set<Set<BioPAXElement>> clasters = algorithm.cluster(model.getObjects(), Integer.MAX_VALUE); // report the error once for each cluster for (Set<BioPAXElement> duplicates : clasters) { if(duplicates.size() > 1) { BioPAXElement u = duplicates.iterator().next(); duplicates.remove(u); // keep the first element error(validation, u, "duplicate.id.ignoringcase", false, duplicates, u.getModelInterface().getSimpleName()); } } }
public static String getType(BioPAXElement bpe) { if(bpe instanceof physicalEntityParticipant) { return getType(((physicalEntityParticipant)bpe).getPHYSICAL_ENTITY()); } return (bpe != null) ? getTypeInPlainEnglish(bpe.getModelInterface().getSimpleName()) : NULL_ELEMENT_TYPE; }
private void createIndividuals(OntModel ontModel, Model model) { for (BioPAXElement bp : model.getObjects()) { String name = bp.getModelInterface().getName(); name = name.substring(name.lastIndexOf('.') + 1); OntClass ontClass = ontModel.getOntClass(this.getLevel().getNameSpace() + name); if (log.isTraceEnabled()) { log.trace("ontClass = " + ontClass); } Individual individual = ontModel.createIndividual(bp.getRDFId(), ontClass); if (log.isTraceEnabled()) { log.trace("individual = " + individual); } objectToIndividualMap.put(bp, individual); } }
public void check(Model model, boolean fix) { Cluster<BioPAXElement> algorithm = new Cluster<BioPAXElement>() { @Override public boolean match(BioPAXElement a, BioPAXElement b) { return !a.equals(b) && a.getRDFId().equalsIgnoreCase(b.getRDFId()); } }; Set<Set<BioPAXElement>> clasters = algorithm.cluster(model.getObjects(), Integer.MAX_VALUE); // report the error once for each cluster for (Set<BioPAXElement> duplicates : clasters) { if(duplicates.size() > 1) { BioPAXElement u = duplicates.iterator().next(); duplicates.remove(u); // keep the first element error(u, "duplicate.id.ignoringcase", false, BiopaxValidatorUtils.getIdListAsString(duplicates), u.getModelInterface().getSimpleName()); } } }
/** * Searches the pattern starting from the given match. The first element of the match should be * assigned. Others are optional. * @param m match to start from * @param pattern pattern to search * @return result matches */ public static List<Match> search(Match m, Pattern pattern) { assert pattern.getStartingClass().isAssignableFrom(m.get(0).getModelInterface()); return searchRecursive(m, pattern.getConstraints(), 0); }
/** * Searches the pattern starting from the given element. * @param ele element to start from * @param pattern pattern to search * @return matching results */ public static List<Match> search(BioPAXElement ele, Pattern pattern) { assert pattern.getStartingClass().isAssignableFrom(ele.getModelInterface()); Match m = new Match(pattern.size()); m.set(ele, 0); return search(m, pattern); }