diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/Dict.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/Dict.java index 47340357f3a1f3c350bb5a90e869687565eda2e0..c83f36f775a42a4f16b91341b31d4cb1f8d9174c 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/Dict.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/Dict.java @@ -59,6 +59,8 @@ public class Dict public static final String DATABASE_NAME_AND_VERSION = "database_name_and_version"; + public static final String INDISTINGUISHABLE_PROTEINS = "indistinguishable_proteins"; + public static final String SEQUENCE = "sequence"; public static final String SEQUENCES = "sequences"; @@ -80,7 +82,6 @@ public class Dict // Protein Detail View public static final String PROBABILITY = "protein_probability"; - // SampleAbundance Browser public static final String ABUNDANCE = "abundance"; @@ -95,4 +96,5 @@ public class Dict public static final String COPY_DATA_SETS_MESSAGE = "copy_data_sets_message"; public static final String COPY_DATA_SETS_DATA_SET_TYPE_FIELD = "copy_data_sets_data_set_type_field"; + } diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ExperimentViewer.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ExperimentViewer.java index 4887d4eac8da65205242412cb3f1a5ade7512b8a..f109ad81097b84692b8fc508f7e4bc4199e02dee 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ExperimentViewer.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ExperimentViewer.java @@ -67,7 +67,7 @@ public class ExperimentViewer extends GenericExperimentViewer protected IDisposableComponent createDisposableContent() { return ProteinByExperimentBrowserGrid.create(specificViewContext, - experimentType, experimentId); + experimentType, experiment); } }; section.setDisplayID(DisplayTypeIDGenerator.PROTEIN_SECTION, displyIdSuffix); diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinByExperimentBrowerToolBar.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinByExperimentBrowerToolBar.java index 5f23d58d878368ccd59e012148e0479df81b7262..ce797587fc45d81c521ddce2c6d8ded3ed7815a4 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinByExperimentBrowerToolBar.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinByExperimentBrowerToolBar.java @@ -38,8 +38,8 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.NonH import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.VocabularyTermModel; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.field.VocabularyTermSelectionWidget; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.IDataRefreshCallback; -import ch.systemsx.cisd.openbis.generic.shared.basic.IIdAndCodeHolder; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTerm; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.IPhosphoNetXClientServiceAsync; @@ -160,15 +160,15 @@ class ProteinByExperimentBrowerToolBar extends ToolBar private ProteinByExperimentBrowserGrid browserGrid; - private IIdAndCodeHolder experimentId; + private Experiment experiment; private ProteinSummaryGrid summaryGrid; ProteinByExperimentBrowerToolBar(IViewContext<IPhosphoNetXClientServiceAsync> viewContext, - IIdAndCodeHolder experimentId) + Experiment experiment) { this.viewContext = viewContext; - this.experimentId = experimentId; + this.experiment = experiment; setBorders(true); // WORKAROUND to get all elements in the toolbar present independent of the original width // of the parent @@ -275,9 +275,9 @@ class ProteinByExperimentBrowerToolBar extends ToolBar return comboBox; } - IIdAndCodeHolder getExperimentOrNull() + Experiment getExperimentOrNull() { - return experimentId; + return experiment; } void setBrowserGrid(ProteinByExperimentBrowserGrid browserGrid) @@ -292,9 +292,9 @@ class ProteinByExperimentBrowerToolBar extends ToolBar void update() { - if (experimentId != null) + if (experiment != null) { - final TechId experimentID = TechId.create(experimentId); + final TechId experimentID = TechId.create(experiment); browserGrid.setLoadMaskImmediately(true); browserGrid.setPostRefreshCallback(new IDataRefreshCallback() { diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinByExperimentBrowserGrid.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinByExperimentBrowserGrid.java index 493f87cd26dc7f4e12f157667ad8d5d97d585387..476656598a243b089d820b8bf5779d71ed4927c2 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinByExperimentBrowserGrid.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinByExperimentBrowserGrid.java @@ -51,10 +51,10 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ResultSet; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TableExportCriteria; import ch.systemsx.cisd.openbis.generic.shared.basic.GridRowModel; import ch.systemsx.cisd.openbis.generic.shared.basic.IColumnDefinition; -import ch.systemsx.cisd.openbis.generic.shared.basic.IIdAndCodeHolder; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.BasicEntityType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.ObjectKind; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.IPhosphoNetXClientServiceAsync; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.columns.InternalAbundanceColumnDefinition; @@ -97,11 +97,11 @@ class ProteinByExperimentBrowserGrid extends AbstractSimpleBrowserGrid<ProteinIn static IDisposableComponent create( final IViewContext<IPhosphoNetXClientServiceAsync> viewContext, - BasicEntityType experimentType, IIdAndCodeHolder experimentId) + BasicEntityType experimentType, Experiment experiment) { final IDisposableComponent summaryGrid = ProteinSummaryGrid.create(viewContext); ProteinByExperimentBrowserGrid browserGrid = - new ProteinByExperimentBrowserGrid(viewContext, experimentId); + new ProteinByExperimentBrowserGrid(viewContext, experiment); final IDisposableComponent disposableBrowerGrid = browserGrid.asDisposableWithoutToolbar(); final ProteinByExperimentBrowerToolBar toolBar = browserGrid.toolbar; toolBar.setSummaryGrid((ProteinSummaryGrid) summaryGrid.getComponent()); @@ -152,12 +152,12 @@ class ProteinByExperimentBrowserGrid extends AbstractSimpleBrowserGrid<ProteinIn private ProteinByExperimentBrowserGrid( final IViewContext<IPhosphoNetXClientServiceAsync> viewContext, - IIdAndCodeHolder experimentId) + Experiment experiment) { super(viewContext.getCommonViewContext(), BROWSER_ID, GRID_ID, false, PhosphoNetXDisplayTypeIDGenerator.PROTEIN_BY_EXPERIMENT_BROWSER_GRID); specificViewContext = viewContext; - toolbar = new ProteinByExperimentBrowerToolBar(viewContext, experimentId); + toolbar = new ProteinByExperimentBrowerToolBar(viewContext, experiment); toolbar.setBrowserGrid(this); registerLinkClickListenerFor(ProteinColDefKind.ACCESSION_NUMBER.id(), new ICellListener<ProteinInfo>() @@ -208,9 +208,9 @@ class ProteinByExperimentBrowserGrid extends AbstractSimpleBrowserGrid<ProteinIn for (AbundanceColumnDefinition definition : abundanceColumnDefinitions) { String header = definition.getSampleCode(); - final long sampleID = definition.getID(); - List<Treatment> treatments = definition.getTreatments(); Map<String, String> properties = new HashMap<String, String>(); + properties.put(ABUNDANCE_PROPERTY_KEY, header); + List<Treatment> treatments = definition.getTreatments(); if (treatments.isEmpty() == false) { header = ""; @@ -221,10 +221,8 @@ class ProteinByExperimentBrowserGrid extends AbstractSimpleBrowserGrid<ProteinIn delim = ", "; properties.put(treatment.getTypeCode(), treatment.getValue()); } - } else - { - properties.put(ABUNDANCE_PROPERTY_KEY, header); } + final long sampleID = definition.getID(); IColumnDefinitionUI<ProteinInfo> columnDefinition = new InternalAbundanceColumnDefinition(header, properties, 100, false, sampleID); abundanceColumnIDs.add(columnDefinition.getIdentifier()); diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinViewer.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinViewer.java index 991b92750f6c9a0ea4ad0a90dda1d7b17b3243d1..a3ad1d695744cd9786cb857fee5811d03a1b4fd7 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinViewer.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinViewer.java @@ -24,9 +24,16 @@ import java.util.Set; import com.extjs.gxt.ui.client.Style.LayoutRegion; import com.extjs.gxt.ui.client.Style.Scroll; +import com.extjs.gxt.ui.client.util.Margins; import com.extjs.gxt.ui.client.widget.ContentPanel; +import com.extjs.gxt.ui.client.widget.LayoutContainer; +import com.extjs.gxt.ui.client.widget.TabItem; +import com.extjs.gxt.ui.client.widget.TabPanel; import com.extjs.gxt.ui.client.widget.layout.BorderLayout; import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData; +import com.extjs.gxt.ui.client.widget.layout.FitLayout; +import com.extjs.gxt.ui.client.widget.layout.RowData; +import com.extjs.gxt.ui.client.widget.layout.RowLayout; import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback; import ch.systemsx.cisd.openbis.generic.client.web.client.application.DisposableSectionPanel; @@ -53,6 +60,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.IPhosphoNetXClientServiceAsync; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.IndistinguishableProteinInfo; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.Peptide; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinByExperiment; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinDetails; @@ -64,7 +72,7 @@ import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinInfo; public class ProteinViewer extends AbstractViewer<IEntityInformationHolder> implements IDatabaseModificationObserver { - private static final int AMINOACIDS_IN_SEQUENCE_PER_LINE = 60; + private static final int AMINOACIDS_IN_SEQUENCE_PER_LINE = 90; private static final int AMINOACIDS_IN_ONE_BLOCK = 10; @@ -74,25 +82,25 @@ public class ProteinViewer extends AbstractViewer<IEntityInformationHolder> impl static AbstractTabItemFactory createTabItemFactory( final IViewContext<IPhosphoNetXClientServiceAsync> viewContext, - final IIdAndCodeHolder experimentId, final ProteinInfo proteinInfo) + final Experiment experiment, final ProteinInfo proteinInfo) { return new AbstractTabItemFactory() { @Override public String getId() { - return createWidgetID(experimentId, proteinInfo.getId()); + return createWidgetID(experiment, proteinInfo.getId()); } @Override public ITabItem create() { ProteinViewer viewer = - new ProteinViewer(viewContext, experimentId, proteinInfo.getId()); + new ProteinViewer(viewContext, experiment, proteinInfo.getId()); DatabaseModificationAwareComponent c = new DatabaseModificationAwareComponent(viewer, viewer); String description = getAbbreviatedDescription(proteinInfo); - String identifier = experimentId == null ? "?" : experimentId.getCode(); + String identifier = experiment == null ? "?" : experiment.getCode(); return DefaultTabItem.create(viewContext.getMessage( Dict.PROTEIN_IN_EXPERIMENT_TAB_LABEL, description, identifier), c, viewContext, false); @@ -124,27 +132,27 @@ public class ProteinViewer extends AbstractViewer<IEntityInformationHolder> impl private final IViewContext<IPhosphoNetXClientServiceAsync> viewContext; - private final IIdAndCodeHolder experimentIdOrNull; + private final Experiment experimentOrNull; private final TechId proteinReferenceID; private ProteinSamplesSection proteinSamplesSection; private ProteinViewer(IViewContext<IPhosphoNetXClientServiceAsync> viewContext, - IIdAndCodeHolder experimentId, TechId proteinReferenceID) + Experiment experiment, TechId proteinReferenceID) { - super(viewContext, "", createWidgetID(experimentId, proteinReferenceID), false); + super(viewContext, "", createWidgetID(experiment, proteinReferenceID), false); this.viewContext = viewContext; - this.experimentIdOrNull = experimentId; + this.experimentOrNull = experiment; this.proteinReferenceID = proteinReferenceID; reloadAllData(); } private void reloadAllData() { - if (experimentIdOrNull != null) + if (experimentOrNull != null) { - viewContext.getService().getProteinByExperiment(new TechId(experimentIdOrNull.getId()), + viewContext.getService().getProteinByExperiment(new TechId(experimentOrNull.getId()), proteinReferenceID, new ProteinByExperimentCallback(viewContext, this)); } } @@ -156,18 +164,74 @@ public class ProteinViewer extends AbstractViewer<IEntityInformationHolder> impl setScrollMode(Scroll.AUTO); ContentPanel propertyPanel = createPropertyPanel(protein); - if (protein.getDetails() == null) + ProteinDetails details = protein.getDetails(); + if (details == null) { recreateUIWithDatasetTable(protein, propertyPanel); } else { - add(propertyPanel, createBorderLayoutData(LayoutRegion.CENTER)); + List<IndistinguishableProteinInfo> indistinguishableProteins = + details.getIndistinguishableProteinInfos(); + LayoutContainer southPanel = new LayoutContainer(); + RowLayoutManager rowDataManager = new RowLayoutManager(southPanel, new RowLayout()); + add(southPanel, bld(LayoutRegion.CENTER)); + rowDataManager.addToContainer(propertyPanel, new RowData(1, 0.5f)); + if (indistinguishableProteins.isEmpty() == false) + { + List<Peptide> peptides = details.getPeptides(); + ContentPanel panel = + createIndistinguishableProteinsSection(indistinguishableProteins, peptides); + rowDataManager.addToContainer(panel, new RowData(1, 0.3f)); + } proteinSamplesSection = - new ProteinSamplesSection(viewContext, proteinReferenceID, experimentIdOrNull); - add(proteinSamplesSection, createBorderLayoutData(LayoutRegion.SOUTH)); + new ProteinSamplesSection(viewContext, proteinReferenceID, experimentOrNull); + rowDataManager.addToContainer(proteinSamplesSection, new RowData(1, 0.2f)); layout(); } } + + private ContentPanel createIndistinguishableProteinsSection( + List<IndistinguishableProteinInfo> indistinguishableProteins, List<Peptide> peptides) + { + ContentPanel panel = new ContentPanel(new RowLayout()); + panel.setHeading(viewContext.getMessage(Dict.INDISTINGUISHABLE_PROTEINS)); + panel.setCollapsible(true); + panel.setHeight("100%"); + TabPanel tabPanel = new TabPanel(); + tabPanel.setTabScroll(true); + for (IndistinguishableProteinInfo info : indistinguishableProteins) + { + String accessionNumber = info.getAccessionNumber(); + TabItem item = new TabItem(accessionNumber); + item.setLayout(new FitLayout()); + PropertyGrid propertyGrid = new PropertyGrid(viewContext, 3); + final Map<String, Object> properties = new LinkedHashMap<String, Object>(); + properties.put(viewContext.getMessage(Dict.ACCESSION_NUMBER), accessionNumber); + properties.put(viewContext.getMessage(Dict.PROTEIN_DESCRIPTION), info + .getDescription()); + String markedSequence = markPeptides(info.getSequence(), peptides); + properties.put(viewContext.getMessage(Dict.SEQUENCE_NAME), markedSequence); + propertyGrid.setProperties(properties); + ContentPanel contentPanel = new ContentPanel(); + contentPanel.setHeight("100%"); + contentPanel.setScrollMode(Scroll.AUTO); + contentPanel.add(propertyGrid); + item.add(contentPanel); + tabPanel.add(item); + } + + panel.add(tabPanel, new RowData(1, 1)); + return panel; + } + + private BorderLayoutData bld(LayoutRegion region) + { + BorderLayoutData data = new BorderLayoutData(region); + data.setSplit(true); + data.setCollapsible(true); + data.setMargins(new Margins(2)); + return data; + } private void recreateUIWithDatasetTable(ProteinByExperiment protein, ContentPanel propertyPanel) { @@ -193,7 +257,7 @@ public class ProteinViewer extends AbstractViewer<IEntityInformationHolder> impl protected IDisposableComponent createDisposableContent() { return DataSetProteinGrid.create(ProteinViewer.this.viewContext, - experimentIdOrNull, proteinReferenceID); + experimentOrNull, proteinReferenceID); } }; add(proteinsSection, createBorderLayoutData(LayoutRegion.SOUTH)); @@ -205,6 +269,7 @@ public class ProteinViewer extends AbstractViewer<IEntityInformationHolder> impl PropertyGrid propertyGrid = createPropertyGrid(protein); ContentPanel contentPanel = new ContentPanel(); contentPanel.setScrollMode(Scroll.AUTO); + contentPanel.setCollapsible(true); contentPanel.add(propertyGrid); return contentPanel; } @@ -213,9 +278,9 @@ public class ProteinViewer extends AbstractViewer<IEntityInformationHolder> impl { final Map<String, Object> properties = new LinkedHashMap<String, Object>(); PropertyGrid propertyGrid = new PropertyGrid(viewContext, 0); - if (experimentIdOrNull != null) + if (experimentOrNull != null) { - properties.put(viewContext.getMessage(Dict.EXPERIMENT_LABEL), experimentIdOrNull); + properties.put(viewContext.getMessage(Dict.EXPERIMENT_LABEL), experimentOrNull); propertyGrid.registerPropertyValueRenderer(Experiment.class, PropertyValueRenderers .createExperimentPropertyValueRenderer(viewContext)); } diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/RowLayoutManager.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/RowLayoutManager.java new file mode 100644 index 0000000000000000000000000000000000000000..13f9ecc831068887ab94d357ec0b9e83eb4a5d7e --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/RowLayoutManager.java @@ -0,0 +1,164 @@ +/* + * Copyright 2010 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application; + +import java.util.ArrayList; +import java.util.List; + +import com.extjs.gxt.ui.client.Style.Orientation; +import com.extjs.gxt.ui.client.event.BaseEvent; +import com.extjs.gxt.ui.client.event.Events; +import com.extjs.gxt.ui.client.event.Listener; +import com.extjs.gxt.ui.client.widget.ContentPanel; +import com.extjs.gxt.ui.client.widget.LayoutContainer; +import com.extjs.gxt.ui.client.widget.layout.RowData; +import com.extjs.gxt.ui.client.widget.layout.RowLayout; + +/** + * Helper class for doing {@link RowLayout} of a {@link LayoutContainer} with instances of + * {@link ContentPanel} in a dynamic way. Collapsed row components lead to a resize of the + * non-collapsed components if the row size is defined by a positive value <= 1. + * + * @author Franz-Josef Elmer + */ +public class RowLayoutManager +{ + private static interface IManipulator + { + double getFor(RowData rowData); + void setFor(RowData rowData, double newValue); + int getFrameSizeFor(ContentPanel panel); + } + + private static final class DynamicRowData + { + private RowData rowData; + private double originalValue; + private ContentPanel panel; + } + + private static final IManipulator HEIGHT_MANIPULATOR = new IManipulator() + { + public void setFor(RowData rowData, double newValue) + { + rowData.setHeight(newValue); + } + + public double getFor(RowData rowData) + { + return rowData.getHeight(); + } + + public int getFrameSizeFor(ContentPanel panel) + { + return panel.isRendered() ? panel.getFrameHeight() : 0; + } + }; + + private static final IManipulator WIDTH_MANIPULATOR = new IManipulator() + { + public void setFor(RowData rowData, double newValue) + { + rowData.setWidth(newValue); + } + + public double getFor(RowData rowData) + { + return rowData.getWidth(); + } + + public int getFrameSizeFor(ContentPanel panel) + { + return panel.isRendered() ? panel.getFrameWidth() : 0; + } + }; + + private final LayoutContainer container; + private final IManipulator manipulator; + private final List<DynamicRowData> dynamicRowDatas = new ArrayList<DynamicRowData>(); + + /** + * Creates an instance for the specified container and apply the specified layout. + */ + public RowLayoutManager(LayoutContainer container, RowLayout rowLayout) + { + this.container = container; + container.setLayout(rowLayout); + Orientation orientation = rowLayout.getOrientation(); + if (orientation.equals(Orientation.VERTICAL)) + { + manipulator = HEIGHT_MANIPULATOR; + } else + { + manipulator = WIDTH_MANIPULATOR; + } + } + + /** + * Adds the specified panel to the container in accordance to the specified row data. + */ + public void addToContainer(ContentPanel contentPanel, RowData rowData) + { + container.add(contentPanel, rowData); + double value = manipulator.getFor(rowData); + if (value < 0 || value > 1) + { + return; + } + DynamicRowData dynamicRowData = new DynamicRowData(); + dynamicRowData.rowData = rowData; + dynamicRowData.originalValue = value; + dynamicRowData.panel = contentPanel; + dynamicRowDatas.add(dynamicRowData); + adjustRelative(); + Listener<BaseEvent> listener = new Listener<BaseEvent>() + { + public void handleEvent(BaseEvent event) + { + adjustRelative(); + } + }; + contentPanel.addListener(Events.Collapse, listener); + contentPanel.addListener(Events.Expand, listener); + } + + private void adjustRelative() + { + double sum = 0; + for (DynamicRowData data : dynamicRowDatas) + { + if (data.panel.isCollapsed() == false) + { + sum += data.originalValue; + } + } + for (DynamicRowData data : dynamicRowDatas) + { + double value; + if (data.panel.isCollapsed()) + { + value = manipulator.getFrameSizeFor(data.panel); + } + else + { + value = data.originalValue / sum; + } + manipulator.setFor(data.rowData, value); + } + container.layout(true); + } +} \ No newline at end of file diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/public/phosphonetx-dictionary.js b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/public/phosphonetx-dictionary.js index 6c538ee56e1a005b2fc889cc99b754d629e93da0..53eceb32476282ecc6e284a6f717f99070e78b2f 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/public/phosphonetx-dictionary.js +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/public/phosphonetx-dictionary.js @@ -22,6 +22,7 @@ var phosphonetx = { protein_browser: "Proteins", protein_summary: "Protein/Peptide Counts", database_name_and_version: "Database", + indistinguishable_proteins: "Indistinguishable Proteins", sequence: "Amino Acid Sequence", sequences: "Amino Acid Sequences", data_set_proteins: "Data Sets", diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/ProteinDetailsBO.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/ProteinDetailsBO.java index 53f16b3c145087bd2fe4fd61ae98e34e897c4f19..de7baf49b7269e728bbfebe10ec832764b9dbb53 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/ProteinDetailsBO.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/ProteinDetailsBO.java @@ -28,10 +28,12 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE; import ch.systemsx.cisd.openbis.generic.shared.dto.Session; import ch.systemsx.cisd.openbis.plugin.phosphonetx.server.dataaccess.IPhosphoNetXDAOFactory; import ch.systemsx.cisd.openbis.plugin.phosphonetx.server.dataaccess.IProteinQueryDAO; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.IndistinguishableProteinInfo; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.Peptide; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinDetails; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.IdentifiedPeptide; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.IdentifiedProtein; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.IndistinguishableProtein; /** * @author Franz-Josef Elmer @@ -79,29 +81,60 @@ class ProteinDetailsBO extends AbstractBusinessObject implements IProteinDetails details.setDataSetTypeCode(ds.getDataSetType().getCode()); } details.setPeptides(loadPeptides(protein)); - details.setProteinID(new TechId(protein.getProteinID())); + long proteinID = protein.getProteinID(); + details.setProteinID(new TechId(proteinID)); + details.setIndistinguishableProteinInfos(loadIndistinguishableProteinInfos(proteinID)); } } finally { proteins.close(); } } + + private List<IndistinguishableProteinInfo> loadIndistinguishableProteinInfos(long proteinID) + { + IProteinQueryDAO proteinQueryDAO = getSpecificDAOFactory().getProteinQueryDAO(); + DataSet<IndistinguishableProtein> proteins = + proteinQueryDAO.listIndistinguishableProteinsByProteinID(proteinID); + try + { + List<IndistinguishableProteinInfo> infos = + new ArrayList<IndistinguishableProteinInfo>(); + for (IndistinguishableProtein protein : proteins) + { + IndistinguishableProteinInfo info = new IndistinguishableProteinInfo(); + info.setAccessionNumber(protein.getAccessionNumber()); + info.setDescription(protein.getDescription()); + info.setSequence(protein.getSequence()); + infos.add(info); + } + return infos; + } finally + { + proteins.close(); + } + } private List<Peptide> loadPeptides(IdentifiedProtein protein) { IProteinQueryDAO proteinQueryDAO = getSpecificDAOFactory().getProteinQueryDAO(); DataSet<IdentifiedPeptide> identifiedPeptides = proteinQueryDAO.listIdentifiedPeptidesByProtein(protein.getProteinID()); - List<Peptide> peptides = new ArrayList<Peptide>(); - for (IdentifiedPeptide identifiedPeptide : identifiedPeptides) + try + { + List<Peptide> peptides = new ArrayList<Peptide>(); + for (IdentifiedPeptide identifiedPeptide : identifiedPeptides) + { + Peptide peptide = new Peptide(); + peptide.setSequence(identifiedPeptide.getSequence()); + peptide.setCharge(identifiedPeptide.getCharge()); + peptides.add(peptide); + } + return peptides; + } finally { - Peptide peptide = new Peptide(); - peptide.setSequence(identifiedPeptide.getSequence()); - peptide.setCharge(identifiedPeptide.getCharge()); - peptides.add(peptide); + identifiedPeptides.close(); } - identifiedPeptides.close(); - return peptides; } private String getExperimentPermIDFor(TechId experimentId) diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/dataaccess/IProteinQueryDAO.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/dataaccess/IProteinQueryDAO.java index 4b87704e51cea73a5d1a43b12c335531cc8de11c..2888433b7adb6ca0addab2fc34fe4c5db3bc2b63 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/dataaccess/IProteinQueryDAO.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/dataaccess/IProteinQueryDAO.java @@ -25,6 +25,7 @@ import net.lemnik.eodsql.Select; import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.LongSetMapper; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.IdentifiedPeptide; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.IdentifiedProtein; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.IndistinguishableProtein; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProbabilityFDRMapping; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinAbundance; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReference; @@ -98,10 +99,16 @@ public interface IProteinQueryDAO extends BaseQuery + " amino_acid_sequence, s.db_id, name_and_version order by data_set_perm_id") public DataSet<IdentifiedProtein> listProteinsByProteinReferenceAndExperiment( String experimentPermID, long proteinReferenceID); - + @Select("select * from peptides where prot_id = ?{1}") public DataSet<IdentifiedPeptide> listIdentifiedPeptidesByProtein(long proteinID); + @Select("select accession_number, description, amino_acid_sequence " + + "from identified_proteins as ip join sequences as s on ip.sequ_id = s.id " + + " join protein_references as pr on s.prre_id = pr.id " + + "where ip.prot_id = ?{1} and ip.is_primary = 'f'") + public DataSet<IndistinguishableProtein> listIndistinguishableProteinsByProteinID(long proteinID); + @Select("select distinct a.id, samples.perm_id, value " + "from abundances as a left join proteins as p on a.prot_id = p.id " + " left join data_sets as d on p.dase_id = d.id " diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/basic/dto/IndistinguishableProteinInfo.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/basic/dto/IndistinguishableProteinInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..7098559d0b258ed06065e47ce8b219f388234e66 --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/basic/dto/IndistinguishableProteinInfo.java @@ -0,0 +1,69 @@ +/* + * Copyright 2010 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto; + +import java.io.Serializable; + +import com.google.gwt.user.client.rpc.IsSerializable; + +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder; + +/** + * + * + * @author Franz-Josef Elmer + */ +public class IndistinguishableProteinInfo implements IsSerializable, Serializable +{ + private static final long serialVersionUID = ServiceVersionHolder.VERSION; + + private String sequence; + + private String accessionNumber; + + private String description; + + public final String getSequence() + { + return sequence; + } + + public final void setSequence(String sequence) + { + this.sequence = sequence; + } + + public final String getAccessionNumber() + { + return accessionNumber; + } + + public final void setAccessionNumber(String accessionNumber) + { + this.accessionNumber = accessionNumber; + } + + public final String getDescription() + { + return description; + } + + public final void setDescription(String description) + { + this.description = description; + } +} diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/basic/dto/ProteinDetails.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/basic/dto/ProteinDetails.java index 8495c70c047b9b7195a8be099e7d7db0da8337b2..aa306a7c62763caf53595b4084ca2b6a9f2a5f16 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/basic/dto/ProteinDetails.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/basic/dto/ProteinDetails.java @@ -48,6 +48,8 @@ public class ProteinDetails implements IsSerializable, Serializable private TechId proteinID; private List<Peptide> peptides; + + private List<IndistinguishableProteinInfo> indistinguishableProteinInfos; public String getSequence() { @@ -138,4 +140,14 @@ public class ProteinDetails implements IsSerializable, Serializable { this.dataSetTypeCode = dataSetTypeCode; } + + public void setIndistinguishableProteinInfos(List<IndistinguishableProteinInfo> indistinguishableProteinInfos) + { + this.indistinguishableProteinInfos = indistinguishableProteinInfos; + } + + public List<IndistinguishableProteinInfo> getIndistinguishableProteinInfos() + { + return indistinguishableProteinInfos; + } } diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/dto/IndistinguishableProtein.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/dto/IndistinguishableProtein.java new file mode 100644 index 0000000000000000000000000000000000000000..05aaac1a08afc8f2978303e9bddd7aeb66ecb381 --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/dto/IndistinguishableProtein.java @@ -0,0 +1,43 @@ +/* + * Copyright 2010 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto; + +import net.lemnik.eodsql.ResultColumn; + +/** + * + * + * @author Franz-Josef Elmer + */ +public class IndistinguishableProtein extends ProteinReference +{ + private static final long serialVersionUID = 1L; + + @ResultColumn("amino_acid_sequence") + private String sequence; + + public void setSequence(String sequence) + { + this.sequence = sequence; + } + + public String getSequence() + { + return sequence; + } + +}