diff --git a/resources/views/scheduleInstrument.html b/resources/views/scheduleInstrument.html
index fb9b2631c..1526f1333 100644
--- a/resources/views/scheduleInstrument.html
+++ b/resources/views/scheduleInstrument.html
@@ -175,7 +175,7 @@
Time Scheduled
instrument = instrument ? parseInt(instrument) || null : null;
if (!project) {
- alert('No project selected');
+ document.getElementById('calendar').innerText = 'Invalid or no project specified';
return;
}
diff --git a/src/org/labkey/targetedms/view/CrossLinkedPeptideInfo.java b/src/org/labkey/targetedms/view/CrossLinkedPeptideInfo.java
index 2293437be..c8774a0c4 100644
--- a/src/org/labkey/targetedms/view/CrossLinkedPeptideInfo.java
+++ b/src/org/labkey/targetedms/view/CrossLinkedPeptideInfo.java
@@ -189,12 +189,13 @@ public List findMatches(List proteins)
do
{
index = proteinSequence.indexOf(getUnmodified(), index + 1);
- if (index >= 0)
+ if (index != -1 &&
+ (index == 0 || proteinSequence.charAt(index - 1) == 'K' || proteinSequence.charAt(index - 1) == 'R'))
{
result.add(new Match(protein, index));
}
}
- while (index > 0);
+ while (index >= 0);
}
}
return result;
@@ -255,6 +256,37 @@ public void testOmittedIndices()
Assert.assertEquals("Link location", Set.of(9), i.getExtraSequences().get(0).getLinkIndices());
Assert.assertEquals("Link location", Set.of(4, 7, 0, 1), i.getExtraSequences().get(4).getLinkIndices());
}
+
+ @Test
+ public void testTrypticMatches()
+ {
+ CrossLinkedPeptideInfo info = new CrossLinkedPeptideInfo("PEPTIDE");
+ PeptideSequence seq = info.getBaseSequence();
+
+ // Single protein containing multiple occurrences of PEPTIDE:
+ // - at start (allowed)
+ // - preceded by A (disallowed)
+ // - preceded by K (allowed)
+ // - preceded by R (allowed)
+ Protein protein = new Protein();
+ String proteinSeq = "PEPTIDE" + "APEPTIDE" + "KPEPTIDE" + "RPEPTIDE";
+ protein.setSequence(proteinSeq);
+
+ List proteins = Arrays.asList(protein);
+ List matches = seq.findMatches(proteins);
+
+ // Expect three valid matches: indices 0 (start), 16 (after K), 24 (after R)
+ Assert.assertEquals("Should find three valid matches within a single protein sequence", 3, matches.size());
+
+ Assert.assertSame("First match should be at start (index 0)", protein, matches.get(0).protein());
+ Assert.assertEquals(0, matches.get(0).index());
+
+ Assert.assertSame("Second match should be after K at index 16", protein, matches.get(1).protein());
+ Assert.assertEquals(16, matches.get(1).index());
+
+ Assert.assertSame("Third match should be after R at index 24", protein, matches.get(2).protein());
+ Assert.assertEquals(24, matches.get(2).index());
+ }
}
public class Linker
diff --git a/test/sampledata/TargetedMS/CrosslinkPeptideMapTest.sky.zip b/test/sampledata/TargetedMS/CrosslinkPeptideMapTest.sky.zip
index 37bf5fc5b..287b2780f 100644
Binary files a/test/sampledata/TargetedMS/CrosslinkPeptideMapTest.sky.zip and b/test/sampledata/TargetedMS/CrosslinkPeptideMapTest.sky.zip differ
diff --git a/test/src/org/labkey/test/tests/targetedms/TargetedMSMAMTest.java b/test/src/org/labkey/test/tests/targetedms/TargetedMSMAMTest.java
index 01f5c0a4b..c7f393179 100644
--- a/test/src/org/labkey/test/tests/targetedms/TargetedMSMAMTest.java
+++ b/test/src/org/labkey/test/tests/targetedms/TargetedMSMAMTest.java
@@ -19,6 +19,8 @@
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.labkey.test.Locator;
+import org.labkey.test.util.DataRegion;
+import org.labkey.test.util.DataRegionTable;
import static org.junit.Assert.assertTrue;
@@ -56,10 +58,13 @@ public void testSteps()
assertTextPresent("Chromatograms");
clickAndWait(Locator.linkContainingText("Peptide Map"));
+ DataRegionTable table = new DataRegionTable("PeptideIds", getDriver());
+ table.setPageSize(250);
assertTextPresentInThisOrder("11.3", "14.1", "14.8");
assertTextPresentInThisOrder("1501.75", "1078.50", "1547.71");
- assertTextPresentInThisOrder("NU205", "NU205", "1433Z", "UCRI; RL35");
- assertTextPresentInThisOrder("70-84", "325-333", "28-41", "190-196; 26-32");
+ assertTextPresentInThisOrder("NU205", "1433Z", "RL35", "HSP72; HSP7C");
+ assertTextNotPresent("UCRI; RL35"); // Ensure we don't have non-tryptic matches anymore
+ assertTextPresentInThisOrder("70-84", "325-333", "28-41", "305-314; 302-311");
assertTextPresentInThisOrder("(K)ASTEGVAIQGQQGTR(L)", "(K)AQYEDIANR(S)", "(K)SVTEQGAELSNEER(N)");
assertTextPresentInThisOrder("Carbamidomethyl Cysteine @ C157", "Carbamidomethyl Cysteine @ C245", "Carbamidomethyl Cysteine @ C94");
@@ -75,15 +80,15 @@ public void testCrossLinkedPeptideMap()
clickAndWait(Locator.linkContainingText("Panorama Dashboard"));
clickAndWait(Locator.linkContainingText(CROSS_LINKED_SKY_FILE));
- verifyRunSummaryCountsPep(2,3,0, 3,3, 1, 0, 0);
+ verifyRunSummaryCountsPep(2,2,0, 2,2, 1, 0, 0);
clickAndWait(Locator.linkContainingText("Peptide Map"));
- assertTextPresentInThisOrder("364-366", "367-369", "364-367");
+ assertTextPresentInThisOrder("121-124", "342-345", "142-145");
// Disulfide bonds
- assertTextPresentInThisOrder("Q364-T369-D364/\nN366-T369-D364", "V121-S345-Q142/\nQ124-S345-Q142");
- assertTextPresentInThisOrder("(A)LKPLALV(D)", "(G)AVVQDPA(Y)", "(F)YGEATSR(E)");
+ assertTextPresentInThisOrder("V121-S345-Q142/\nQ124-S345-Q142", "L11-A137-Y271/\nL11-A137-Y271/\nV17-A137-Y271/");
+ assertTextPresentInThisOrder("(K)LKPLALV(D)", "(K)AVVQDPA(Y)", "(R)YGEATSR(E)");
// Ensure that the highlighting is as expected for both crosslinking and modification
- assertTrue(getHtmlSource().contains("(Y)QMN(D)"));
+ assertTrue(getHtmlSource().contains("(R)VSSQ(Q)"));
}
}