+ JalviewStructureDisplayI viewr = openStructureViaChooser(alf,
+ pdb_viewseq, "4IM2");
+
+ // and check all is good with feature location still
+ verifySeqFeats(pdb_viewseq, offset, fdesc);
+
+ // finally check positional mapping for sequence and structure
+ PDBEntry pdbe = seq.getPDBEntry("4IM2");
+ StructureSelectionManager apssm = alf.alignPanel
+ .getStructureSelectionManager();
+ StructureMapping[] smap = apssm
+ .getMapping(pdbe.getFile());
+ assertNotNull(smap);
+ assertNotNull(smap[0]);
+ // find the last position in the alignment sequence - this is not
+ // 'SequenceI.getEnd()' - which gets the last PDBRESNUM rather than
+ // SequenceI.getStart() + number of residues in file...
+ int realSeqEnd = pdb_viewseq.findPosition(pdb_viewseq.getLength());
+ List<int[]> ranges = smap[0].getPDBResNumRanges(pdb_viewseq.getStart(),
+ realSeqEnd);
+ assertEquals(structuremap1.size(), ranges.size());
+ int tot_mapped = 0;
+ for (int p = 0; p < ranges.size(); p++)
+ {
+ assertArrayEquals(structuremap1.get(p), ranges.get(p));
+ tot_mapped += 1 + (structuremap1.get(p)[1] - structuremap1.get(p)[0]);
+ }
+
+ assertEquals(pdb_viewseq.getLength(), tot_mapped);
+
+ int lastmappedp = StructureMapping.UNASSIGNED_VALUE;
+ for (int rp = pdb_viewseq.getStart(), rpEnd = pdb_viewseq
+ .findPosition(pdb_viewseq.getLength() - 1); rp <= rpEnd; rp++)
+ {
+ int mappedp = smap[0].getPDBResNum(rp);
+ if (mappedp != StructureMapping.UNASSIGNED_VALUE)
+ {
+ tot_mapped--;
+ if (lastmappedp == mappedp)
+ {
+ Assert.fail("Duplicate mapped position at " + rp + " (dupe = "
+ + mappedp + ")");
+ }
+ }
+ }
+
+ Assert.assertEquals(tot_mapped, 0,
+ "Different number of mapped residues compared to ranges of mapped residues");
+
+ // positional mapping to atoms for color by structure is still wrong, even
+ // though panel looks correct.
+
+ StructureMappingcommandSet smcr[] = JmolCommands
+ .getColourBySequenceCommand(apssm,
+ new String[]
+ { pdbe.getFile() },
+ new SequenceI[][]
+ { new SequenceI[] { pdb_viewseq } },
+ new SequenceRenderer(alf.alignPanel.getAlignViewport()),
+ alf.alignPanel);
+ // Expected - all residues are white
+ for (StructureMappingcommandSet smm : smcr)
+ {
+ for (String c : smm.commands)
+ {
+ System.out.println(c);
+ }
+ }
+ }
+
+ private void verifySeqFeats(SequenceI pdbseq, int[] offset,
+ List<String> fdesc)
+ {
+ for (int o = 0; o < offset.length; o++)
+ {
+ int res = pdbseq.findPosition(offset[o]);
+ List<SequenceFeature> sf = pdbseq.getFeatures().findFeatures(res, res,
+ "RESNUM");
+ assertEquals("Expected sequence feature at position " + res + "("
+ + offset[o] + ")", 1, sf.size());
+ assertEquals("Wrong description at " + res + "(" + offset[o] + ")",
+ fdesc.get(o), sf.get(0).getDescription());
+ }
+
+ }
+
+ @Test(groups = { "Network" })
+ public void testAssociatedMappingToSubSeq() throws Exception
+ {
+
+ // currently this test fails if trimming is enabled
+ Cache.setProperty(DBRefFetcher.TRIM_RETRIEVED_SEQUENCES,
+ Boolean.FALSE.toString());
+ String TEMP_FACTOR_AA="Temperature Factor";
+ String PDBID = "4IM2";
+ String FullLengthSeq = ">TBK1_HUMAN Serine/threonine-protein kinase TBK1\n" +
+ "MQSTSNHLWLLSDILGQGATANVFRGRHKKTGDLFAIKVFNNISFLRPVDVQMREFEVLKKLNHKNIVKLFA\n" +
+ "IEEETTTRHKVLIMEFCPCGSLYTVLEEPSNAYGLPESEFLIVLRDVVGGMNHLRENGIVHRDIKPGNIMRV\n" +
+ "IGEDGQSVYKLTDFGAARELEDDEQFVSLYGTEEYLHPDMYERAVLRKDHQKKYGATVDLWSIGVTFYHAAT\n" +
+ "GSLPFRPFEGPRRNKEVMYKIITGKPSGAISGVQKAENGPIDWSGDMPVSCSLSRGLQVLLTPVLANILEAD\n" +
+ "QEKCWGFDQFFAETSDILHRMVIHVFSLQQMTAHKIYIHSYNTATIFHELVYKQTKIISSNQELIYEGRRLV\n" +
+ "LEPGRLAQHFPKTTEENPIFVVSREPLNTIGLIYEKISLPKVHPRYDLDGDASMAKAITGVVCYACRIASTL\n" +
+ "LLYQELMRKGIRWLIELIKDDYNETVHKKTEVVITLDFCIRNIEKTVKVYEKLMKINLEAAELGEISDIHTK\n" +
+ "LLRLSSSQGTIETSLQDIDSRLSPGGSLADAWAHQEGTHPKDRNVEKLQVLLNCMTEIYYQFKKDKAERRLA\n" +
+ "YNEEQIHKFDKQKLYYHATKAMTHFTDECVKKYEAFLNKSEEWIRKMLHLRKQLLSLTNQCFDIEEEVSKYQ\n" +
+ "EYTNELQETLPQKMFTASSGIKHTMTPIYPSSNTLVEMTLGMKKLKEEMEGVVKELAENNHILERFGSLTMD\n" +
+ "GGLRNVDCL";