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
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public ModelAndView getView(Object o, BindException errors)
return new HtmlView(DOM.DIV("Success!"));
}

warnings.add(0, DOM.DIV("Success, with warnings:"));
warnings.addFirst(DOM.DIV("Success, with warnings:"));
return new HtmlView(DOM.DIV(warnings.toArray(new Object[0])));
}
return new HtmlView(DOM.LK.FORM(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ public String update(Container container, User user)
}

// Only allow one thread to update at a time
LOG.info("Starting to update peptide counts for " + runIds);
LOG.info("Starting to update peptide counts for {}", runIds);
try (DbScope.Transaction transaction = MS2ExtensionsModule.getSchema().getScope().ensureTransaction(LOCK))
{
// Execute the query, filtering to just the runs that need aggregates calculated
SimpleFilter filter = new SimpleFilter(new SimpleFilter.InClause(ms2RunColumn.getFieldKey(), runIds));
Collection<Map<String, Object>> results = new TableSelector(table, Arrays.asList(ms2RunColumn, totalPeptidesColumn, distinctPeptidesColumn), filter, null).getMapCollection();

LOG.info("Inserting peptide counts for " + runIds);
LOG.info("Inserting peptide counts for {}", runIds);

// Iterate through the results and insert them into the table so they're cached and fast to show
for (Map<String, Object> result : results)
Expand All @@ -123,7 +123,7 @@ public String update(Container container, User user)
Table.insert(null, MS2ExtensionsModule.getSchema().getTable("Ms2RunAggregates"), toInsert);
}
transaction.commit();
LOG.info("Finished updating peptide counts for " + runIds);
LOG.info("Finished updating peptide counts for {}", runIds);
}
}
return null;
Expand Down
3 changes: 1 addition & 2 deletions pepdb/src/org/scharp/atlas/pepdb/PepDBBaseController.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.scharp.atlas.pepdb.model.ProteinCategory;
import org.springframework.validation.Errors;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -376,7 +375,7 @@ public void validate(Errors errors)
errors.reject(null, "Peptide Group Name is required.");
}

