current_compound = new EntityInfo(); current_compound.setMolId(i); current_compound.setType(EntityType.POLYMER); current_compound.setDescription(value); chains.add(chainID); compoundMolIds2chainIds.put(current_compound.getMolId(),chains); names.add(synonyms.nextToken()); current_compound.setSynonyms(names); current_compound.setEcNums(ecNums); current_compound.setFragment(value); current_compound.setEngineered(value); current_compound.setMutation(value); current_compound.setBiologicalUnit(value); current_compound.setDetails(value);
return new Integer(o1.getMolId()).compareTo(o2.getMolId()); }).getMolId(); nonPolyEntity = new EntityInfo(); nonPolyEntity.setDescription(molecPdbName); nonPolyEntity.setType(EntityType.NONPOLYMER); nonPolyEntity.setMolId(molId++); nonPolyEntities.add(nonPolyEntity); nonPolyEntity.addChain(c); c.setEntityInfo(nonPolyEntity); EntityInfo waterEntity = new EntityInfo(); waterEntity.setType(EntityType.WATER); waterEntity.setDescription("water"); waterEntity.setMolId(molId); waterEntity.addChain(waterChain); waterChain.setEntityInfo(waterEntity);
public ResidueIdentifier(Group g) { Chain c = g.getChain(); if (c==null) { logger.warn("Chain is not available for group {}. Contact comparison will not work for this residue",g.toString()); this.seqResIndex = -1; } else { EntityInfo comp = c.getEntityInfo(); if (comp==null) { logger.warn("Compound is not available for group {}. Contact comparison will not work for this residue",g.toString()); this.seqResIndex = -1; } else { this.seqResIndex = comp.getAlignedResIndex(g, c); } } }
@Override public void setEntityInfo(int[] chainIndices, String sequence, String description, String type) { // First get the chains EntityInfo entityInfo = new EntityInfo(); entityInfo.setDescription(description); entityInfo.setType(EntityType.entityTypeFromString(type)); List<Chain> chains = new ArrayList<>(); // Now loop through the chain ids and make a list of them for( int index : chainIndices) { chains.add(chainList.get(index)); chainList.get(index).setEntityInfo(entityInfo); chainSequenceMap.put(chainList.get(index).getId(), sequence); } entityInfo.setChains(chains); entityInfoList.add(entityInfo); }
entityInfo = new EntityInfo(); entityInfo.setMolId(eId); entityInfo.addChain(chain); if (chain.isWaterOnly()) { entityInfo.setType(EntityType.WATER); } else { entityInfo.setType(EntityType.NONPOLYMER); logger.debug("Adding chain with chain id {} (auth id {}) to Entity with entity_id {}", chain.getId(), chain.getName(), eId); entityInfo.addChain(chain); chain.setEntityInfo(entityInfo); if (e.getChains().isEmpty()) { logger.info("Entity {} '{}' has no chains associated to it", e.getMolId()<0?"with no entity id":e.getMolId(), e.getDescription());
private void addEntities(StructAsym asym) { int eId = 0; try { eId = Integer.parseInt(asym.getEntity_id()); } catch (NumberFormatException e) { logger.warn("Could not parse mol_id from string {}. Will use 0 for creating Entity",asym.getEntity_id()); } Entity e = getEntity(eId); // for some mmCIF files like 1yrm all 3 of _entity_src_gen, _entity_src_nat and _pdbx_entity_src_syn are missing // we need to fill the Compounds in some other way: EntityInfo entityInfo = structure.getEntityById(eId); if (entityInfo==null) { //logger.info("Creating new EntityInfo " + eId + " " + e.getId() + " " + e.getPdbx_description()); entityInfo = new EntityInfo(); entityInfo.setMolId(eId); // we only add the compound if a polymeric one (to match what the PDB parser does) if (e!=null) { entityInfo.setDescription(e.getPdbx_description()); EntityType eType = EntityType.entityTypeFromString(e.getType()); if (eType!=null) { entityInfo.setType(eType); } else { logger.warn("Type '{}' is not recognised as a valid entity type for entity {}", e.getType(), eId); } addAncilliaryEntityData(asym, eId, e, entityInfo); structure.addEntityInfo(entityInfo); logger.debug("Adding Entity with entity id {} from _entity, with name: {}",eId, entityInfo.getDescription()); } } }
for (Chain member:getChains()) { if (c.getId().equals(member.getId())) { contained = true; throw new IllegalArgumentException("Given chain with asym_id "+c.getId()+" is not a member of this entity: "+getChainIds().toString()); initResSerialsMap(c); resNum = findResNumInOtherChains(index, c);
EntityInfo newEntityInfo = new EntityInfo(entityInfo); // this sets everything but the chains for (String asymId:entityInfo.getChainIds()) { if (newChain==null) { logger.warn("Could not find chain asymId "+asymId+" of model "+modelNr+" while cloning entityInfo "+entityInfo.getMolId()+". Something is wrong!"); continue; newEntityInfo.addChain(newChain);
EntityInfo ent = new EntityInfo(); ent.addChain(c1); ent.addChain(c2); ent.setMolId(molId++); ent.setType(EntityType.POLYMER); c1.setEntityInfo(ent); c2.setEntityInfo(ent); logger.debug("Adding chain {} to entity {}",c1.getId(),c2.getId()); ent = chainIds2entities.get(c2.getId()); ent.addChain(c1); c1.setEntityInfo(ent); chainIds2entities.put(c1.getId(), ent); ent.addChain(c2); c2.setEntityInfo(ent); chainIds2entities.put(c2.getId(), ent); EntityInfo ent = new EntityInfo(); ent.addChain(c); ent.setMolId(molId++); ent.setType(EntityType.POLYMER); c.setEntityInfo(ent); EntityInfo e = chainIds2entities.get(chain.getId()); chain.setEntityInfo(e); e.addChain(chain);
String description = entityInfo.getDescription(); String type; if (entityInfo.getType()==null){ type = null; type = entityInfo.getType().getEntityType(); List<Chain> entityChains = entityInfo.getChains(); if (entityChains.isEmpty()){
newEntityInfo = new EntityInfo(); s.addEntityInfo(newEntityInfo); } else { newEntityInfo = s.getEntityById(oldEntityInfo.getMolId()); if( newEntityInfo == null ) { newEntityInfo = new EntityInfo(oldEntityInfo); s.addEntityInfo(newEntityInfo); newEntityInfo.addChain(chain); chain.setEntityInfo(newEntityInfo);
/** * Return true if the PDB's chain passes the criteria I.e.: Organism matches */ boolean filterPdbChain(Chain chain) { // note: Compound is replaced by EntityInfo in biojava 5.x for (EntityInfo entityInfo : chain.getStructure().getEntityInfos()) { if (contains(entityInfo.getOrganismCommon(), pdbOrganismCommon) || contains(entityInfo.getOrganismScientific(), pdbOrganismScientific)) { return true; } } return false; }
String molName = comp.getDescription(); if ( molName != null){ str.append(molName); String type = comp.getType().toString(); str.append(" (") .append(type)
newS.addChain(c); for (EntityInfo comp : s.getEntityInfos()) { if (comp.getChainIds() != null && comp.getChainIds().contains(c.getChainID())) { + " " + comp.getDescription());
String labelSeqId = Integer.toString(g.getResidueNumber().getSeqNum()); if (g.getChain()!=null && g.getChain().getEntityInfo()!=null) { entityId = Integer.toString(g.getChain().getEntityInfo().getMolId()); labelSeqId = Integer.toString(g.getChain().getEntityInfo().getAlignedResIndex(g, g.getChain()));
private static EntityInfo findNonPolyEntityWithDescription(String description, List<EntityInfo> nonPolyEntities) { for (EntityInfo e:nonPolyEntities) { if (e.getDescription().equals(description)) return e; } return null; }
/** {@inheritDoc} */ @Override public EntityInfo getEntityById(int entityId) { for (EntityInfo mol : this.entityInfos){ if (mol.getMolId()==entityId){ return mol; } } return null; }
/** * Return the list of member chain ids (asym ids) that are described by this EntityInfo, * only unique chain IDs are contained in the list. * Note that in the case of multimodel structures this will return just the unique * chain identifiers whilst {@link #getChains()} will return a corresponding chain * per model. * @return the list of unique ChainIDs that are described by this EnityInfo * @see #setChains(List) * @see #getChains() */ public List<String> getChainIds() { Set<String> uniqChainIds = new TreeSet<String>(); for (int i=0;i<getChains().size();i++) { uniqChainIds.add(getChains().get(i).getId()); } return new ArrayList<String>(uniqChainIds); }
private List<Chain> getFirstModelChains() { Map<String, Chain> firstModelChains = new LinkedHashMap<>(); Set<String> lookupChainIds = new HashSet<>(getChainIds()); for (Chain chain : chains) { if (lookupChainIds.contains(chain.getId())) { if (!firstModelChains.containsKey(chain.getId())) { firstModelChains.put(chain.getId(), chain); } } } return new ArrayList<>(firstModelChains.values()); }