public String id;
- public Vector<Bond> bonds = new Vector<Bond>();
+ public Vector<Bond> bonds = new Vector<>();
- public Vector<Atom> atoms = new Vector<Atom>();
+ public Vector<Atom> atoms = new Vector<>();
- public Vector<Residue> residues = new Vector<Residue>();
+ public Vector<Residue> residues = new Vector<>();
public int offset;
}
/**
+ * Annotate the residues with their corresponding positions in s1 using the
+ * alignment in as NOTE: This clears all atom.alignmentMapping values on the
+ * structure.
+ *
+ * @param as
+ * @param s1
+ */
+ public void makeExactMapping(StructureMapping mapping, SequenceI s1)
+ {
+ // first clear out any old alignmentMapping values:
+ for (Atom atom : atoms)
+ {
+ atom.alignmentMapping = -1;
+ }
+ SequenceI ds = s1;
+ while (ds.getDatasetSequence() != null)
+ {
+ ds = ds.getDatasetSequence();
+ }
+ int pdboffset = 0;
+ for (Residue res : residues)
+ {
+ // res.number isn't set correctly for discontinuous/mismapped residues
+ int seqpos = mapping.getSeqPos(res.atoms.get(0).resNumber);
+ char strchar = sequence.getCharAt(pdboffset++);
+ if (seqpos == StructureMapping.UNASSIGNED_VALUE)
+ {
+ continue;
+ }
+ char seqchar = ds.getCharAt(seqpos - ds.getStart());
+
+ boolean sameResidue = Comparison.isSameResidue(
+ seqchar, strchar, false);
+ if (sameResidue)
+ {
+ for (Atom atom : res.atoms)
+ {
+ atom.alignmentMapping = seqpos - 1;
+ }
+ }
+ }
+ }
+
+ /**
* Copies over the RESNUM seqfeatures from the internal chain sequence to the
* mapped sequence
*
boolean deoxyn = false;
boolean nucleotide = false;
StringBuilder seq = new StringBuilder(256);
- Vector<SequenceFeature> resFeatures = new Vector<SequenceFeature>();
- Vector<Annotation> resAnnotation = new Vector<Annotation>();
- int i, iSize = atoms.size() - 1;
+ Vector<SequenceFeature> resFeatures = new Vector<>();
+ Vector<Annotation> resAnnotation = new Vector<>();
+ int iSize = atoms.size() - 1;
int resNumber = -1;
char insCode = ' ';
- for (i = 0; i <= iSize; i++)
+
+ for (int i = 0; i <= iSize; i++)
{
Atom tmp = atoms.elementAt(i);
resNumber = tmp.resNumber;
offset = resNumber;
}
- Vector<Atom> resAtoms = new Vector<Atom>();
+ Vector<Atom> resAtoms = new Vector<>();
// Add atoms to a vector while the residue number
// remains the same as the first atom's resNumber (res)
while ((resNumber == res) && (ins == insCode) && (i < atoms.size()))
if (StructureImportSettings.isShowSeqFeatures())
{
- for (i = 0, iSize = resFeatures.size(); i < iSize; i++)
+ iSize = resFeatures.size();
+ for (int i = 0; i < iSize; i++)
{
sequence.addSequenceFeature(resFeatures.elementAt(i));
resFeatures.setElementAt(null, i);
if (visibleChainAnnotation)
{
Annotation[] annots = new Annotation[resAnnotation.size()];
- float max = 0;
- for (i = 0, iSize = annots.length; i < iSize; i++)
+ float max = 0f;
+ float min = 0f;
+ iSize = annots.length;
+ for (int i = 0; i < iSize; i++)
{
annots[i] = resAnnotation.elementAt(i);
- if (annots[i].value > max)
- {
- max = annots[i].value;
- }
+ max = Math.max(max, annots[i].value);
+ min = Math.min(min, annots[i].value);
resAnnotation.setElementAt(null, i);
}
AlignmentAnnotation tfactorann = new AlignmentAnnotation(
"Temperature Factor", "Temperature Factor for " + pdbid + id,
- annots, 0, max, AlignmentAnnotation.LINE_GRAPH);
+ annots, min, max, AlignmentAnnotation.LINE_GRAPH);
tfactorann.setSequenceRef(sequence);
sequence.addAlignmentAnnotation(tfactorann);
}
{
SequenceI sq = mapping.getSequence();
SequenceI dsq = sq;
+ if (sqmpping == null)
+ {
+ // SIFTS mappings are recorded in the StructureMapping object...
+
+ sqmpping = mapping.getSeqToPdbMapping();
+ }
if (sq != null)
{
while (dsq.getDatasetSequence() != null)