Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion pepdb/src/org/scharp/atlas/pepdb/PepDBController.java
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ public ModelAndView getView(PeptideAndGroupForm form, BindException errors) thro
pg = PepDBManager.getPeptideGroupByID(peptideGroupId);
}
catch (NumberFormatException ignored) {}
if (pg == null || !getContainer().getId().equalsIgnoreCase(pg.getContainerId()))
if (pg == null)
{
throw new NotFoundException();
}
Expand Down
10 changes: 6 additions & 4 deletions pepdb/src/org/scharp/atlas/pepdb/PepDBManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,12 @@ public static Peptides[] getParentPeptides(Peptides p) throws SQLException

public static Peptides[] getHyphanatedParents(Peptides p) throws SQLException
{
String sql = "select * from "+schema.getTableInfoPeptides()+" where peptides.protein_cat_id = ? " +
" and peptides.peptide_sequence LIKE '%"+p.getPeptide_sequence()+"%' " +
" and child = false";
Peptides[] peptides = new SqlSelector(schema.getSchema(), sql, new Object[]{p.getProtein_cat_id()}).getArray(Peptides.class);
// GitHub Kanban #1929: parameterize the LIKE clause for the stored peptide_sequence
SQLFragment sql = new SQLFragment("select * from "+schema.getTableInfoPeptides()+" where peptides.protein_cat_id = ? ", p.getProtein_cat_id());
sql.append(" and peptides.peptide_sequence LIKE ? ");
sql.add("%" + schema.getSchema().getSqlDialect().encodeLikeOpSearchString(p.getPeptide_sequence()) + "%");
sql.append(" and child = false");
Peptides[] peptides = new SqlSelector(schema.getSchema(), sql).getArray(Peptides.class);
return peptides;
}

Expand Down
10 changes: 10 additions & 0 deletions pepdb/test/src/org/labkey/test/tests/pepdb/PepDBModuleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.labkey.test.TestTimeoutException;
import org.labkey.test.WebTestHelper;
import org.labkey.test.categories.CustomModules;
import org.labkey.test.util.DataRegionTable;
import org.labkey.test.util.LogMethod;
import org.labkey.test.util.PostgresOnlyTest;

Expand Down Expand Up @@ -180,6 +181,15 @@ public void testSteps() throws Exception

clickAndWait(Locator.css("a.labkey-button > span"));

// Verify peptide group detail page
clickAndWait(Locator.linkWithText("List Peptide Groups"));
clickAndWait(Locator.linkWithText("gagptegprac"));
assertTextPresentInThisOrder(
"Group Information from peptide_group table for group : gagptegprac",
"There are (16) peptides in the 'gagptegprac' peptide group."
);
DataRegionTable pepTable = new DataRegionTable("group_peptides", getDriver());
assertEquals("Peptide table for group does not have expected number of rows", 16, pepTable.getDataRowCount());

/*
*
Expand Down
Loading