+ List<SequenceI> toremove = new ArrayList<SequenceI>();
+ for (SequenceI pdbcs : pdbAlignment.getSequences())
+ {
+ String chid = null;
+ // Mapping map=null;
+ for (PDBEntry pid : pdbcs.getAllPDBEntries())
+ {
+ if (pid.getFile() == file)
+ {
+ chid = pid.getChainCode();
+
+ }
+ }
+ if (chain == null || (chid != null && (chid.equals(chain)
+ || chid.trim().equals(chain.trim())
+ || (chain.trim().length() == 0 && chid.equals("_")))))
+ {
+ // FIXME seems to result in 'PDB|1QIP|1qip|A' - 1QIP is redundant.
+ // TODO: suggest simplify naming to 1qip|A as default name defined
+ pdbcs.setName(jalview.datamodel.DBRefSource.PDB + SEPARATOR + id
+ + SEPARATOR + pdbcs.getName());
+ // Might need to add more metadata to the PDBEntry object
+ // like below
+ /*
+ * PDBEntry entry = new PDBEntry(); // Construct the PDBEntry
+ * entry.setId(id); if (entry.getProperty() == null)
+ * entry.setProperty(new Hashtable());
+ * entry.getProperty().put("chains", pdbchain.id + "=" +
+ * sq.getStart() + "-" + sq.getEnd());
+ * sq.getDatasetSequence().addPDBId(entry);
+ */
+ // Add PDB DB Refs
+ // We make a DBRefEtntry because we have obtained the PDB file from
+ // a
+ // verifiable source
+ // JBPNote - PDB DBRefEntry should also carry the chain and mapping
+ // information
+ DBRefEntry dbentry = new DBRefEntry(getDbSource(),
+ getDbVersion(), (chid == null ? id : id + chid));
+ // dbentry.setMap()
+ pdbcs.addDBRef(dbentry);
+ }
+ else
+ {
+ // mark this sequence to be removed from the alignment
+ // - since it's not from the right chain
+ toremove.add(pdbcs);
+ }
+ }
+ // now remove marked sequences
+ for (SequenceI pdbcs : toremove)