+ private StructureMapping getNWMappings(SequenceI seq, String pdbFile,
+ String maxChainId, PDBChain maxChain, StructureFile pdb,
+ AlignSeq maxAlignseq)
+ {
+ final StringBuilder mappingDetails = new StringBuilder(128);
+ mappingDetails.append(NEWLINE)
+ .append("Sequence \u27f7 Structure mapping details");
+ mappingDetails.append(NEWLINE);
+ mappingDetails
+ .append("Method: inferred with Needleman & Wunsch alignment");
+ mappingDetails.append(NEWLINE).append("PDB Sequence is :")
+ .append(NEWLINE).append("Sequence = ")
+ .append(maxChain.sequence.getSequenceAsString());
+ mappingDetails.append(NEWLINE).append("No of residues = ")
+ .append(maxChain.residues.size()).append(NEWLINE)
+ .append(NEWLINE);
+ PrintStream ps = new PrintStream(System.out)
+ {
+ @Override
+ public void print(String x)
+ {
+ mappingDetails.append(x);
+ }
+
+ @Override
+ public void println()
+ {
+ mappingDetails.append(NEWLINE);
+ }
+ };
+
+ maxAlignseq.printAlignment(ps);
+
+ mappingDetails.append(NEWLINE).append("PDB start/end ");
+ mappingDetails.append(String.valueOf(maxAlignseq.seq2start))
+ .append(" ");
+ mappingDetails.append(String.valueOf(maxAlignseq.seq2end));
+ mappingDetails.append(NEWLINE).append("SEQ start/end ");
+ mappingDetails
+ .append(String
+ .valueOf(maxAlignseq.seq1start + (seq.getStart() - 1)))
+ .append(" ");
+ mappingDetails.append(
+ String.valueOf(maxAlignseq.seq1end + (seq.getStart() - 1)));
+ mappingDetails.append(NEWLINE);
+ maxChain.makeExactMapping(maxAlignseq, seq);
+ jalview.datamodel.Mapping sqmpping = maxAlignseq
+ .getMappingFromS1(false);
+ maxChain.transferRESNUMFeatures(seq, null);
+
+ HashMap<Integer, int[]> mapping = new HashMap<>();
+ int resNum = -10000;
+ int index = 0;
+ char insCode = ' ';
+
+ do
+ {
+ Atom tmp = maxChain.atoms.elementAt(index);
+ if ((resNum != tmp.resNumber || insCode != tmp.insCode)
+ && tmp.alignmentMapping != -1)
+ {
+ resNum = tmp.resNumber;
+ insCode = tmp.insCode;
+ if (tmp.alignmentMapping >= -1)
+ {
+ mapping.put(tmp.alignmentMapping + 1,
+ new int[]
+ { tmp.resNumber, tmp.atomIndex });
+ }
+ }
+
+ index++;
+ } while (index < maxChain.atoms.size());
+
+ StructureMapping nwMapping = new StructureMapping(seq, pdbFile,
+ pdb.getId(), maxChainId, mapping, mappingDetails.toString());
+ maxChain.transferResidueAnnotation(nwMapping, sqmpping);
+ return nwMapping;