Clover icon

Coverage Report

  1. Project Clover database Mon Nov 18 2024 09:38:20 GMT
  2. Package mc_view

File PDBChain.java

 

Coverage histogram

../img/srcFileCovDistChart7.png
21% of files have more coverage

Code metrics

122
245
17
1
785
555
99
0.4
14.41
17
5.82

Classes

Class Line # Actions
PDBChain 44 245 99
0.695312569.5%
 

Contributing tests

This file is covered by 35 tests. .

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
20    */
21    package mc_view;
22   
23    import java.awt.Color;
24    import java.util.List;
25    import java.util.Locale;
26    import java.util.Vector;
27   
28    import jalview.analysis.AlignSeq;
29    import jalview.datamodel.AlignmentAnnotation;
30    import jalview.datamodel.Annotation;
31    import jalview.datamodel.ContactMatrixI;
32    import jalview.datamodel.Mapping;
33    import jalview.datamodel.Sequence;
34    import jalview.datamodel.SequenceFeature;
35    import jalview.datamodel.SequenceI;
36    import jalview.datamodel.annotations.AnnotationRowBuilder;
37    import jalview.schemes.ColourSchemeI;
38    import jalview.schemes.ResidueProperties;
39    import jalview.structure.StructureImportSettings;
40    import jalview.structure.StructureMapping;
41    import jalview.util.Comparison;
42    import jalview.ws.datamodel.MappableContactMatrixI;
43   
 
