public boolean canCheck(Object thing) { return (thing instanceof SimplePhysicalEntity) && (((SimplePhysicalEntity) thing).getEntityReference() != null); } }
@Override public boolean match(SimplePhysicalEntity a, SimplePhysicalEntity b) { return !a.equals(b) && a.getEntityReference() != null && !a.getName().isEmpty() && !b.getName().isEmpty() && !a.getEntityReference().isEquivalent(b.getEntityReference()) && CollectionUtils.containsAny(a.getName(), b.getName()); } };
@Override public String toString() { return this.left.getStandardName() + "--" + this.right.getDisplayName() + "(" + this.deltaFeatures + ")"; }
@Override public void check(SimplePhysicalEntity thing, boolean fix) { EntityReference er = thing.getEntityReference(); Set<EntityFeature> erefs = er.getEntityFeature(), peefs = new HashSet<EntityFeature>(); peefs.addAll(thing.getFeature()); peefs.addAll(thing.getNotFeature()); for(EntityFeature ef: peefs) { if(!erefs.contains(ef)) { if(fix) er.addEntityFeature(ef); error(thing, "improper.feature.use", fix, ef.getRDFId(), er.getRDFId()); } } }
public void check(final Validation validation, SimplePhysicalEntity thing) { EntityReference er = thing.getEntityReference(); peFeaturesAndNotFeatures.addAll(thing.getFeature()); peFeaturesAndNotFeatures.addAll(thing.getNotFeature()); if(thing.getFeature().contains(ef)) { thing.removeFeature(ef); thing.addFeature(newEf); if(thing.getNotFeature().contains(ef)) { thing.removeNotFeature(ef); thing.addNotFeature(newEf);
&& ((Complex) e).getComponent().isEmpty()) || (e instanceof SimplePhysicalEntity && ((SimplePhysicalEntity) e).getEntityReference()==null && !((SimplePhysicalEntity) e).getMemberPhysicalEntity().isEmpty()))
private Map<String, String> calculateIdMapings(Model model) { Map<String, String> idMappings = new HashMap<String, String>(); final Set<SimplePhysicalEntity> proteins = model.getObjects(SimplePhysicalEntity.class); for (SimplePhysicalEntity protein : proteins) { final String protRefId = protein.getEntityReference().getRDFId(); for (Xref xref : protein.getXref()) { if ("uniprotkb".equals(xref.getDb())) { String newId = IDENTIFIERS_ORG + "uniprot/" + xref.getId(); idMappings.put(protRefId, newId); break; } else if ("chebi".equals(xref.getDb())) { String newId = IDENTIFIERS_ORG + xref.getDb() + "/" + xref.getId(); idMappings.put(protRefId, newId); break; } } } return idMappings; }
if(spe.getDisplayName() == null || spe.getDisplayName().trim().length() == 0) { if(er.getDisplayName() != null && er.getDisplayName().trim().length() > 0) { spe.setDisplayName(er.getDisplayName());
for (String name : sm.getName())
public void check(SimplePhysicalEntity spe, boolean fix) { Set<Conversion> conversions = new HashSet<Conversion>( new ClassFilterSet<Interaction,Conversion>( spe.getParticipantOf(), Conversion.class)); for(Conversion conversion : conversions) { if(conversion instanceof ComplexAssembly || conversion instanceof Degradation) { continue; //ignore these conversion types } Set<PhysicalEntity> side = conversion.getLeft(); if(side.contains(spe)) side = conversion.getRight(); if(!sameKindEntityExists(spe, side)) error(spe, "illegal.conversion", false, conversion); } }
private boolean isGeneric(SmallMoleculeReference smr) { if (!smr.getMemberEntityReference().isEmpty()) return true; for (SimplePhysicalEntity sm : smr.getEntityReferenceOf()) { if (!sm.getMemberPhysicalEntity().isEmpty()) return true; } return false; }
for(SimplePhysicalEntity spe : er.getEntityReferenceOf()) { if(spe.getFeature().contains(ef)) { spe.removeFeature(ef); spe.addFeature(newEf); if(spe.getNotFeature().contains(ef)) { spe.removeNotFeature(ef); spe.addNotFeature(newEf);
if(spe.getDisplayName() == null || spe.getDisplayName().trim().length() == 0) { if(er.getDisplayName() != null && er.getDisplayName().trim().length() > 0) { spe.setDisplayName(er.getDisplayName()); if(validation != null) validation.setFixed(BiopaxValidatorUtils.getId(spe),
private Set<Set<String>> collectNameSets(Model model) { Set<Set<String>> bag = new HashSet<Set<String>>(); for (SmallMoleculeReference smr : model.getObjects(SmallMoleculeReference.class)) { Set<String> set = new HashSet<String>(); for (String name : smr.getName()) { set.add(name.toLowerCase()); } for (SimplePhysicalEntity sm : smr.getEntityReferenceOf()) { for (String name : sm.getName()) { set.add(name.toLowerCase()); } } doSomeCleaning(set); enrichWithModifications(set); bag.add(set); } return bag; }
public void check(final Validation validation, SimplePhysicalEntity spe) { Set<Conversion> conversions = new HashSet<Conversion>( new ClassFilterSet<Interaction,Conversion>( spe.getParticipantOf(), Conversion.class)); for(Conversion conversion : conversions) { if(conversion instanceof ComplexAssembly || conversion instanceof Degradation) { continue; //ignore these conversion types } Set<SimplePhysicalEntity> side = new ClassFilterSet<PhysicalEntity,SimplePhysicalEntity>( conversion.getLeft(), SimplePhysicalEntity.class); if(side.contains(spe)) //then compare with the other side side = new ClassFilterSet<PhysicalEntity,SimplePhysicalEntity>( conversion.getRight(), SimplePhysicalEntity.class); if(!sameKindEntityExists(spe, side)) error(validation, spe, "illegal.conversion", false, conversion); } }
@Override public boolean canCheck(Object thing) { return thing instanceof SimplePhysicalEntity && ((SimplePhysicalEntity) thing).getEntityReference() != null; } }
@Override public boolean match(SimplePhysicalEntity a, SimplePhysicalEntity b) { return !a.equals(b) && a.getEntityReference() != null && !a.getName().isEmpty() && !b.getName().isEmpty() && !a.getEntityReference().isEquivalent(b.getEntityReference()) && !BiopaxValidatorUtils.namesInCommon(a, b).isEmpty(); } };
boolean sameKindEntityExists(SimplePhysicalEntity spe, Set<SimplePhysicalEntity> side) { assert !(spe instanceof SmallMolecule); boolean ret = false; for (SimplePhysicalEntity value : side) { if (!(value instanceof SmallMolecule)) { if(value.getEntityReference() != null && value.getEntityReference().isEquivalent(spe.getEntityReference())) return true; } } return ret; }
/** * Searches for the shortest name of the PhysicalEntity. * @param spe entity to search in * @return the shortest name */ private String getShortestName(SimplePhysicalEntity spe) { String name = null; for (String s : spe.getName()) { if (name == null || s.length() > name.length()) name = s; } EntityReference er = spe.getEntityReference(); if (er != null) { for (String s : er.getName()) { if (name == null || s.length() > name.length()) name = s; } } return name; }
private static boolean checkEntity(GroupMap map, PhysicalEntity pe, BioPAXElement element) { return pe instanceof SimplePhysicalEntity && (element.equals(((SimplePhysicalEntity) pe).getEntityReference())) || element.equals(map.getEntityReferenceOrGroup(pe)); }