+ private ArrayList<StructureMapping> getNWMappings(SequenceI seq,
+ String pdbFile,
+ String maxChainId, PDBChain maxChain, PDBfile 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<Integer, int[]>();
+ int resNum = -10000;
+ int index = 0;
+
+ do
+ {
+ Atom tmp = maxChain.atoms.elementAt(index);
+ if (resNum != tmp.resNumber && tmp.alignmentMapping != -1)
+ {
+ resNum = tmp.resNumber;
+ if (tmp.alignmentMapping >= -1)
+ {
+ // TODO (JAL-1836) address root cause: negative residue no in PDB
+ // file
+ mapping.put(tmp.alignmentMapping + 1, new int[] { tmp.resNumber,
+ tmp.atomIndex });
+ }
+ }
+
+ index++;
+ } while (index < maxChain.atoms.size());
+
+ StructureMapping nwMapping = new StructureMapping(seq, pdbFile,
+ pdb.id, maxChainId, mapping, mappingDetails.toString());
+ maxChain.transferResidueAnnotation(nwMapping, sqmpping);
+ ArrayList<StructureMapping> mappings = new ArrayList<StructureMapping>();
+ mappings.add(nwMapping);
+ return mappings;
+ }
+