+ /**
+ * Predict secondary structure for RNA and/or protein sequences and add as
+ * annotations
+ *
+ * @param rnaSequences
+ * @param proteinSequences
+ */
+ protected void predictSecondaryStructure(List<SequenceI> rnaSequences,
+ List<SequenceI> proteinSequences)
+ {
+ /*
+ * Currently using Annotate3D for RNA, but only if the 'use external
+ * prediction' flag is set
+ */
+ if (externalSecondaryStructure && rnaSequences.size() > 0)
+ {
+ try
+ {
+ processPdbFileWithAnnotate3d(rnaSequences);
+ } catch (Exception x)
+ {
+ System.err.println("Exceptions when dealing with RNA in pdb file");
+ x.printStackTrace();
+
+ }
+ }
+
+ /*
+ * Currently using JMol PDB parser for peptide
+ */
+ if (proteinSequences.size() > 0)
+ {
+ try
+ {
+ processPdbFileWithJmol(proteinSequences);
+ } catch (Exception x)
+ {
+ System.err
+ .println("Exceptions from Jmol when processing data in pdb file");
+ x.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Process a parsed chain to construct and return a Sequence, and add it to
+ * the list of sequences parsed.
+ *
+ * @param chain
+ * @return
+ */
+ protected SequenceI postProcessChain(PDBChain chain)
+ {
+ SequenceI dataset = chain.sequence;
+ dataset.setName(id + "|" + dataset.getName());
+ PDBEntry entry = new PDBEntry();
+ entry.setId(id);
+ entry.setType(PDBEntry.Type.PDB);
+ entry.setProperty(new Hashtable());
+ if (chain.id != null)
+ {
+ // entry.getProperty().put("CHAIN", chains.elementAt(i).id);
+ entry.setChainCode(String.valueOf(chain.id));
+ }
+ if (inFile != null)
+ {
+ entry.setFile(inFile.getAbsolutePath());
+ }
+ else
+ {
+ // TODO: decide if we should dump the datasource to disk
+ entry.setFile(getDataName());
+ }
+ dataset.addPDBId(entry);
+ // PDBChain objects maintain reference to dataset
+ SequenceI chainseq = dataset.deriveSequence();
+ seqs.addElement(chainseq);
+
+ AlignmentAnnotation[] chainannot = chainseq.getAnnotation();
+
+ if (chainannot != null && visibleChainAnnotation)
+ {
+ for (int ai = 0; ai < chainannot.length; ai++)
+ {
+ chainannot[ai].visible = visibleChainAnnotation;
+ annotations.addElement(chainannot[ai]);
+ }
+ }
+ return chainseq;
+ }