*/
package MCview;
-import java.awt.Color;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Vector;
-
import jalview.analysis.AlignSeq;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
import jalview.io.FileParse;
import jalview.util.MessageManager;
+import java.awt.Color;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
+
public class PDBfile extends jalview.io.AlignFile
{
private static String CALC_ID_PREFIX = "JalviewPDB";
*/
private boolean externalSecondaryStructure = false;
- public PDBfile(boolean addAlignmentAnnotations, boolean predictSecondaryStructure,
- boolean externalSecStr)
+ public PDBfile(boolean addAlignmentAnnotations,
+ boolean predictSecondaryStructure, boolean externalSecStr)
{
super();
this.visibleChainAnnotation = addAlignmentAnnotations;
this.externalSecondaryStructure = externalSecStr;
}
- public PDBfile(boolean addAlignmentAnnotations, boolean predictSecondaryStructure,
- boolean externalSecStr, String file, String protocol)
- throws IOException
+ public PDBfile(boolean addAlignmentAnnotations,
+ boolean predictSecondaryStructure, boolean externalSecStr,
+ String file, String protocol) throws IOException
{
super(false, file, protocol);
this.visibleChainAnnotation = addAlignmentAnnotations;
doParse();
}
- public PDBfile(boolean addAlignmentAnnotations, boolean predictSecondaryStructure,
- boolean externalSecStr, FileParse source) throws IOException
+ public PDBfile(boolean addAlignmentAnnotations,
+ boolean predictSecondaryStructure, boolean externalSecStr,
+ FileParse source) throws IOException
{
super(false, source);
this.visibleChainAnnotation = addAlignmentAnnotations;
doParse();
}
+ @Override
public String print()
{
return null;
}
+ @Override
public void parse() throws IOException
{
// TODO set the filename sensibly - try using data source name.
processPdbFileWithAnnotate3d(rnaSequences);
} catch (Exception x)
{
- System.err
- .println("Exceptions when dealing with RNA in pdb file");
+ System.err.println("Exceptions when dealing with RNA in pdb file");
x.printStackTrace();
}
*/
protected SequenceI postProcessChain(PDBChain chain)
{
- SequenceI dataset = chain.sequence;
- dataset.setName(id + "|" + dataset.getName());
+ SequenceI pdbSequence = chain.sequence;
+ pdbSequence.setName(id + "|" + pdbSequence.getName());
PDBEntry entry = new PDBEntry();
entry.setId(id);
entry.setType(PDBEntry.Type.PDB);
// TODO: decide if we should dump the datasource to disk
entry.setFile(getDataName());
}
- dataset.addPDBId(entry);
+ pdbSequence.addPDBId(entry);
+
+ DBRefEntry sourceDBRef = new DBRefEntry();
+ sourceDBRef.setAccessionId(id);
+ sourceDBRef.setSource(DBRefSource.PDB);
+ sourceDBRef.setStartRes(pdbSequence.getStart());
+ sourceDBRef.setEndRes(pdbSequence.getEnd());
+ pdbSequence.setSourceDBRef(sourceDBRef);
// PDBChain objects maintain reference to dataset
- SequenceI chainseq = dataset.deriveSequence();
+ SequenceI chainseq = pdbSequence.deriveSequence();
seqs.addElement(chainseq);
AlignmentAnnotation[] chainannot = chainseq.getAnnotation();
public static String relocateCalcId(String calcId,
Hashtable<String, String> alreadyLoadedPDB) throws Exception
{
- int s = CALC_ID_PREFIX.length(), end = calcId.indexOf(CALC_ID_PREFIX, s);
+ int s = CALC_ID_PREFIX.length(), end = calcId
+ .indexOf(CALC_ID_PREFIX, s);
String between = calcId.substring(s, end - 1);
return CALC_ID_PREFIX + alreadyLoadedPDB.get(between) + ":"
+ calcId.substring(end);
Class cl = Class.forName("jalview.ext.jmol.PDBFileWithJmol");
if (cl != null)
{
- final Constructor constructor = cl.getConstructor(new Class[]
- { FileParse.class });
- final Object[] args = new Object[]
- { new FileParse(getDataName(), type) };
+ final Constructor constructor = cl
+ .getConstructor(new Class[] { FileParse.class });
+ final Object[] args = new Object[] { new FileParse(getDataName(),
+ type) };
Object jmf = constructor.newInstance(args);
- Alignment al = new Alignment((SequenceI[]) cl.getMethod(
- "getSeqsAsArray", new Class[]
- {}).invoke(jmf));
- cl.getMethod("addAnnotations", new Class[]
- { AlignmentI.class }).invoke(jmf, al);
+ 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().getPDBId().clear();
+ sq.getDatasetSequence().getAllPDBEntries().clear();
}
else
{
- sq.getPDBId().clear();
+ sq.getAllPDBEntries().clear();
}
}
replaceAndUpdateChains(prot, al, AlignSeq.PEP, false);
}
}
- private void replaceAndUpdateChains(List<SequenceI> prot,
- AlignmentI al, String pep, boolean b)
+ private void replaceAndUpdateChains(List<SequenceI> prot, AlignmentI al,
+ String pep, boolean b)
{
List<List<? extends Object>> replaced = AlignSeq
.replaceMatchingSeqsWith(seqs, annotations, prot, al, pep,
{
// TODO: use the PDB ID of the structure if one is available, to save
// bandwidth and avoid uploading the whole structure to the service
- Object annotate3d = cl.getConstructor(new Class[]
- {}).newInstance(new Object[]
- {});
+ Object annotate3d = cl.getConstructor(new Class[] {}).newInstance(
+ new Object[] {});
AlignmentI al = ((AlignmentI) cl.getMethod("getRNAMLFor",
- new Class[]
- { FileParse.class }).invoke(annotate3d, new Object[]
- { new FileParse(getDataName(), type) }));
+ new Class[] { FileParse.class }).invoke(annotate3d,
+ new Object[] { new FileParse(getDataName(), type) }));
for (SequenceI sq : al.getSequences())
{
if (sq.getDatasetSequence() != null)
{
- if (sq.getDatasetSequence().getPDBId() != null)
+ if (sq.getDatasetSequence().getAllPDBEntries() != null)
{
- sq.getDatasetSequence().getPDBId().clear();
+ sq.getDatasetSequence().getAllPDBEntries().clear();
}
}
else
{
- if (sq.getPDBId() != null)
+ if (sq.getAllPDBEntries() != null)
{
- sq.getPDBId().clear();
+ sq.getAllPDBEntries().clear();
}
}
}