Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions src/org/labkey/targetedms/view/CrossLinkedPeptideInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public List<PeptideSequence> getExtraSequences()

public List<PeptideSequence> getAllSequences()
{

return getSequences(0);
}

Expand Down Expand Up @@ -189,12 +190,13 @@ public List<Match> findMatches(List<Protein> 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;
Expand Down Expand Up @@ -255,6 +257,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<Protein> proteins = Arrays.asList(protein);
List<Match> 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
Expand Down