package jalview.io;
import jalview.analysis.AlignSeq;
+import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefEntry;
import java.awt.Color;
import java.io.IOException;
+import java.lang.reflect.Constructor;
import java.util.Hashtable;
import java.util.List;
import java.util.Vector;
{
}
+ @SuppressWarnings("rawtypes")
protected SequenceI postProcessChain(PDBChain chain)
{
SequenceI pdbSequence = chain.sequence;
sourceDBRef.setEndRes(pdbSequence.getEnd());
// PDBChain objects maintain reference to dataset
- SequenceI chainseq = pdbSequence.deriveSequence();
- chainseq.setSourceDBRef(sourceDBRef);
+
+ // SequenceI chainseq = pdbSequence.deriveSequence();
+ // chainseq.setSourceDBRef(sourceDBRef);
+ // chainseq.addPDBId(entry);
+ // chainseq.addDBRef(sourceDBRef);
+ SequenceI chainseq = chain.sequence;
chainseq.addPDBId(entry);
+ chainseq.setSourceDBRef(sourceDBRef);
chainseq.addDBRef(sourceDBRef);
-
seqs.addElement(chainseq);
AlignmentAnnotation[] chainannot = chainseq.getAnnotation();
return chainseq;
}
+ @SuppressWarnings({ "unchecked", "rawtypes" })
protected void processPdbFileWithAnnotate3d(List<SequenceI> rna)
throws Exception
{
}
}
+ @SuppressWarnings("unchecked")
protected void replaceAndUpdateChains(List<SequenceI> prot,
AlignmentI al,
String pep, boolean b)
}
}
+ /**
+ * Predict secondary structure for RNA and/or protein sequences and add as
+ * annotations
+ *
+ * @param rnaSequences
+ * @param proteinSequences
+ */
+ protected void addSecondaryStructure(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
+ {
+ processWithJmolParser(proteinSequences);
+ } catch (Exception x)
+ {
+ System.err
+ .println("Exceptions from Jmol when processing data in pdb file");
+ x.printStackTrace();
+ }
+ }
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ private void processWithJmolParser(List<SequenceI> prot)
+ throws Exception
+ {
+ try
+ {
+
+ Class cl = Class.forName("jalview.ext.jmol.JmolParser");
+ if (cl != null)
+ {
+ final Constructor constructor = cl
+ .getConstructor(new Class[] { FileParse.class });
+ final Object[] args = new Object[] { new FileParse(getDataName(),
+ type) };
+ Object jmf = constructor.newInstance(args);
+ AlignmentI al = new Alignment((SequenceI[]) cl.getMethod(
+ "getSeqsAsArray", new Class[] {}).invoke(jmf));
+ cl.getMethod("addAnnotations", new Class[] { AlignmentI.class })
+ .invoke(jmf, al);
+ for (SequenceI sq : al.getSequences())
+ {
+ if (sq.getDatasetSequence() != null)
+ {
+ sq.getDatasetSequence().getAllPDBEntries().clear();
+ }
+ else
+ {
+ sq.getAllPDBEntries().clear();
+ }
+ }
+ replaceAndUpdateChains(prot, al, AlignSeq.PEP, false);
+ }
+ } catch (ClassNotFoundException q)
+ {
+ }
+ }
+
public PDBChain findChain(String id) throws Exception
{
for (PDBChain chain : getChains())