diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientService.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientService.java index c317830aec8dd40741f0663c54df0480b3879897..027f27bf771c0704da4639010a604108402ba703 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientService.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientService.java @@ -22,8 +22,10 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TableExportCriteri import ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ListProteinByExperimentCriteria; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ListProteinSequenceCriteria; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ProteinInfo; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinByExperiment; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinSequence; /** * @@ -40,5 +42,11 @@ public interface IPhosphoNetXClientService extends IClientService public ProteinByExperiment getProteinByExperiment(TechId experimentID, TechId proteinReferenceID) throws UserFailureException; + + public ResultSet<ProteinSequence> listSequencesByProteinReference(ListProteinSequenceCriteria criteria) + throws UserFailureException; + public String prepareExportProteinSequences(TableExportCriteria<ProteinSequence> exportCriteria) + throws UserFailureException; + } diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientServiceAsync.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientServiceAsync.java index 18a23454fcb996f565821eaed92e89e2ef678961..a876608648fa593f9d5bc313e6c72ce44f0143fa 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientServiceAsync.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientServiceAsync.java @@ -23,8 +23,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.TechId; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ListProteinByExperimentCriteria; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ListProteinSequenceCriteria; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ProteinInfo; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinByExperiment; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinSequence; /** * @@ -36,7 +38,6 @@ public interface IPhosphoNetXClientServiceAsync extends IClientServiceAsync /** @see IPhosphoNetXClientService#listProteinsByExperiment(ListProteinByExperimentCriteria) */ public void listProteinsByExperiment(ListProteinByExperimentCriteria criteria, AsyncCallback<ResultSet<ProteinInfo>> callback); - /** @see IPhosphoNetXClientService#prepareExportProteins(TableExportCriteria) */ public void prepareExportProteins(TableExportCriteria<ProteinInfo> exportCriteria, @@ -45,4 +46,13 @@ public interface IPhosphoNetXClientServiceAsync extends IClientServiceAsync /** @see IPhosphoNetXClientService#getProteinByExperiment(TechId, TechId) */ public void getProteinByExperiment(TechId experimentID, TechId proteinReferenceID, AsyncCallback<ProteinByExperiment> callback); + + /** @see IPhosphoNetXClientService#listSequencesByProteinReference(ListProteinSequenceCriteria) */ + public void listSequencesByProteinReference(ListProteinSequenceCriteria criteria, + AsyncCallback<ResultSet<ProteinSequence>> callback); + + /** @see IPhosphoNetXClientService#prepareExportProteinSequences(TableExportCriteria) */ + public void prepareExportProteinSequences(TableExportCriteria<ProteinSequence> exportCriteria, + AsyncCallback<String> callback); + } \ No newline at end of file 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 f152a85458538b401b64d91e3f03394d9d0d18d9..d6cfad93f964f7c2567dbb880445993b28109611 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 @@ -35,6 +35,11 @@ public class Dict // Protein Viewer public static final String PROTEIN_IN_EXPERIMENT_TAB_LABEL = "protein_in_experiment_tab_label"; public static final String EXPERIMENT_LABEL = "experiment_label"; + public static final String SEQUENCE_SHORT_NAME = "sequence_short_name"; + public static final String DATABASE_NAME_AND_VERSION = "database_name_and_version"; + public static final String SEQUENCE = "sequence"; + public static final String SEQUENCES = "sequences"; + } diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/PhosphoNetXDisplayTypeIDGenerator.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/PhosphoNetXDisplayTypeIDGenerator.java index 435fa39e2a9c0e0f9f79b523a249af85dfbf3432..3c94d22a0769f4f94ea1ef3bf78cfdf50f88d08c 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/PhosphoNetXDisplayTypeIDGenerator.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/PhosphoNetXDisplayTypeIDGenerator.java @@ -28,6 +28,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; public enum PhosphoNetXDisplayTypeIDGenerator implements IDisplayTypeIDGenerator { PROTEIN_BY_EXPERIMENT_BROWSER_GRID("protein-by-experiment-browser-grid"), + PROTEIN_SEQUENCE_BROWSER_GRID("protein-sequence-browser-grid"), ; private final String genericNameOrPrefix; diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinSequenceGrid.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinSequenceGrid.java new file mode 100644 index 0000000000000000000000000000000000000000..58ccccf6b1afc40215f441b95d0e64c2d90cc61d --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinSequenceGrid.java @@ -0,0 +1,103 @@ +/* + * Copyright 2009 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.List; + +import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.IColumnDefinitionKind; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.AbstractSimpleBrowserGrid; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; +import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig; +import ch.systemsx.cisd.openbis.generic.client.web.client.dto.IColumnDefinition; +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.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.IPhosphoNetXClientServiceAsync; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.columns.ProteinSequenceColDefKind; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ListProteinSequenceCriteria; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinSequence; + +/** + * + * + * @author Franz-Josef Elmer + */ +public class ProteinSequenceGrid extends AbstractSimpleBrowserGrid<ProteinSequence> +{ + private static final String PREFIX = GenericConstants.ID_PREFIX + "protein-sequence-browser"; + + public static final String BROWSER_ID = PREFIX + "_main"; + + public static final String GRID_ID = PREFIX + "_grid"; + + static IDisposableComponent create(IViewContext<IPhosphoNetXClientServiceAsync> viewContext, TechId proteinReferenceID) + { + return new ProteinSequenceGrid(viewContext, proteinReferenceID).asDisposableWithoutToolbar(); + } + + private final IViewContext<IPhosphoNetXClientServiceAsync> specificViewContext; + + private ListProteinSequenceCriteria criteria; + + private ProteinSequenceGrid(IViewContext<IPhosphoNetXClientServiceAsync> viewContext, + TechId proteinReferenceID) + { + super(viewContext.getCommonViewContext(), BROWSER_ID + proteinReferenceID, + GRID_ID + proteinReferenceID, true); + specificViewContext = viewContext; + criteria = new ListProteinSequenceCriteria(); + criteria.setProteinReferenceID(proteinReferenceID); + setDisplayTypeIDGenerator(PhosphoNetXDisplayTypeIDGenerator.PROTEIN_SEQUENCE_BROWSER_GRID); + } + + @Override + protected IColumnDefinitionKind<ProteinSequence>[] getStaticColumnsDefinition() + { + return ProteinSequenceColDefKind.values(); + } + + @Override + protected List<IColumnDefinition<ProteinSequence>> getInitialFilters() + { + return asColumnFilters(new ProteinSequenceColDefKind[] {}); + } + + @Override + protected void listEntities(DefaultResultSetConfig<String, ProteinSequence> resultSetConfig, + AbstractAsyncCallback<ResultSet<ProteinSequence>> callback) + { + criteria.copyPagingConfig(resultSetConfig); + specificViewContext.getService().listSequencesByProteinReference(criteria, callback); + } + + @Override + protected void prepareExportEntities(TableExportCriteria<ProteinSequence> exportCriteria, + AbstractAsyncCallback<String> callback) + { + specificViewContext.getService().prepareExportProteinSequences(exportCriteria, callback); + } + + public DatabaseModificationKind[] getRelevantModifications() + { + return new DatabaseModificationKind[0]; + } + +} 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 3db1af446b420c02221e947211563e2cbe89e8f9..1d5b16eb29751a33bfbb51154c3c97500c99b643 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 @@ -27,6 +27,7 @@ import com.extjs.gxt.ui.client.widget.layout.BorderLayout; import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData; import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.BrowserSectionPanel; import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DatabaseModificationAwareComponent; @@ -132,6 +133,8 @@ public class ProteinViewer extends BorderLayoutData layoutData = createBorderLayoutData(LayoutRegion.WEST); layoutData.setSize(400); add(contentPanel, layoutData); + add(new BrowserSectionPanel(viewContext.getMessage(Dict.SEQUENCES), ProteinSequenceGrid + .create(viewContext, proteinreferenceID)), createRightBorderLayoutData()); layout(); } diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/columns/ProteinSequenceColDefKind.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/columns/ProteinSequenceColDefKind.java new file mode 100644 index 0000000000000000000000000000000000000000..c5f814a3220459f0f265df817bac4180ebd80a0d --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/columns/ProteinSequenceColDefKind.java @@ -0,0 +1,74 @@ +/* + * Copyright 2009 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.columns; + +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.AbstractColumnDefinitionKind; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.IColumnDefinitionKind; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.Dict; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinSequence; + +/** + * + * + * @author Franz-Josef Elmer + */ +public enum ProteinSequenceColDefKind implements IColumnDefinitionKind<ProteinSequence> +{ + SHORT_NAME(new AbstractColumnDefinitionKind<ProteinSequence>(Dict.SEQUENCE_SHORT_NAME, 20) + { + @Override + public String tryGetValue(ProteinSequence entity) + { + return entity.getShortName(); + } + }), + DATABASE(new AbstractColumnDefinitionKind<ProteinSequence>(Dict.DATABASE_NAME_AND_VERSION) + { + @Override + public String tryGetValue(ProteinSequence entity) + { + return entity.getDatabaseNameAndVersion(); + } + }), + SEQUENCE(new AbstractColumnDefinitionKind<ProteinSequence>(Dict.SEQUENCE, 400) + { + @Override + public String tryGetValue(ProteinSequence entity) + { + return entity.getSequence(); + } + }), + ; + + private final AbstractColumnDefinitionKind<ProteinSequence> columnDefinitionKind; + + private ProteinSequenceColDefKind(AbstractColumnDefinitionKind<ProteinSequence> columnDefinitionKind) + { + this.columnDefinitionKind = columnDefinitionKind; + } + + public String id() + { + return name(); + } + + public AbstractColumnDefinitionKind<ProteinSequence> getDescriptor() + { + return columnDefinitionKind; + } + +} diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/ListProteinSequenceCriteria.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/ListProteinSequenceCriteria.java new file mode 100644 index 0000000000000000000000000000000000000000..7795c66738b0055e74ed1ed53bf0cfeb297c8540 --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/ListProteinSequenceCriteria.java @@ -0,0 +1,44 @@ +/* + * Copyright 2009 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.dto; + +import com.google.gwt.user.client.rpc.IsSerializable; + +import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig; +import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinSequence; + +/** + * + * + * @author Franz-Josef Elmer + */ +public class ListProteinSequenceCriteria extends + DefaultResultSetConfig<String, ProteinSequence> implements IsSerializable +{ + private TechId proteinReferenceID; + + public final TechId getProteinReferenceID() + { + return proteinReferenceID; + } + + public final void setProteinReferenceID(TechId proteinReferenceID) + { + this.proteinReferenceID = proteinReferenceID; + } +} 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 5ecb9cb5fdf4e1fd385fa62f622cad4b2bf35404..94845f627aa543a7a822971cc5305f10b1590d39 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 @@ -14,6 +14,10 @@ var phosphonetx = { // Protein in experiment viewer protein_in_experiment_tab_label: "{0} in {1}", experiment_label: "Experiment", + sequence_short_name: "", + database_name_and_version: "Database", + sequence: "Amino Acid Sequence", + sequences: "Amino Acid Sequences", // LAST LINE: KEEP IT AT THE END lastline: "" // we need a line without a comma diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/ListProteinSequenceDataProvider.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/ListProteinSequenceDataProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..a0ce8cc96ea030fc23e0554f6b180ef89ddd901c --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/ListProteinSequenceDataProvider.java @@ -0,0 +1,50 @@ +/* + * Copyright 2009 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.server; + +import java.util.List; + +import ch.systemsx.cisd.common.exceptions.UserFailureException; +import ch.systemsx.cisd.openbis.generic.client.web.server.resultset.IOriginalDataProvider; +import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.IPhosphoNetXServer; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinSequence; + +/** + * + * + * @author Franz-Josef Elmer + */ +class ListProteinSequenceDataProvider implements IOriginalDataProvider<ProteinSequence> +{ + private final IPhosphoNetXServer server; + private final String sessionToken; + private final TechId proteinReferenceID; + + ListProteinSequenceDataProvider(IPhosphoNetXServer server, String sessionToken, + TechId proteinReferenceID) + { + this.server = server; + this.sessionToken = sessionToken; + this.proteinReferenceID = proteinReferenceID; + } + + public List<ProteinSequence> getOriginalData() throws UserFailureException + { + return server.listProteinSequencesByProteinReference(sessionToken, proteinReferenceID); + } +} diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/PhosphoNetXClientService.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/PhosphoNetXClientService.java index d4f3c7eed54fdc0e8089d91143d08cad340ac49d..a471a9c70ba98a170f4c969ed1f5041c3b061e0f 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/PhosphoNetXClientService.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/PhosphoNetXClientService.java @@ -30,10 +30,12 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.IPhosphoNetXClientService; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ListProteinByExperimentCriteria; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ListProteinSequenceCriteria; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ProteinInfo; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.IPhosphoNetXServer; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.ResourceNames; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinByExperiment; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinSequence; /** * @author Franz-Josef Elmer @@ -86,7 +88,21 @@ public class PhosphoNetXClientService extends AbstractClientService implements { throw UserFailureExceptionTranslator.translate(e); } + } + public ResultSet<ProteinSequence> listSequencesByProteinReference( + ListProteinSequenceCriteria criteria) + throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException + { + final String sessionToken = getSessionToken(); + return listEntities(criteria, new ListProteinSequenceDataProvider(server, sessionToken, + criteria.getProteinReferenceID())); + } + + public String prepareExportProteinSequences(TableExportCriteria<ProteinSequence> exportCriteria) + throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException + { + return prepareExportEntities(exportCriteria); } } diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/PhosphoNetXServer.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/PhosphoNetXServer.java index 68b5f87703b51ef7c54ab01699e7fc6b6cfabff0..2c9241cdb80f30b724b772c67494b488ed5c57e3 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/PhosphoNetXServer.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/PhosphoNetXServer.java @@ -16,6 +16,7 @@ package ch.systemsx.cisd.openbis.plugin.phosphonetx.server; +import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; @@ -96,7 +97,7 @@ public class PhosphoNetXServer extends AbstractServer<IPhosphoNetXServer> implem return table.getProteinReferences(); } - public ProteinByExperiment getProteinByExperiment(String sessionToken, TechId experimentId, + public ProteinByExperiment getProteinByExperiment(String sessionToken, TechId experimentID, TechId proteinReferenceID) throws UserFailureException { getSessionManager().getSession(sessionToken); @@ -110,18 +111,41 @@ public class PhosphoNetXServer extends AbstractServer<IPhosphoNetXServer> implem } proteinByExperiment.setUniprotID(proteinReference.getUniprotID()); proteinByExperiment.setDescription(proteinReference.getDescription()); + return proteinByExperiment; + } + + public List<ProteinSequence> listProteinSequencesByProteinReference(String sessionToken, + TechId proteinReferenceID) throws UserFailureException + { + IProteinQueryDAO proteinQueryDAO = specificDAOFactory.getProteinQueryDAO(); DataSet<Sequence> sequences = proteinQueryDAO.listProteinSequencesByProteinReference(proteinReferenceID.getId()); + ArrayList<ProteinSequence> proteinSequences = + new ArrayList<ProteinSequence>(sequences.size()); + int number = 0; for (Sequence sequence : sequences) { ProteinSequence proteinSequence = new ProteinSequence(); proteinSequence.setId(new TechId(sequence.getId())); + proteinSequence.setShortName(createShortName(number++)); proteinSequence.setSequence(sequence.getSequence()); proteinSequence.setDatabaseNameAndVersion(sequence.getDatabaseNameAndVersion()); - proteinByExperiment.addSequence(proteinSequence); + proteinSequences.add(proteinSequence); } sequences.close(); - return proteinByExperiment; + return proteinSequences; + } + + private String createShortName(int number) + { + StringBuilder builder = new StringBuilder(); + int n = number; + while (n > 0) + { + builder.insert(0, "ABCEDEFGHIJKLMNOPQRSTUVWXYZ".charAt(n % 26)); + n /= 26; + } + return builder.toString(); } } diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/PhosphoNetXServerLogger.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/PhosphoNetXServerLogger.java index 0998bbd83ccac5411f8b0e8da2eb52779643c688..8f97366476e81937c32ae1e7f404335dede26efa 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/PhosphoNetXServerLogger.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/PhosphoNetXServerLogger.java @@ -22,13 +22,10 @@ import ch.systemsx.cisd.authentication.ISessionManager; import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.openbis.generic.server.AbstractServerLogger; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; -import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentPE; -import ch.systemsx.cisd.openbis.generic.shared.dto.SampleGenerationDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.Session; -import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.IPhosphoNetXServer; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinByExperiment; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinSequence; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReference; /** @@ -42,27 +39,6 @@ public class PhosphoNetXServerLogger extends AbstractServerLogger implements IPh super(sessionManager, invocationSuccessful, elapsedTime); } - public SampleGenerationDTO getSampleInfo(String sessionToken, SampleIdentifier sampleIdentifier) - throws UserFailureException - { - logAccess(sessionToken, "get_sample_info", "CODE(%s)", sampleIdentifier); - return null; - } - - public SampleGenerationDTO getSampleInfo(String sessionToken, TechId sampleId) - throws UserFailureException - { - logAccess(sessionToken, "get_sample_info", "ID(%s)", sampleId); - return null; - } - - public void registerSample(String sessionToken, NewSample newSample, - List<AttachmentPE> attachments) - { - logTracking(sessionToken, "register_sample", "SAMPLE_TYPE(%s) SAMPLE(%s) ATTACHMENTS(%s)", - newSample.getSampleType(), newSample.getIdentifier(), attachments.size()); - } - public List<ProteinReference> listProteinsByExperiment(String sessionToken, TechId experimentId, double falseDiscoveryRate) throws UserFailureException { @@ -79,4 +55,12 @@ public class PhosphoNetXServerLogger extends AbstractServerLogger implements IPh return null; } + public List<ProteinSequence> listProteinSequencesByProteinReference(String sessionToken, + TechId proteinReferenceID) throws UserFailureException + { + logAccess(sessionToken, "list_protein_sequences_by_reference", + "PROTEIN_REFERENCE_ID(%s)", proteinReferenceID); + return null; + } + } 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 4a1a89415827cb7a03a4eb54a5258b8e9b7c82be..a0df8f0b13f44cc240e0e62eb96f0218357805ac 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 @@ -20,6 +20,7 @@ import net.lemnik.eodsql.BaseQuery; import net.lemnik.eodsql.DataSet; import net.lemnik.eodsql.Select; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.IdentifiedProtein; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProbabilityFDRMapping; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReference; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReferenceWithProbability; @@ -46,7 +47,21 @@ public interface IProteinQueryDAO extends BaseQuery @Select("select * from protein_references where id = ?{1}") public ProteinReference tryToGetProteinReference(long proteinReferenceID); - @Select("select s.id, s.amino_acid_sequence, d.name_and_version " - + "from sequences as s left join databases as d on s.db_id = d.id where s.prre_id = ?{1}") + @Select("select s.id, amino_acid_sequence, name_and_version " + + "from sequences as s join databases as d on s.db_id = d.id " + + "where s.prre_id = ?{1} order by name_and_version") public DataSet<Sequence> listProteinSequencesByProteinReference(long proteinReferenceID); + + @Select("select ds.id as data_set_id, ds.perm_id as data_set_perm_id, p.id as protein_id, " + + "probability, count(pe.id) as peptide_count, amino_acid_sequence, name_and_version " + + "from data_sets as ds join proteins as p on p.dase_id = ds.id " + + " join identified_proteins as i on i.prot_id = p.id " + + " join sequences as s on i.sequ_id = s.id " + + " join databases as db on s.db_id = db.id " + + " left join peptides as pe on pe.prot_id = p.id " + + "where s.prre_id = ?{2} and ds.expe_id = ?{1} " + + "group by data_set_id, data_set_perm_id, protein_id, probability, " + + " amino_acid_sequence, name_and_version order by data_set_perm_id") + public DataSet<IdentifiedProtein> listProteinsByProteinReferenceAndExperiment( + long experimentID, long proteinReferenceID); } diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/IPhosphoNetXServer.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/IPhosphoNetXServer.java index 618ecb74fa40e12deb2ed131e4fe15bd87ed89c5..61b936b02f1d3ee79294016deb345e56062a104b 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/IPhosphoNetXServer.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/IPhosphoNetXServer.java @@ -28,6 +28,7 @@ import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.RolesAll import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.AbstractTechIdPredicate.ExperimentTechIdPredicate; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinByExperiment; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinSequence; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReference; /** @@ -49,5 +50,8 @@ public interface IPhosphoNetXServer extends IServer @AuthorizationGuard(guardClass = ExperimentTechIdPredicate.class) TechId experimentId, TechId proteinReferenceID) throws UserFailureException; - + @Transactional + @RolesAllowed(RoleSet.OBSERVER) + public List<ProteinSequence> listProteinSequencesByProteinReference(String sessionToken, + TechId proteinReferenceID) throws UserFailureException; } diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/basic/dto/ProteinSequence.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/basic/dto/ProteinSequence.java index d90d82a9fa526bb50601b5ca6049468bb920273f..e8a00621c49687c8d01e70bbfab0b8f4434a36bd 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/basic/dto/ProteinSequence.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/basic/dto/ProteinSequence.java @@ -32,12 +32,24 @@ public class ProteinSequence implements IsSerializable, Serializable { private static final long serialVersionUID = ServiceVersionHolder.VERSION; + private String shortName; + private TechId id; private String sequence; private String databaseNameAndVersion; + public final String getShortName() + { + return shortName; + } + + public final void setShortName(String version) + { + this.shortName = version; + } + public final TechId getId() { return id; diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/dto/IdentifiedProtein.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/dto/IdentifiedProtein.java index b1c3e58082a23128b41fd100ddab4b9797534dfe..7f78dcd9148a9777b64627932329b6ba86681cbf 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/dto/IdentifiedProtein.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/dto/IdentifiedProtein.java @@ -34,11 +34,14 @@ public class IdentifiedProtein extends AbstractDTOWithID @ResultColumn("protein_id") private long proteinID; - @ResultColumn("uniprot_id") - private String uniprotID; + @ResultColumn("peptide_count") + private int peptideCount; - @ResultColumn("description") - private String description; + @ResultColumn("amino_acid_sequence") + private String sequence; + + @ResultColumn("name_and_version") + private String database; @ResultColumn("probability") private double probability; @@ -55,24 +58,24 @@ public class IdentifiedProtein extends AbstractDTOWithID this.dataSetPermID = dataSetPermID; } - public final String getUniprotID() + public final int getPeptideCount() { - return uniprotID; + return peptideCount; } - public final void setUniprotID(String uniprotID) + public final void setPeptideCount(int uniprotID) { - this.uniprotID = uniprotID; + this.peptideCount = uniprotID; } - public final String getDescription() + public final String getSequence() { - return description; + return sequence; } - public final void setDescription(String description) + public final void setSequence(String description) { - this.description = description; + this.sequence = description; } public final long getDataSetID() @@ -115,5 +118,15 @@ public class IdentifiedProtein extends AbstractDTOWithID this.falseDiscoveryRate = falseDiscoveryRate; } + public final String getDatabase() + { + return database; + } + + public final void setDatabase(String database) + { + this.database = database; + } + }