44    public class PDBChain
45    {
46    public static final String RESNUM_FEATURE = "RESNUM";
47   
48    private static final String IEASTATUS = "IEA:jalview";
49   
50    public String id;
51   
52    public Vector<Bond> bonds = new Vector<>();
53   
54    public Vector<Atom> atoms = new Vector<>();
55   
56    public Vector<Residue> residues = new Vector<>();
57   
58    public int offset;
59   
60    /**
61    * sequence is the sequence extracted by the chain parsing code
62    */
63    public SequenceI sequence;
64   
65    /**
66    * shadow is the sequence created by any other parsing processes (e.g. Jmol,
67    * RNAview)
68    */
69    public SequenceI shadow = null;
70   
71    public boolean isNa = false;
72   
73    public boolean isVisible = true;
74   
75    public int pdbstart = 0;
76   
77    public int pdbend = 0;
78   
79    public int seqstart = 0;
80   
81    public int seqend = 0;
82   
83    public String pdbid = "";
84   
85    AnnotationRowBuilder tfacTemplate = new AnnotationRowBuilder(
86    "Temperature Factor");
87   
 
88  104 toggle public PDBChain(String thePdbid, String theId,
89    AnnotationRowBuilder template)
90    {
91  104 this(thePdbid, theId);
92  104 if (template != null)
93    {
94  6 tfacTemplate = template;
95    }
96    }
97   
98    /**
99    * import chain data assuming Temperature Factor is in the Temperature Factor
100    * column
101    *
102    * @param thePdbid
103    * @param theId
104    */
 
105  148 toggle public PDBChain(String thePdbid, String theId)
106    {
107  148 this.pdbid = thePdbid == null ? thePdbid
108    : thePdbid.toLowerCase(Locale.ROOT);
109  148 this.id = theId;
110    }
111   
112    /**
113    * character used to write newlines
114    */
115    protected String newline = System.getProperty("line.separator");
116   
117    public Mapping shadowMap;
118   
 
119  1 toggle public void setNewlineString(String nl)
120    {
121  1 newline = nl;
122    }
123   
 
124  2 toggle public String getNewlineString()
125    {
126  2 return newline;
127    }
128   
 
129  1 toggle public String print()
130    {
131  1 StringBuilder tmp = new StringBuilder(256);
132   
133  1 for (Bond b : bonds)
134    {
135  3 tmp.append(b.at1.resName).append(" ").append(b.at1.resNumber)
136    .append(" ").append(offset).append(newline);
137    }
138   
139  1 return tmp.toString();
140    }
141   
142    /**
143    * Annotate the residues with their corresponding positions in s1 using the
144    * alignment in as NOTE: This clears all atom.alignmentMapping values on the
145    * structure.
146    *
147    * @param as
148    * @param s1
149    */
 
150  33 toggle public void makeExactMapping(AlignSeq as, SequenceI s1)
151    {
152  33 int pdbpos = as.getSeq2Start() - 2;
153  33 int alignpos = s1.getStart() + as.getSeq1Start() - 3;
154    // first clear out any old alignmentMapping values:
155  33 for (Atom atom : atoms)
156    {
157  3487 atom.alignmentMapping = -1;
158    }
159    // and now trace the alignment onto the atom set.
160  3517 for (int i = 0; i < as.astr1.length(); i++)
161    {
162  3484 if (as.astr1.charAt(i) != '-')
163    {
164  3484 alignpos++;
165    }
166   
167  3484 if (as.astr2.charAt(i) != '-')
168    {
169  3484 pdbpos++;
170    }
171   
172  3484 boolean sameResidue = Comparison.isSameResidue(as.astr1.charAt(i),
173    as.astr2.charAt(i), false);
174  3484 if (sameResidue)
175    {
176  3483 if (pdbpos >= residues.size())
177    {
178  0 continue;
179    }
180  3483 Residue res = residues.elementAt(pdbpos);
181  3483 for (Atom atom : res.atoms)
182    {
183  3486 atom.alignmentMapping = alignpos;
184    }
185    }
186    }
187    }
188   
189    /**
190    * like makeExactMapping but using a sequence mapping object
191    *
192    * @param sqmpping
193    * @param seq
194    */
 
195  0 toggle public void mapChainWith(Mapping sqmpping, SequenceI seq)
196    {
197  0 for (Atom atom : atoms)
198    {
199  0 atom.alignmentMapping = -1;
200    }
201    // and now map sqmapping to the atom set.
202  0 int[] range = sqmpping.locateRange(seq.getStart(), seq.getEnd());
203  0 int r = 0, from, to;
204  0 while (r < range.length)
205    {
206  0 from = range[r++];
207  0 to = range[r++];
208  0 for (int pdbpos = from; pdbpos <= to; pdbpos++)
209    {
210  0 if (pdbpos >= residues.size())
211    {
212  0 continue;
213    }
214  0 Residue res = residues.elementAt(pdbpos);
215  0 for (Atom atom : res.atoms)
216    {
217  0 atom.alignmentMapping = sqmpping.getPosition(pdbpos);
218    }
219    }
220    }
221    }
222   
223    /**
224    * Annotate the residues with their corresponding positions in s1 using the
225    * alignment in as NOTE: This clears all atom.alignmentMapping values on the
226    * structure.
227    *
228    * @param as
229    * @param s1
230    */
 
231  0 toggle public void makeExactMapping(StructureMapping mapping, SequenceI s1)
232    {
233    // first clear out any old alignmentMapping values:
234  0 for (Atom atom : atoms)
235    {
236  0 atom.alignmentMapping = -1;
237    }
238  0 SequenceI ds = s1;
239  0 while (ds.getDatasetSequence() != null)
240    {
241  0 ds = ds.getDatasetSequence();
242    }
243  0 int pdboffset = 0;
244  0 for (Residue res : residues)
245    {
246    // res.number isn't set correctly for discontinuous/mismapped residues
247  0 int seqpos = mapping.getSeqPos(res.atoms.get(0).resNumber);
248  0 char strchar = sequence.getCharAt(pdboffset++);
249  0 if (seqpos == StructureMapping.UNASSIGNED_VALUE)
250    {
251  0 continue;
252    }
253  0 char seqchar = ds.getCharAt(seqpos - ds.getStart());
254   
255  0 boolean sameResidue = Comparison.isSameResidue(seqchar, strchar,
256    false);
257  0 if (sameResidue)
258    {
259  0 for (Atom atom : res.atoms)
260    {
261  0 atom.alignmentMapping = seqpos - 1;
262    }
263    }
264    }
265    }
266   
267    /**
268    * Copies over the RESNUM seqfeatures from the internal chain sequence to the
269    * mapped sequence
270    *
271    * @param seq
272    * @param status
273    * The Status of the transferred annotation
274    *
275    * @param altPDBID
276    * the group id for the features on the destination sequence (e.g.
277    * the official accession ID)
278    */
 
279  32 toggle public void transferRESNUMFeatures(SequenceI seq, String status,
280    String altPDBID)
281    {
282  32 if (altPDBID == null)
283    {
284  0 altPDBID = pdbid;
285    }
286  32 SequenceI sq = seq;
287  62 while (sq != null && sq.getDatasetSequence() != null)
288    {
289  30 sq = sq.getDatasetSequence();
290  30 if (sq == sequence)
291    {
292  0 return;
293    }
294    }
295   
296    /*
297    * Remove any existing features for this chain if they exist ?
298    * SequenceFeature[] seqsfeatures=seq.getSequenceFeatures(); int
299    * totfeat=seqsfeatures.length; // Remove any features for this exact chain
300    * ? for (int i=0; i<seqsfeatures.length; i++) { }
301    */
302  32 if (status == null)
303    {
304  32 status = PDBChain.IEASTATUS;
305    }
306   
307  32 List<SequenceFeature> features = sequence.getSequenceFeatures();
308  32 for (SequenceFeature feature : features)
309    {
310  3481 if (feature.getFeatureGroup() != null
311    && feature.getFeatureGroup().equals(pdbid))
312    {
313  3481 int newBegin = 1
314    + residues.elementAt(feature.getBegin() - offset).atoms
315    .elementAt(0).alignmentMapping;
316  3481 int newEnd = 1 + residues.elementAt(feature.getEnd() - offset).atoms
317    .elementAt(0).alignmentMapping;
318  3481 SequenceFeature tx = new SequenceFeature(feature, newBegin, newEnd,
319    altPDBID, feature.getScore());
320  3481 tx.setStatus(status
321  3481 + ((tx.getStatus() == null || tx.getStatus().length() == 0)
322    ? ""
323    : ":" + tx.getStatus()));
324  3481 if (tx.begin != 0 && tx.end != 0)
325    {
326  3480 sq.addSequenceFeature(tx);
327    }
328    }
329    }
330    }
331   
332    /**
333    * Traverses the list of residues and constructs bonds where CA-to-CA atoms or
334    * P-to-P atoms are found. Also sets the 'isNa' flag if more than 99% of
335    * residues contain a P not a CA.
336    */
 
337  138 toggle public void makeCaBondList()
338    {
339  138 boolean na = false;
340  138 int numNa = 0;
341  25853 for (int i = 0; i < (residues.size() - 1); i++)
342    {
343  25715 Residue tmpres = residues.elementAt(i);
344  25715 Residue tmpres2 = residues.elementAt(i + 1);
345  25715 Atom at1 = tmpres.findAtom("CA");
346  25715 Atom at2 = tmpres2.findAtom("CA");
347  25715 na = false;
348  25715 if ((at1 == null) && (at2 == null))
349    {
350  2 na = true;
351  2 at1 = tmpres.findAtom("P");
352  2 at2 = tmpres2.findAtom("P");
353    }
354  25715 if ((at1 != null) && (at2 != null))
355    {
356  25715 if (at1.chain.equals(at2.chain))
357    {
358  25715 if (na)
359    {
360  2 numNa++;
361    }
362  25715 makeBond(at1, at2);
363    }
364    }
365    else
366    {
367  0 System.out.println("not found " + i);
368    }
369    }
370   
371    /*
372    * If > 99% 'P', flag as nucleotide; note the count doesn't include the last
373    * residue
374    */
375  138 if (residues.size() > 1 && (numNa / (residues.size() - 1) > 0.99))
376    {
377  1 isNa = true;
378    }
379    }
380   
381    /**
382    * Construct a bond from atom1 to atom2 and add it to the list of bonds for
383    * this chain
384    *
385    * @param at1
386    * @param at2
387    */
 
388  25725 toggle public void makeBond(Atom at1, Atom at2)
389    {
390  25725 bonds.addElement(new Bond(at1, at2));
391    }
392   
393    /**
394    * Traverses the list of atoms and
395    * <ul>
396    * <li>constructs a list of Residues, each containing all the atoms that share
397    * the same residue number</li>
398    * <li>adds a RESNUM sequence feature for each position</li>
399    * <li>creates the sequence string</li>
400    * <li>determines if nucleotide</li>
401    * <li>saves the residue number of the first atom as 'offset'</li>
402    * <li>adds temp factor annotation if the flag is set to do so</li>
403    * </ul>
404    *
405    * @param visibleChainAnnotation
406    */
 
407  141 toggle public void makeResidueList(boolean visibleChainAnnotation)
408    {
409  141 int count = 0;
410  141 Object symbol;
411  141 boolean deoxyn = false;
412  141 boolean nucleotide = false;
413  141 StringBuilder seq = new StringBuilder(256);
414  141 Vector<SequenceFeature> resFeatures = new Vector<>();
415  141 Vector<Annotation> resAnnotation = new Vector<>();
416  141 int iSize = atoms.size() - 1;
417  141 int resNumber = -1;
418  141 char insCode = ' ';
419   
420  26003 for (int i = 0; i <= iSize; i++)
421    {
422  25862 Atom tmp = atoms.elementAt(i);
423  25862 resNumber = tmp.resNumber;
424  25862 insCode = tmp.insCode;
425   
426  25862 int res = resNumber;
427  25862 char ins = insCode;
428   
429  25862 if (i == 0)
430    {
431  141 offset = resNumber;
432    }
433   
434  25862 Vector<Atom> resAtoms = new Vector<>();
435    // Add atoms to a vector while the residue number
436    // remains the same as the first atom's resNumber (res)
437  51745 while ((resNumber == res) && (ins == insCode) && (i < atoms.size()))
438    {
439  25883 resAtoms.add(atoms.elementAt(i));
440  25883 i++;
441   
442  25883 if (i < atoms.size())
443    {
444  25742 resNumber = atoms.elementAt(i).resNumber;
445  25742 insCode = atoms.elementAt(i).insCode;
446    }
447    else
448    {
449  141 resNumber++;
450    }
451    }
452   
453    // We need this to keep in step with the outer for i = loop
454  25862 i--;
455   
456    // Add inserted residues as features to the base residue
457  25862 Atom currAtom = resAtoms.get(0);
458  25862 if (currAtom.insCode != ' ' && !residues.isEmpty()
459    && residues.lastElement().atoms
460    .get(0).resNumber == currAtom.resNumber)
461    {
462  0 String desc = currAtom.resName + ":" + currAtom.resNumIns + " "
463    + pdbid + id;
464  0 SequenceFeature sf = new SequenceFeature("INSERTION", desc,
465    offset + count - 1, offset + count - 1, "PDB_INS");
466  0 resFeatures.addElement(sf);
467  0 residues.lastElement().atoms.addAll(resAtoms);
468    }
469    else
470    {
471    // Make a new Residue object with the new atoms vector
472  25862 residues.addElement(new Residue(resAtoms, resNumber - 1, count));
473   
474  25862 Residue tmpres = residues.lastElement();
475  25862 Atom tmpat = tmpres.atoms.get(0);
476    // Make A new SequenceFeature for the current residue numbering
477  25862 String desc = tmpat.resName + ":" + tmpat.resNumIns + " " + pdbid
478    + id;
479  25862 SequenceFeature sf = new SequenceFeature(RESNUM_FEATURE, desc,
480    offset + count, offset + count, pdbid);
481  25862 resFeatures.addElement(sf);
482  25862 resAnnotation.addElement(new Annotation(tmpat.tfactor));
483    // Keep totting up the sequence
484   
485  ? if ((symbol = ResidueProperties.getAA3Hash()
486    .get(tmpat.resName)) == null)
487    {
488  7 String nucname = tmpat.resName.trim();
489    // use the aaIndex rather than call 'toLower' - which would take a bit
490    // more time.
491  7 deoxyn = nucname.length() == 2
492    && ResidueProperties.aaIndex[nucname
493    .charAt(0)] == ResidueProperties.aaIndex['D'];
494  7 if (tmpat.name.equalsIgnoreCase("CA")
495    || ResidueProperties.nucleotideIndex[nucname
496  3 .charAt((deoxyn ? 1 : 0))] == -1)
497    {
498  4 char r = ResidueProperties.getSingleCharacterCode(
499    ResidueProperties.getCanonicalAminoAcid(tmpat.resName));
500  4 seq.append(r == '0' ? 'X' : r);
501    // System.err.println("PDBReader:Null aa3Hash for " +
502    // tmpat.resName);
503    }
504    else
505    {
506    // nucleotide flag
507  3 nucleotide = true;
508  3 seq.append(nucname.charAt((deoxyn ? 1 : 0)));
509    }
510    }
511    else
512    {
513  25855 if (nucleotide)
514    {
515  0 System.err.println(
516    "Warning: mixed nucleotide and amino acid chain.. its gonna do bad things to you!");
517    }
518  25855 seq.append(ResidueProperties.aa[((Integer) symbol).intValue()]);
519    }
520  25862 count++;
521    }
522    }
523   
524  141 if (id.length() < 1)
525    {
526  0 id = " ";
527    }
528  141 isNa = nucleotide;
529  141 sequence = new Sequence(id, seq.toString(), offset, resNumber - 1); // Note:
530    // resNumber-offset
531    // ~=
532    // seq.size()
533    // Add normalised feature scores to RESNUM indicating start/end of sequence
534    // sf.setScore(offset+count);
535   
536    // System.out.println("PDB Sequence is :\nSequence = " + seq);
537    // System.out.println("No of residues = " + residues.size());
538   
539  141 if (StructureImportSettings.isShowSeqFeatures())
540    {
541  127 iSize = resFeatures.size();
542  22637 for (int i = 0; i < iSize; i++)
543    {
544  22510 sequence.addSequenceFeature(resFeatures.elementAt(i));
545  22510 resFeatures.setElementAt(null, i);
546    }
547    }
548  141 if (visibleChainAnnotation)
549    {
550  89 Annotation[] annots = new Annotation[resAnnotation.size()];
551  89 float max = 0f;
552  89 float min = 0f;
553  89 iSize = annots.length;
554  15554 for (int i = 0; i < iSize; i++)
555    {
556  15465 annots[i] = resAnnotation.elementAt(i);
557  15465 tfacTemplate.processAnnotation(annots[i]);
558  15465 max = Math.max(max, annots[i].value);
559  15465 min = Math.min(min, annots[i].value);
560  15465 resAnnotation.setElementAt(null, i);
561    }
562  89 if (tfacTemplate.isHasMinMax())
563    {
564  6 max = tfacTemplate.getMax();
565  6 min = tfacTemplate.getMin();
566    }
567   
568  89 AlignmentAnnotation tfactorann = new AlignmentAnnotation(
569    tfacTemplate.getName(),
570  89 (tfacTemplate.isHasDescription()
571    ? tfacTemplate.getDescription()
572    : tfacTemplate.getName()) + " for " + pdbid + id,
573    annots, min, max, AlignmentAnnotation.LINE_GRAPH);
574  89 tfactorann.setTFType(tfacTemplate.getTFType());
575  89 tfactorann.setCalcId(getClass().getName());
576   
577  89 tfactorann.setSequenceRef(sequence);
578  89 sequence.addAlignmentAnnotation(tfactorann);
579    }
580    }
581   
582    /**
583    * Colour start/end of bonds by charge
584    * <ul>
585    * <li>ASP and GLU red</li>
586    * <li>LYS and ARG blue</li>
587    * <li>CYS yellow</li>
588    * <li>others light gray</li>
589    * </ul>
590    */
 
591  1 toggle public void setChargeColours()
592    {
593  1 for (Bond b : bonds)
594    {
595  3 if (b.at1 != null && b.at2 != null)
596    {
597  3 b.startCol = getChargeColour(b.at1.resName);
598  3 b.endCol = getChargeColour(b.at2.resName);
599    }
600    else
601    {
602  0 b.startCol = Color.gray;
603  0 b.endCol = Color.gray;
604    }
605    }
606    }
607   
 
608  13 toggle public static Color getChargeColour(String resName)
609    {
610  13 Color result = Color.lightGray;
611  13 if ("ASP".equals(resName) || "GLU".equals(resName))
612    {
613  3 result = Color.red;
614    }
615  10 else if ("LYS".equals(resName) || "ARG".equals(resName))
616    {
617  4 result = Color.blue;
618    }
619  6 else if ("CYS".equals(resName))
620    {
621  3 result = Color.yellow;
622    }
623  13 return result;
624    }
625   
626    /**
627    * Sets the start/end colours of bonds to those of the start/end atoms
628    * according to the specified colour scheme. Note: currently only works for
629    * peptide residues.
630    *
631    * @param cs
632    */
 
633  1 toggle public void setChainColours(ColourSchemeI cs)
634    {
635  1 int index;
636  1 for (Bond b : bonds)
637    {
638  3 try
639    {
640  3 index = ResidueProperties.aa3Hash.get(b.at1.resName).intValue();
641  3 b.startCol = cs.findColour(ResidueProperties.aa[index].charAt(0), 0,
642    null, null, 0f);
643   
644  3 index = ResidueProperties.aa3Hash.get(b.at2.resName).intValue();
645  2 b.endCol = cs.findColour(ResidueProperties.aa[index].charAt(0), 0,
646    null, null, 0f);
647   
648    } catch (Exception e)
649    {
650  1 b.startCol = Color.gray;
651  1 b.endCol = Color.gray;
652    }
653    }
654    }
655   
 
656  1 toggle public void setChainColours(Color col)
657    {
658  1 for (Bond b : bonds)
659    {
660  2 b.startCol = col;
661  2 b.endCol = col;
662    }
663    }
664   
665    /**
666    * copy any sequence annotation onto the sequence mapped using the provided
667    * StructureMapping
668    *
669    * @param mapping
670    * - positional mapping between destination sequence and pdb resnum
671    * @param sqmpping
672    * - mapping between destination sequence and local chain
673    */
 
674  32 toggle public void transferResidueAnnotation(StructureMapping mapping,
675    jalview.datamodel.Mapping sqmpping)
676    {
677  32 SequenceI sq = mapping.getSequence();
678  32 SequenceI dsq = sq;
679  32 if (sqmpping == null)
680    {
681    // SIFTS mappings are recorded in the StructureMapping object...
682   
683  0 sqmpping = mapping.getSeqToPdbMapping();
684    }
685  32 if (sq != null)
686    {
687  62 while (dsq.getDatasetSequence() != null)
688    {
689  30 dsq = dsq.getDatasetSequence();
690    }
691    // any annotation will be transferred onto the dataset sequence
692   
693  32 if (shadow != null && shadow.getAnnotation() != null)
694    {
695   
696  0 for (AlignmentAnnotation ana : shadow.getAnnotation())
697    {
698    // match on calcId, label and description so annotations from
699    // different structures are preserved
700  0 List<AlignmentAnnotation> transfer = sq.getAlignmentAnnotations(
701    ana.getCalcId(), ana.label, ana.description);
702  0 if (transfer == null || transfer.size() == 0)
703    {
704  0 ContactMatrixI cm = shadow.getContactMatrixFor(ana);
705  0 ana = new AlignmentAnnotation(ana);
706    // TODO map contact matrix under mapping
707  0 ana.liftOver(sequence, shadowMap);
708  0 ana.liftOver(dsq, sqmpping);
709  0 dsq.addAlignmentAnnotation(ana);
710  0 if (cm != null)
711    {
712  0 dsq.addContactListFor(ana, cm);
713    }
714    }
715    else
716    {
717  0 continue;
718    }
719    }
720    }
721    else
722    {
723  32 if (sequence != null && sequence.getAnnotation() != null)
724    {
725  32 for (AlignmentAnnotation ana : sequence.getAnnotation())
726    {
727    // match on calcId, label and description so annotations from
728    // different structures are preserved
729  54 List<AlignmentAnnotation> transfer = dsq
730    .getAlignmentAnnotations(ana.getCalcId(), ana.label,
731    ana.description);
732  54 if (transfer == null || transfer.size() == 0)
733    {
734  46 ContactMatrixI cm = sequence.getContactMatrixFor(ana);
735  46 ana = new AlignmentAnnotation(ana);
736  46 ana.liftOver(dsq, sqmpping);
737  46 dsq.addAlignmentAnnotation(ana);
738  46 if (cm != null && cm instanceof MappableContactMatrixI)
739    {
740  6 dsq.addContactListFor(ana, ((MappableContactMatrixI) cm)
741    .liftOver(dsq, sqmpping));
742    }
743    }
744    else
745    {
746  8 continue;
747    }
748    }
749    }
750    }
751  32 if (false)
752    {
753    // Useful for debugging mappings - adds annotation for mapped position
754  0 float min = -1, max = 0;
755  0 Annotation[] an = new Annotation[sq.getEnd() - sq.getStart() + 1];
756  0 for (int i = sq.getStart(), j = sq.getEnd(),
757  0 k = 0; i <= j; i++, k++)
758    {
759  0 int prn = mapping.getPDBResNum(k + 1);
760   
761  0 an[k] = new Annotation(prn);
762  0 if (min == -1)
763    {
764  0 min = k;
765  0 max = k;
766    }
767    else
768    {
769  0 if (min > k)
770    {
771  0 min = k;
772    }
773  0 else if (max < k)
774    {
775  0 max = k;
776    }
777    }
778    }
779  0 sq.addAlignmentAnnotation(new AlignmentAnnotation("PDB.RESNUM",
780    "PDB Residue Numbering for " + this.pdbid + ":" + this.id,
781    an, min, max, AlignmentAnnotation.LINE_GRAPH));
782    }
783    }
784    }
785    }