public void validateName(Errors errors) throws SQLException
public void validateName(Errors errors)
{
PeptideGroup bean = getBean();
PeptideGroup pg = PepDBManager.getPeptideGroupByName(bean);
Expand Down
53 changes: 0 additions & 53 deletions pepdb/src/org/scharp/atlas/pepdb/PepDBContainerListener.java

This file was deleted.

53 changes: 19 additions & 34 deletions pepdb/src/org/scharp/atlas/pepdb/PepDBController.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
Expand Down Expand Up @@ -223,7 +222,7 @@ public ModelAndView getView(DisplayPeptideForm form, BindException errors) throw
errors.reject(null, "Peptide Id not found in the database.");
return new JspView<>(PAGE_INDEX, form, errors);
}
_log.debug("DisplayPeptideForm: " + form);
_log.debug("DisplayPeptideForm: {}", form);
VBox box = new VBox();
PeptideQueryForm queryform = new PeptideQueryForm();
queryform.setQueryValue(pepId);
Expand Down Expand Up @@ -419,7 +418,7 @@ public class DisplayPeptideGroupInformationAction extends SimpleViewAction<Pepti
@Override
public ModelAndView getView(PeptideAndGroupForm form, BindException errors) throws Exception
{
_log.debug("PeptideAndGroupForm: " + form.toString());
_log.debug("PeptideAndGroupForm: {}", form.toString());
PeptideGroup pg = null;
try
{
Expand Down Expand Up @@ -503,7 +502,7 @@ public class DisplayPeptidePoolInformationAction extends SimpleViewAction<Peptid
@Override
public ModelAndView getView(PeptideAndPoolForm form, BindException errors) throws Exception
{
_log.debug("PeptideAndPoolForm: " + form.toString());
_log.debug("PeptideAndPoolForm: {}", form.toString());
PeptideQueryForm queryform = new PeptideQueryForm();
TableInfo tableInfo = PepDBSchema.getInstance().getTableInfoPeptidePools();
PropertyValues pv = this.getPropertyValues();
Expand Down Expand Up @@ -570,7 +569,7 @@ public ModelAndView getView(PeptideGroupForm form, boolean reshow, BindException
}

@Override
public boolean handlePost(PeptideGroupForm form, BindException errors) throws Exception
public boolean handlePost(PeptideGroupForm form, BindException errors)
{
PeptideGroup bean = form.getBean();
PeptideGroup dbBean = PepDBManager.getPeptideGroupByID(bean.getPeptide_group_id());
Expand All @@ -583,15 +582,8 @@ public boolean handlePost(PeptideGroupForm form, BindException errors) throws Ex
@Override
public void validateCommand(PeptideGroupForm form, Errors errors)
{
try
{
form.validate(errors);
form.validateName(errors);
}
catch (SQLException e)
{
errors.reject(null, "There's something wrong with database when trying to get all the existing groups.");
}
form.validate(errors);
form.validateName(errors);
}

@Override
Expand Down Expand Up @@ -632,7 +624,7 @@ public ModelAndView getView(PeptideGroupForm form, boolean reshow, BindException
}

@Override
public boolean handlePost(PeptideGroupForm form, BindException errors) throws Exception
public boolean handlePost(PeptideGroupForm form, BindException errors)
{
PeptideGroup group = form.getBean();
group = PepDBManager.insertGroup(getContainer(), getUser(), group);
Expand All @@ -644,15 +636,8 @@ public boolean handlePost(PeptideGroupForm form, BindException errors) throws Ex
@Override
public void validateCommand(PeptideGroupForm form, Errors errors)
{
try
{
form.validate(errors);
form.validateName(errors);
}
catch (SQLException e)
{
errors.reject(null, "There's something wrong with database when trying to get all the existing groups.");
}
form.validate(errors);
form.validateName(errors);
}

@Override
Expand Down Expand Up @@ -867,7 +852,7 @@ public void export(Object bean, HttpServletResponse response, BindException erro
ViewContext ctx = getViewContext();
HttpSession session = ctx.getRequest().getSession();
PeptideQueryForm form = (PeptideQueryForm) session.getAttribute("PEPTIDE_QUERY_FORM");
_log.info("Form " + form.getMessage() + " had filter : " + form.getFilter());
_log.info("Form {} had filter : {}", form.getMessage(), form.getFilter());
printExcel(form);
}
}
Expand Down Expand Up @@ -963,7 +948,7 @@ protected GridView getGridViewByGroup(PeptideQueryForm form, PropertyValues pv)
TableInfo tableInfo = PepDBSchema.getInstance()
.getTableInfoViewGroupPeptides();
form.setTInfo(tableInfo);
_log.debug("Creating a Filter for peptideGroup." + PepDBSchema.COLUMN_PEPTIDE_GROUP_ID + ": " + form);
_log.debug("Creating a Filter for peptideGroup." + PepDBSchema.COLUMN_PEPTIDE_GROUP_ID + ": {}", form);
SimpleFilter sFilter = new SimpleFilter(FieldKey.fromParts(PepDBSchema.COLUMN_PEPTIDE_GROUP_ID), Integer.parseInt(form.getQueryValue()));
if (form.getLabId() != null)
sFilter.addCondition(FieldKey.fromParts(PepDBSchema.COLUMN_PEPTIDE_ID_IN_GROUP), form.getLabId());
Expand Down Expand Up @@ -995,7 +980,7 @@ protected GridView getGridViewByPool(PeptideQueryForm form, PropertyValues pv) t
TableInfo tableInfo = PepDBSchema.getInstance()
.getTableInfoViewPoolPeptides();
form.setTInfo(tableInfo);
_log.debug("Creating a Filter for peptidePool." + PepDBSchema.COLUMN_PEPTIDE_POOL_ID + ": " + form);
_log.debug("Creating a Filter for peptidePool." + PepDBSchema.COLUMN_PEPTIDE_POOL_ID + ": {}", form);
SimpleFilter sFilter = new SimpleFilter(FieldKey.fromParts(PepDBSchema.COLUMN_PEPTIDE_POOL_ID), Integer.parseInt(form.getQueryValue()));
Sort sort = new Sort(PepDBSchema.COLUMN_PEPTIDE_ID);
form.setFilter(sFilter);
Expand All @@ -1020,7 +1005,7 @@ protected GridView getGridViewByParentPool(PeptideQueryForm form, PropertyValues
TableInfo tableInfo = PepDBSchema.getInstance()
.getTableInfoViewPoolDetails();
form.setTInfo(tableInfo);
_log.debug("Creating a Filter for parent peptidePool." + PepDBSchema.COLUMN_PARENT_POOL_ID + ": " + form);
_log.debug("Creating a Filter for parent peptidePool." + PepDBSchema.COLUMN_PARENT_POOL_ID + ": {}", form);
SimpleFilter sFilter = new SimpleFilter(FieldKey.fromParts(PepDBSchema.COLUMN_PARENT_POOL_ID), Integer.parseInt(form.getQueryValue()));
Sort sort = new Sort(PepDBSchema.COLUMN_PEPTIDE_POOL_ID);
form.setFilter(sFilter);
Expand All @@ -1042,7 +1027,7 @@ protected GridView getGridViewBySequence(PeptideQueryForm form, PropertyValues p
TableInfo tableInfo = PepDBSchema.getInstance()
.getTableInfoViewGroupPeptides();
form.setTInfo(tableInfo);
_log.debug("Creating a Filter for peptideSequence." + PepDBSchema.COLUMN_PEPTIDE_SEQUENCE + ": " + form);
_log.debug("Creating a Filter for peptideSequence." + PepDBSchema.COLUMN_PEPTIDE_SEQUENCE + ": {}", form);
SimpleFilter sFilter = new SimpleFilter();

boolean sequenceIsEmpty = true;
Expand Down Expand Up @@ -1093,7 +1078,7 @@ protected GridView getGridViewByProtein(PeptideQueryForm form, PropertyValues pv
.getTableInfoViewGroupPeptides();
form.setTInfo(tableInfo);
String title = "Peptides in Protein Category " + pc.getProtein_cat_desc();
_log.debug("Creating a Filter for proteinCategory." + PepDBSchema.COLUMN_PROTEIN_CAT_ID + ": " + form);
_log.debug("Creating a Filter for proteinCategory." + PepDBSchema.COLUMN_PROTEIN_CAT_ID + ": {}", form);
SimpleFilter sFilter = new SimpleFilter(FieldKey.fromParts(PepDBSchema.COLUMN_PROTEIN_CAT_ID), Integer.parseInt(form.getQueryValue()));
if (form.getAAEnd() == null && form.getAAStart() != null)
{
Expand Down Expand Up @@ -1131,7 +1116,7 @@ protected GridView getGridViewByParentId(PeptideQueryForm form, PropertyValues p
TableInfo tableInfo = PepDBSchema.getInstance()
.getTableInfoViewParentChildDetails();
form.setTInfo(tableInfo);
_log.debug("Creating a Filter for parentID. : " + form);
_log.debug("Creating a Filter for parentID. : {}", form);
SimpleFilter sFilter = new SimpleFilter(FieldKey.fromParts(PepDBSchema.COLUMN_PARENT_ID), Integer.parseInt(form.getQueryValue()));
Sort sort = new Sort(PepDBSchema.COLUMN_CHILD_ID);
form.setFilter(sFilter);
Expand All @@ -1154,7 +1139,7 @@ protected GridView getGridViewByParent(PeptideQueryForm form, PropertyValues pv)
TableInfo tableInfo = PepDBSchema.getInstance()
.getTableInfoViewParentChildDetails();
form.setTInfo(tableInfo);
_log.debug("Creating a Filter for parentSequence. : " + form);
_log.debug("Creating a Filter for parentSequence. : {}", form);
SimpleFilter sFilter = new SimpleFilter(FieldKey.fromParts(PepDBSchema.COLUMN_PARENT_SEQUENCE), form.getQueryValue().trim().toUpperCase());
Sort sort = new Sort(PepDBSchema.COLUMN_CHILD_ID);
form.setFilter(sFilter);
Expand All @@ -1177,7 +1162,7 @@ protected GridView getGridViewByChildId(PeptideQueryForm form, PropertyValues pv
TableInfo tableInfo = PepDBSchema.getInstance()
.getTableInfoViewParentChildDetails();
form.setTInfo(tableInfo);
_log.debug("Creating a Filter for childID. : " + form);
_log.debug("Creating a Filter for childID. : {}", form);
SimpleFilter sFilter = new SimpleFilter(FieldKey.fromParts(PepDBSchema.COLUMN_CHILD_ID), Integer.parseInt(form.getQueryValue()));
Sort sort = new Sort(PepDBSchema.COLUMN_PARENT_ID);
form.setFilter(sFilter);
Expand All @@ -1200,7 +1185,7 @@ protected GridView getGridViewByChild(PeptideQueryForm form, PropertyValues pv)
TableInfo tableInfo = PepDBSchema.getInstance()
.getTableInfoViewParentChildDetails();
form.setTInfo(tableInfo);
_log.debug("Creating a Filter for childID. : " + form);
_log.debug("Creating a Filter for childID. : {}", form);
SimpleFilter sFilter = new SimpleFilter(FieldKey.fromParts(PepDBSchema.COLUMN_CHILD_SEQUENCE), form.getQueryValue().trim().toUpperCase());
Sort sort = new Sort(PepDBSchema.COLUMN_PARENT_ID);
form.setFilter(sFilter);
Expand Down
9 changes: 4 additions & 5 deletions pepdb/src/org/scharp/atlas/pepdb/PepDBManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.scharp.atlas.pepdb.model.ProteinCategory;
import org.scharp.atlas.pepdb.model.Source;

import java.sql.SQLException;
import java.util.HashMap;

/**
Expand Down Expand Up @@ -203,13 +202,13 @@ public static PeptidePool[] getPoolsForPeptide(String peptideId)
return pools;
}

public static PeptideGroup insertGroup(Container c, User user, PeptideGroup pg) throws SQLException
public static PeptideGroup insertGroup(Container c, User user, PeptideGroup pg)
{
PeptideGroup resultGroup = Table.insert(user, PepDBSchema.getInstance().getTableInfoPeptideGroups(), pg);
return resultGroup;
}

public static PeptideGroup updatePeptideGroup(User user,PeptideGroup pg) throws SQLException
public static PeptideGroup updatePeptideGroup(User user,PeptideGroup pg)
{
return Table.update(user, PepDBSchema.getInstance().getTableInfoPeptideGroups(),pg,pg.getPeptide_group_id());
}
Expand Down Expand Up @@ -284,7 +283,7 @@ public static Peptides getPeptideById(Integer peptideId)
return new TableSelector(tInfo, sFilter, null).getObject(Peptides.class);
}

public static Peptides[] getParentPeptides(Peptides p) throws SQLException
public static Peptides[] getParentPeptides(Peptides p)
{
TableInfo tInfo = schema.getTableInfoPeptides();
String sql = "select * from pepdb.peptides where peptides.protein_cat_id = ? and ? between peptides.amino_acid_start_pos-2 and peptides.amino_acid_end_pos\n" +
Expand All @@ -293,7 +292,7 @@ public static Peptides[] getParentPeptides(Peptides p) throws SQLException
return peptides;
}

public static Peptides[] getHyphanatedParents(Peptides p) throws SQLException
public static Peptides[] getHyphanatedParents(Peptides p)
{
String sql = "select * from "+schema.getTableInfoPeptides()+" where peptides.protein_cat_id = ? " +
" and peptides.peptide_sequence LIKE '%"+p.getPeptide_sequence()+"%' " +
Expand Down
3 changes: 0 additions & 3 deletions pepdb/src/org/scharp/atlas/pepdb/PepDBModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.labkey.api.data.ContainerManager;
import org.labkey.api.data.DbSchema;
import org.labkey.api.module.DefaultModule;
import org.labkey.api.module.ModuleContext;
Expand Down Expand Up @@ -72,8 +71,6 @@ public boolean hasScripts()
@Override
public void doStartup(ModuleContext moduleContext)
{
// add a container listener so we'll know when our container is deleted:
ContainerManager.addContainerListener(new PepDBContainerListener());
}
@Override
@NotNull
Expand Down
Loading
Loading