import java.io.*;
import java.util.*;
-
+import java.util.List;
import java.awt.*;
import jalview.analysis.AlignSeq;
*/
boolean VisibleChainAnnotation = false;
- public PDBfile(String inFile, String inType) throws IOException
+ boolean processSecondaryStructure=true;
+
+
+ public PDBfile(boolean visibleChainAnnotation,
+ boolean processSecondaryStructure)
+ {
+ super();
+ VisibleChainAnnotation = visibleChainAnnotation;
+ this.processSecondaryStructure = processSecondaryStructure;
+ }
+
+ public PDBfile(boolean visibleChainAnnotation,
+ boolean processSecondaryStructure, String file, String protocol) throws IOException
{
- super(inFile, inType);
+ super(false, file, protocol);
+ VisibleChainAnnotation = visibleChainAnnotation;
+ this.processSecondaryStructure = processSecondaryStructure;
+ doParse();
}
- public PDBfile(FileParse source) throws IOException
+ public PDBfile(boolean visibleChainAnnotation,
+ boolean processSecondaryStructure, FileParse source) throws IOException
{
- super(source);
+ super(false, source);
+ VisibleChainAnnotation = visibleChainAnnotation;
+ this.processSecondaryStructure = processSecondaryStructure;
+ doParse();
}
public String print()
}
}
}
+ if (processSecondaryStructure)
+ {
if (rna.size() > 0)
try
{
} catch (Exception x)
{
System.err
- .println("Exceptions when dealing with RNA in pdb file");
- x.printStackTrace();
-
- }
- ;
- if (prot.size() > 0)
- try
- {
- processPdbFileWithJmol(prot);
- } catch (Exception x)
- {
- System.err
- .println("Exceptions when dealing with RNA in pdb file");
+ .println("Exceptions from Jmol when processing data in pdb file");
x.printStackTrace();
}
- ;
+ }
} catch (OutOfMemoryError er)
{
System.out.println("OUT OF MEMORY LOADING PDB FILE");
{}).invoke(jmf));
cl.getMethod("addAnnotations", new Class[]
{ Alignment.class }).invoke(jmf, al);
- replaceMatchingSeqsWith(prot, al, AlignSeq.PEP);
+ replaceMatchingSeqsWith(seqs, annotations, prot, al, AlignSeq.PEP, false);
}
} catch (ClassNotFoundException q)
{
new Class[]
{ FileParse.class }).invoke(annotate3d, new Object[]
{ new FileParse(getDataName(), type) }));
- replaceMatchingSeqsWith(rna, al, AlignSeq.DNA);
+ replaceMatchingSeqsWith(seqs, annotations, rna, al, AlignSeq.DNA, false);
}
} catch (ClassNotFoundException x)
{
* @param ochains
* @param al
* @param dnaOrProtein
+ * @param removeOldAnnots when true, old annotation is cleared before new annotation transferred
*/
- private void replaceMatchingSeqsWith(ArrayList<SequenceI> ochains,
- AlignmentI al, String dnaOrProtein)
+ public static void replaceMatchingSeqsWith(List<SequenceI> seqs, List<AlignmentAnnotation> annotations, List<SequenceI> ochains,
+ AlignmentI al, String dnaOrProtein, boolean removeOldAnnots)
{
if (al != null && al.getHeight() > 0)
{
seqs.set(p, sq = matches.get(q));
sq.setName(sp.getName());
sq.setDescription(sp.getDescription());
- sq.transferAnnotation(sp, aligns.get(q).getMappingFromS1(false));
+ Mapping sp2sq;
+ sq.transferAnnotation(sp, sp2sq = aligns.get(q).getMappingFromS1(false));
int inspos = -1;
for (int ap = 0; ap < annotations.size();)
{
- if (((AlignmentAnnotation) annotations.get(ap)).sequenceRef == sp)
+ if (annotations.get(ap).sequenceRef == sp)
{
if (inspos == -1)
{
inspos = ap;
}
- annotations.remove(ap);
+ if (removeOldAnnots) {
+ annotations.remove(ap);
+ } else {
+ AlignmentAnnotation alan = annotations.get(ap);
+ alan.liftOver(sq, sp2sq);
+ alan.setSequenceRef(sq);
+ }
}
else
{