Skip to content
Snippets Groups Projects
Commit c65b5a7b authored by felmer's avatar felmer
Browse files

LMS-967 business layer for ProteinByExperiment viewer

SVN: 11666
parent 91613478
No related branches found
No related tags found
No related merge requests found
Showing
with 290 additions and 27 deletions
......@@ -22,8 +22,8 @@ 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.ProteinByExperiment;
import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ProteinInfo;
import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinByExperiment;
/**
*
......
......@@ -23,8 +23,8 @@ 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.ProteinByExperiment;
import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ProteinInfo;
import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinByExperiment;
/**
*
......
......@@ -34,8 +34,8 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.propert
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.dto.ProteinByExperiment;
import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ProteinInfo;
import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinByExperiment;
/**
*
......@@ -86,6 +86,7 @@ public class ProteinViewer extends ContentPanel implements IDatabaseModification
TechId proteinReferenceID)
{
widgetID = createWidgetID(proteinReferenceID);
setId(widgetID);
this.viewContext = viewContext;
this.experimentID = experimentID;
this.proteinreferenceID = proteinReferenceID;
......@@ -101,8 +102,9 @@ public class ProteinViewer extends ContentPanel implements IDatabaseModification
private void recreateUI(ProteinByExperiment protein)
{
final Map<String, Object> properties = new LinkedHashMap<String, Object>();
properties.put("Protein Description", protein.getDescription());
properties.put("UniProt ID", protein.getUniprotID());
final PropertyGrid propertyGrid = new PropertyGrid(viewContext, properties.size());
properties.put("ID", proteinreferenceID);
add(propertyGrid);
}
......
......@@ -20,31 +20,31 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import ch.systemsx.cisd.common.exceptions.UserFailureException;
import ch.systemsx.cisd.common.servlet.IRequestContextProvider;
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.client.web.client.exception.UserFailureException;
import ch.systemsx.cisd.openbis.generic.client.web.server.AbstractClientService;
import ch.systemsx.cisd.openbis.generic.client.web.server.translator.UserFailureExceptionTranslator;
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.ProteinByExperiment;
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;
/**
*
*
* @author Franz-Josef Elmer
*/
@Component(value = ResourceNames.PHOSPHONETX_PLUGIN_SERVICE)
public class PhosphoNetXClientService extends AbstractClientService implements IPhosphoNetXClientService
public class PhosphoNetXClientService extends AbstractClientService implements
IPhosphoNetXClientService
{
@Resource(name = ResourceNames.PHOSPHONETX_PLUGIN_SERVER)
private IPhosphoNetXServer server;
public PhosphoNetXClientService()
{
super();
......@@ -61,23 +61,32 @@ public class PhosphoNetXClientService extends AbstractClientService implements I
return server;
}
public ResultSet<ProteinInfo> listProteinsByExperiment(ListProteinByExperimentCriteria criteria) throws UserFailureException
public ResultSet<ProteinInfo> listProteinsByExperiment(ListProteinByExperimentCriteria criteria)
throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException
{
final String sessionToken = getSessionToken();
return listEntities(criteria, new ListProteinOriginalDataProvider(server,
sessionToken, criteria.getExperimentID(), criteria.getFalseDiscoveryRate()));
return listEntities(criteria, new ListProteinOriginalDataProvider(server, sessionToken,
criteria.getExperimentID(), criteria.getFalseDiscoveryRate()));
}
public String prepareExportProteins(TableExportCriteria<ProteinInfo> exportCriteria)
throws UserFailureException
throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException
{
return prepareExportEntities(exportCriteria);
}
public ProteinByExperiment getProteinByExperiment(TechId experimentID, TechId proteinReferenceID)
throws UserFailureException
throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException
{
return new ProteinByExperiment();
final String sessionToken = getSessionToken();
try
{
return server.getProteinByExperiment(sessionToken, experimentID, proteinReferenceID);
} catch (final UserFailureException e)
{
throw UserFailureExceptionTranslator.translate(e);
}
}
}
......@@ -20,6 +20,8 @@ import java.util.List;
import javax.annotation.Resource;
import net.lemnik.eodsql.DataSet;
import org.springframework.stereotype.Component;
import ch.rinn.restrictions.Private;
......@@ -35,9 +37,13 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.Session;
import ch.systemsx.cisd.openbis.plugin.phosphonetx.server.business.IBusinessObjectFactory;
import ch.systemsx.cisd.openbis.plugin.phosphonetx.server.business.IProteinReferenceTable;
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.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;
import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReference;
import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.Sequence;
/**
* @author Franz-Josef Elmer
......@@ -90,4 +96,31 @@ public class PhosphoNetXServer extends AbstractServer<IPhosphoNetXServer> implem
return table.getProteinReferences();
}
public ProteinByExperiment getProteinByExperiment(String sessionToken, TechId experimentId,
TechId proteinReferenceID) throws UserFailureException
{
getSessionManager().getSession(sessionToken);
IProteinQueryDAO proteinQueryDAO = specificDAOFactory.getProteinQueryDAO();
ProteinByExperiment proteinByExperiment = new ProteinByExperiment();
ProteinReference proteinReference =
proteinQueryDAO.tryToGetProteinReference(proteinReferenceID.getId());
if (proteinReference == null)
{
throw new UserFailureException("No protein reference found for ID: " + proteinReferenceID);
}
proteinByExperiment.setUniprotID(proteinReference.getUniprotID());
proteinByExperiment.setDescription(proteinReference.getDescription());
DataSet<Sequence> sequences =
proteinQueryDAO.listProteinSequencesByProteinReference(proteinReferenceID.getId());
for (Sequence sequence : sequences)
{
ProteinSequence proteinSequence = new ProteinSequence();
proteinSequence.setId(new TechId(sequence.getId()));
proteinSequence.setSequence(sequence.getSequence());
proteinSequence.setDatabaseNameAndVersion(sequence.getDatabaseNameAndVersion());
proteinByExperiment.addSequence(proteinSequence);
}
return proteinByExperiment;
}
}
......@@ -28,6 +28,7 @@ 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.dto.ProteinReference;
/**
......@@ -70,4 +71,12 @@ public class PhosphoNetXServerLogger extends AbstractServerLogger implements IPh
return null;
}
public ProteinByExperiment getProteinByExperiment(String sessionToken, TechId experimentId,
TechId proteinReferenceID) throws UserFailureException
{
logAccess(sessionToken, "get_protein_by_experiment",
"EXPERIMENT_ID(%s) PROTEIN_REFERENCE_ID(%s)", experimentId, proteinReferenceID);
return null;
}
}
......@@ -21,7 +21,9 @@ import net.lemnik.eodsql.DataSet;
import net.lemnik.eodsql.Select;
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;
import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.Sequence;
/**
*
......@@ -40,4 +42,11 @@ public interface IProteinQueryDAO extends BaseQuery
+ "sequences as s left join protein_references as pr on s.prre_id = pr.id "
+ "where e.perm_id = ?{1} and ip.sequ_id = s.id order by pr.description")
public DataSet<ProteinReferenceWithProbability> listProteinsByExperiment(String experimentPermID);
@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}")
public DataSet<Sequence> listProteinSequencesByProteinReference(long proteinReferenceID);
}
......@@ -27,6 +27,7 @@ import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.RoleSet;
import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.RolesAllowed;
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.dto.ProteinReference;
/**
......@@ -41,4 +42,12 @@ public interface IPhosphoNetXServer extends IServer
public List<ProteinReference> listProteinsByExperiment(String sessionToken,
@AuthorizationGuard(guardClass = ExperimentTechIdPredicate.class)
TechId experimentId, double falseDiscoveryRate) throws UserFailureException;
@Transactional
@RolesAllowed(RoleSet.OBSERVER)
public ProteinByExperiment getProteinByExperiment(String sessionToken,
@AuthorizationGuard(guardClass = ExperimentTechIdPredicate.class)
TechId experimentId, TechId proteinReferenceID) throws UserFailureException;
}
/*
* 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.shared.basic.dto;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import com.google.gwt.user.client.rpc.IsSerializable;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder;
/**
*
*
* @author Franz-Josef Elmer
*/
public class ProteinByExperiment implements IsSerializable, Serializable
{
private static final long serialVersionUID = ServiceVersionHolder.VERSION;
private String uniprotID;
private String description;
private List<ProteinSequence> sequences = new ArrayList<ProteinSequence>();
public final String getUniprotID()
{
return uniprotID;
}
public final void setUniprotID(String uniprotID)
{
this.uniprotID = uniprotID;
}
public final String getDescription()
{
return description;
}
public final void setDescription(String description)
{
this.description = description;
}
public final List<ProteinSequence> getSequences()
{
return sequences;
}
public final void addSequence(ProteinSequence proteinSequence)
{
this.sequences.add(proteinSequence);
}
}
/*
* 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.shared.basic.dto;
import java.io.Serializable;
import com.google.gwt.user.client.rpc.IsSerializable;
import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder;
/**
*
*
* @author Franz-Josef Elmer
*/
public class ProteinSequence implements IsSerializable, Serializable
{
private static final long serialVersionUID = ServiceVersionHolder.VERSION;
private TechId id;
private String sequence;
private String databaseNameAndVersion;
public final TechId getId()
{
return id;
}
public final void setId(TechId id)
{
this.id = id;
}
public final String getSequence()
{
return sequence;
}
public final void setSequence(String sequence)
{
this.sequence = sequence;
}
public final String getDatabaseNameAndVersion()
{
return databaseNameAndVersion;
}
public final void setDatabaseNameAndVersion(String databaseNameAndVersion)
{
this.databaseNameAndVersion = databaseNameAndVersion;
}
}
......@@ -23,23 +23,14 @@ import net.lemnik.eodsql.ResultColumn;
*
* @author Franz-Josef Elmer
*/
public abstract class ProteinReference extends AbstractDTOWithID
public class ProteinReference extends AbstractDTOWithID
{
@ResultColumn("uniprot_id")
private String uniprotID;
@ResultColumn("description")
private String description;
/**
*
*
*/
public ProteinReference()
{
super();
}
public final String getUniprotID()
{
return uniprotID;
......
......@@ -14,16 +14,43 @@
* limitations under the License.
*/
package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto;
package ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto;
import net.lemnik.eodsql.ResultColumn;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
*
*
* @author Franz-Josef Elmer
*/
public class ProteinByExperiment implements IsSerializable
public class Sequence extends AbstractDTOWithID
{
@ResultColumn("amino_acid_sequence")
private String sequence;
@ResultColumn("name_and_version")
private String databaseNameAndVersion;
public final String getSequence()
{
return sequence;
}
public final void setSequence(String sequence)
{
this.sequence = sequence;
}
public final String getDatabaseNameAndVersion()
{
return databaseNameAndVersion;
}
public final void setDatabaseNameAndVersion(String databaseNameAndVersion)
{
this.databaseNameAndVersion = databaseNameAndVersion;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment