/** * Constructor with endpoints. The end points are differentiated with the terms small and big. * This refers to a hierarchy in the relation. Small means you will get to this end while going * towards MEMBER direction, and big means this end is at the COMPLEX direction. To understand * this please see the directions in LinkedPE. * @param small member end of the chain * @param big complex end of the chain * @see org.biopax.paxtools.pattern.constraint.LinkedPE */ public PhysicalEntityChain(PhysicalEntity small, PhysicalEntity big) { pes = fillArray(big, small, 1, 0); if (pes == null) { throw new IllegalArgumentException("No link found between small PE = " + small.getUri() + " and big PE = " + big.getUri()); } assert !containsNull(pes); }
/** * Gets the glyphs of the given set of PhysicalEntity objects. Does not create anything. * * @param pes entities to get their glyphs * @return glyphs of entities */ private List<Glyph> getGlyphsOfPEs(Set<PhysicalEntity> pes, String context) { List<Glyph> gs = new ArrayList<Glyph>(); for (PhysicalEntity pe : pes) { if (glyphMap.containsKey(convertID(pe.getUri()))) { gs.add(getGlyphToLink(pe, context)); } } return gs; }
/** * Prepares the necessary construct for adding the given PhysicalEntity set to the Control * being drawn. * * @param pes entities to use in control * @return the glyph to connect to the appropriate place */ private Glyph handlePEGroup(Set<PhysicalEntity> pes, String context) { int sz = pes.size(); if (sz > 1) { List<Glyph> gs = getGlyphsOfPEs(pes, context); return connectWithAND(gs); } else if (sz == 1) { PhysicalEntity pe = pes.iterator().next(); if(glyphMap.containsKey(convertID(pe.getUri()))) return getGlyphToLink(pe, context); } //'pes' was empty return null; }
/** * Creates a glyph for the complex member. * * @param pe PhysicalEntity to represent as complex member * @param container Glyph for the complex shell */ private Glyph createComplexMember(PhysicalEntity pe, Glyph container) { Glyph g = createGlyphBasics(pe, false); container.getGlyph().add(g); // A PhysicalEntity may appear in many complexes -- we identify the member using its complex g.setId(g.getId() + "_" + ModelUtils.md5hex(container.getId())); glyphMap.put(g.getId(), g); Set<String> uris = new HashSet<String>(); uris.add(pe.getUri()); sbgn2BPMap.put(g.getId(), uris); if("or".equalsIgnoreCase(g.getClazz())) { buildGeneric(pe, g, container); } return g; }
private void buildGeneric(PhysicalEntity generic, Glyph or, Glyph container) { assert "or".equalsIgnoreCase(or.getClazz()) : "must be 'or' glyph class"; for (PhysicalEntity m : generic.getMemberPhysicalEntity()) { Glyph g = createGlyphBasics(m,false); if(container!=null) container.getGlyph().add(g); String gid = g.getId() + "_" + ModelUtils.md5hex("memberof_" + or.getId()); g.setId(gid); glyphMap.put(gid, g); Set<String> uris = new HashSet<String>(); uris.add(m.getUri()); sbgn2BPMap.put(gid, uris); assignLocation(m, g); createArc(g, or, LOGIC_ARC.getClazz(), null); if(m instanceof Complex) createComplexContent((Complex) m, g); } }
throw new IllegalArgumentException("peType = " + peType + ", and related participant set does not contain this PE. Conv dir = " + getDirection(conv) + " conv.id=" + conv.getUri() + " pe.id=" +pe.getUri());
private Set<PhysicalEntity> getPEsRecursively(Set<PhysicalEntity> pes, Fetcher fetcher) { Model m = BioPAXLevel.L3.getDefaultFactory().createModel(); for(PhysicalEntity pe : pes) { if(pe instanceof Complex) fetcher.fetch(pe,m); else if(!m.containsID(pe.getUri())) m.add(pe); } return m.getObjects(PhysicalEntity.class); }