diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/AbundanceManager.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/AbundanceManager.java
index 38aff587293ea87e10e8597c904c19d5a5ce0c51..b78bf393bf7a9ca197c30ba26160f3cb298ebaf1 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/AbundanceManager.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/AbundanceManager.java
@@ -16,14 +16,15 @@
 
 package ch.systemsx.cisd.openbis.plugin.phosphonetx.server.business;
 
+import java.util.ArrayList;
 import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.Map;
+import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
 
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample;
-import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReferenceWithProbability;
+import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinAbundance;
+import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReferenceWithProtein;
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinWithAbundances;
 
 /**
@@ -31,8 +32,7 @@ import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinWithAbundan
  */
 class AbundanceManager
 {
-    private final Map<String, ProteinWithAbundances> proteins =
-            new LinkedHashMap<String, ProteinWithAbundances>();
+    private final List<ProteinWithAbundances> proteins = new ArrayList<ProteinWithAbundances>();
     
     private final ISampleProvider sampleProvider;
     
@@ -41,21 +41,29 @@ class AbundanceManager
     AbundanceManager(ISampleProvider sampleProvider)
     {
         this.sampleProvider = sampleProvider;
-        
     }
-
-    public void handle(ProteinReferenceWithProbability proteinReference)
+    
+    public void handle(ProteinReferenceWithProtein proteinReference, List<ProteinAbundance> listOrNull)
     {
-        ProteinWithAbundances protein = getOrCreateProtein(proteinReference);
-        String samplePermID = proteinReference.getSamplePermID();
-        if (samplePermID != null)
+        String accessionNumber = proteinReference.getAccessionNumber();
+        ProteinWithAbundances protein = new ProteinWithAbundances();
+        protein.setCoverage(proteinReference.getCoverage());
+        protein.setId(proteinReference.getId());
+        protein.setDescription(proteinReference.getDescription());
+        protein.setAccessionNumber(accessionNumber);
+        proteins.add(protein);
+        if (listOrNull != null)
         {
-            Long sampleID = getSampleIDOrParentSampleID(samplePermID);
-            sampleIDs.add(sampleID);
-            protein.addAbundanceFor(sampleID, proteinReference.getAbundance());
+            for (ProteinAbundance proteinAbundance : listOrNull)
+            {
+                String samplePermID = proteinAbundance.getSamplePermID();
+                Long sampleID = getSampleIDOrParentSampleID(samplePermID);
+                sampleIDs.add(sampleID);
+                protein.addAbundanceFor(sampleID, proteinAbundance.getAbundance());
+            }
         }
     }
-
+    
     private Long getSampleIDOrParentSampleID(String samplePermID)
     {
         Sample sample = sampleProvider.getSample(samplePermID);
@@ -63,25 +71,9 @@ class AbundanceManager
         return parent == null ? sample.getId() : parent.getId();
     }
 
-    private ProteinWithAbundances getOrCreateProtein(ProteinReferenceWithProbability proteinReference)
-    {
-        String accessionNumber = proteinReference.getAccessionNumber();
-        ProteinWithAbundances protein = proteins.get(accessionNumber);
-        if (protein == null)
-        {
-            protein = new ProteinWithAbundances();
-            protein.setCoverage(proteinReference.getCoverage());
-            protein.setId(proteinReference.getId());
-            protein.setDescription(proteinReference.getDescription());
-            protein.setAccessionNumber(accessionNumber);
-            proteins.put(accessionNumber, protein);
-        }
-        return protein;
-    }
-
     public Collection<ProteinWithAbundances> getProteinsWithAbundances()
     {
-        return proteins.values();
+        return proteins;
     }
 
     public final Collection<Long> getSampleIDs()
@@ -89,4 +81,5 @@ class AbundanceManager
         return sampleIDs;
     }
 
+
 }
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/BusinessObjectFactory.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/BusinessObjectFactory.java
index 209e514577fa40d7b5ec171fec47c3a768f97100..966240e03b13c22c83afa056ffa11c7142a4486e 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/BusinessObjectFactory.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/BusinessObjectFactory.java
@@ -32,10 +32,10 @@ public class BusinessObjectFactory  extends AbstractPluginBusinessObjectFactory
     private final IDAOFactory daoFactory;
     private final IPhosphoNetXDAOFactory specificDAOFactory;
 
-    public BusinessObjectFactory(IDAOFactory daoFactory, IPhosphoNetXDAOFactory specificDAOFactory, String typeOfCaching)
+    public BusinessObjectFactory(IDAOFactory daoFactory, IPhosphoNetXDAOFactory specificDAOFactory)
     {
         this.daoFactory = daoFactory;
-        this.specificDAOFactory = new DAOFactoryWithCache(specificDAOFactory, typeOfCaching);
+        this.specificDAOFactory = specificDAOFactory;
     }
 
     public ISampleLister createSampleLister(Session session)
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/DAOFactoryWithCache.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/DAOFactoryWithCache.java
deleted file mode 100644
index 818ed880788aa33e2374e76bef7d003057fd7679..0000000000000000000000000000000000000000
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/DAOFactoryWithCache.java
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * 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.server.business;
-
-import it.unimi.dsi.fastutil.longs.LongSet;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import net.lemnik.eodsql.DataSet;
-
-import org.apache.commons.lang.SerializationUtils;
-import org.apache.log4j.Logger;
-import org.springframework.jdbc.core.RowMapper;
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
-import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
-import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
-import org.springframework.jdbc.support.lob.LobHandler;
-
-import ch.systemsx.cisd.common.logging.LogCategory;
-import ch.systemsx.cisd.common.logging.LogFactory;
-import ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext;
-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.dto.IdentifiedPeptide;
-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.ProteinAbundance;
-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.ProteinReferenceWithProbabilityAndPeptide;
-import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReferenceWithProtein;
-import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.SampleAbundance;
-import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.Sequence;
-
-/**
- * 
- *
- * @author Franz-Josef Elmer
- */
-class DAOFactoryWithCache implements IPhosphoNetXDAOFactory
-{
-    private static final class ProteinQueryDAO implements IProteinQueryDAO
-    {
-        private static final Logger operationLog =
-            LogFactory.getLogger(LogCategory.OPERATION, ProteinQueryDAO.class);
-        
-        private static final class DataSetProxy<T> implements DataSet<T>
-        {
-            private List<T> list;
-            DataSetProxy(List<T> list)
-            {
-                this.list = list;
-            }
-            public void add(int index, T element)
-            {
-                list.add(index, element);
-            }
-            public boolean add(T o)
-            {
-                return list.add(o);
-            }
-            public boolean addAll(Collection<? extends T> c)
-            {
-                return list.addAll(c);
-            }
-            public boolean addAll(int index, Collection<? extends T> c)
-            {
-                return list.addAll(index, c);
-            }
-            public void clear()
-            {
-                list.clear();
-            }
-            public boolean contains(Object o)
-            {
-                return list.contains(o);
-            }
-            public boolean containsAll(Collection<?> c)
-            {
-                return list.containsAll(c);
-            }
-            @Override
-            public boolean equals(Object o)
-            {
-                return list.equals(o);
-            }
-            public T get(int index)
-            {
-                return list.get(index);
-            }
-            @Override
-            public int hashCode()
-            {
-                return list.hashCode();
-            }
-            public int indexOf(Object o)
-            {
-                return list.indexOf(o);
-            }
-            public boolean isEmpty()
-            {
-                return list.isEmpty();
-            }
-            public Iterator<T> iterator()
-            {
-                return list.iterator();
-            }
-            public int lastIndexOf(Object o)
-            {
-                return list.lastIndexOf(o);
-            }
-            public ListIterator<T> listIterator()
-            {
-                return list.listIterator();
-            }
-            public ListIterator<T> listIterator(int index)
-            {
-                return list.listIterator(index);
-            }
-            public T remove(int index)
-            {
-                return list.remove(index);
-            }
-            public boolean remove(Object o)
-            {
-                return list.remove(o);
-            }
-            public boolean removeAll(Collection<?> c)
-            {
-                return list.removeAll(c);
-            }
-            public boolean retainAll(Collection<?> c)
-            {
-                return list.retainAll(c);
-            }
-            public T set(int index, T element)
-            {
-                return list.set(index, element);
-            }
-            public int size()
-            {
-                return list.size();
-            }
-            public List<T> subList(int fromIndex, int toIndex)
-            {
-                return list.subList(fromIndex, toIndex);
-            }
-            public Object[] toArray()
-            {
-                return list.toArray();
-            }
-            public <X> X[] toArray(X[] a)
-            {
-                return list.toArray(a);
-            }
-            public void close()
-            {
-            }
-            public void disconnect()
-            {
-            }
-            public boolean isConnected()
-            {
-                return false;
-            }
-            
-        }
-        
-        private final IProteinQueryDAO dao;
-
-        private final DatabaseConfigurationContext context;
-
-        private final SimpleJdbcTemplate template;
-
-        private NamedParameterJdbcTemplate namedTemplate;
-
-        ProteinQueryDAO(final IProteinQueryDAO dao, DatabaseConfigurationContext context)
-        {
-            this.dao = dao;
-            this.context = context;
-            template = new SimpleJdbcTemplate(context.getDataSource());
-            namedTemplate = new NamedParameterJdbcTemplate(context.getDataSource());
-        }
-
-        public void close()
-        {
-            dao.close();
-        }
-
-        public DataSet<ProbabilityFDRMapping> getProbabilityFDRMapping(long dataSetID)
-        {
-            return dao.getProbabilityFDRMapping(dataSetID);
-        }
-
-        public boolean isClosed()
-        {
-            return dao.isClosed();
-        }
-
-        public DataSet<String> listAbundanceRelatedSamplePermIDsByExperiment(String experimentPermID)
-        {
-            return dao.listAbundanceRelatedSamplePermIDsByExperiment(experimentPermID);
-        }
-
-        public DataSet<IdentifiedPeptide> listIdentifiedPeptidesByProtein(long proteinID)
-        {
-            return dao.listIdentifiedPeptidesByProtein(proteinID);
-        }
-
-        public DataSet<ProteinReferenceWithProbability> listProteinsByExperiment(
-                String experimentPermID)
-        {
-            long time = System.currentTimeMillis();
-            final LobHandler lobHandler = context.getLobHandler();
-            List<ProteinReferenceWithProbability> resultSet =
-                    template.queryForObject(
-                            "select blob from protein_view_cache where experiment_perm_id = ?",
-                            new ParameterizedRowMapper<List<ProteinReferenceWithProbability>>()
-                                {
-
-                                    public List<ProteinReferenceWithProbability> mapRow(ResultSet rs,
-                                            int rowNum) throws SQLException
-                                    {
-                                        return (List<ProteinReferenceWithProbability>) SerializationUtils
-                                                .deserialize(lobHandler.getBlobAsBinaryStream(rs, 1));
-                                    }
-                                }, experimentPermID);
-            operationLog.info("(" + (System.currentTimeMillis() - time) + "ms) listProteinsByExperiment");
-            return new DataSetProxy<ProteinReferenceWithProbability>(resultSet);
-        }
-        
-        public DataSet<IdentifiedProtein> listProteinsByProteinReferenceAndExperiment(
-                String experimentPermID, long proteinReferenceID)
-        {
-            return dao.listProteinsByProteinReferenceAndExperiment(experimentPermID,
-                    proteinReferenceID);
-        }
-
-        public DataSet<Sequence> listProteinSequencesByProteinReference(long proteinReferenceID)
-        {
-            return dao.listProteinSequencesByProteinReference(proteinReferenceID);
-        }
-
-        public DataSet<ProteinReferenceWithProbabilityAndPeptide> listProteinsWithProbabilityAndPeptidesByExperiment(
-                String experimentPermID)
-        {
-            return dao.listProteinsWithProbabilityAndPeptidesByExperiment(experimentPermID);
-        }
-
-        public DataSet<SampleAbundance> listSampleAbundanceByProtein(String experimentPermID,
-                long proteinReferenceID)
-        {
-            return dao.listSampleAbundanceByProtein(experimentPermID, proteinReferenceID);
-        }
-
-        public ProteinReference tryToGetProteinReference(long proteinReferenceID)
-        {
-            return dao.tryToGetProteinReference(proteinReferenceID);
-        }
-
-        public byte[] tryToGetCachedProteinView(String experimentPermID)
-        {
-            return dao.tryToGetCachedProteinView(experimentPermID);
-        }
-
-        public DataSet<ProteinReferenceWithProtein> listProteinReferencesByExperiment(
-                String experimentPermID)
-        {
-            long time = System.currentTimeMillis();
-            try
-            {
-                List<ProteinReferenceWithProtein> list = template.query("select d.id , p.id , probability, coverage, "
-                        + "pr.id, accession_number, description "
-                        + "from protein_references as pr "
-                        + "left join sequences as s on s.prre_id = pr.id "
-                        + "left join identified_proteins as ip on ip.sequ_id = s.id "
-                        + "left join proteins as p on ip.prot_id = p.id "
-                        + "left join data_sets as d on p.dase_id = d.id "
-                        + "left join experiments as e on d.expe_id = e.id where e.perm_id = ?",
-                        new ParameterizedRowMapper<ProteinReferenceWithProtein>()
-                            {
-
-                                public ProteinReferenceWithProtein mapRow(ResultSet rs, int rowNum)
-                                        throws SQLException
-                                {
-                                    ProteinReferenceWithProtein protein =
-                                            new ProteinReferenceWithProtein();
-                                    protein.setDataSetID(rs.getLong(1));
-                                    protein.setProteinID(rs.getLong(2));
-                                    protein.setProbability(rs.getDouble(3));
-                                    protein.setCoverage(rs.getDouble(4));
-                                    protein.setId(rs.getLong(5));
-                                    protein.setAccessionNumber(rs.getString(6));
-                                    protein.setDescription(rs.getString(7));
-                                    return protein;
-                                }
-                            }, experimentPermID);
-                return new DataSetProxy<ProteinReferenceWithProtein>(list);
-//                return dao.listProteinReferencesByExperiment(experimentPermID);
-            } finally
-            {
-                operationLog.info("(" + (System.currentTimeMillis() - time )+ "ms) listProteinReferenceByExperiment");
-            }
-        }
-
-        public DataSet<ProteinAbundance> listProteinWithAbundanceByExperiment(
-                LongSet proteinIDs)
-        {
-            long time = System.currentTimeMillis();
-            try
-            {
-                List<ProteinAbundance> list = namedTemplate.query("select p.id, a.value, s.perm_id "
-                        + "from proteins as p join abundances as a on p.id = a.prot_id "
-                        + "left join samples as s on a.samp_id = s.id "
-                        + "where p.id in (:ids)", Collections.singletonMap("ids", proteinIDs), new RowMapper()
-                    {
-                        
-                        public Object mapRow(ResultSet rs, int rowNum) throws SQLException
-                        {
-                            ProteinAbundance proteinAbundance = new ProteinAbundance();
-                            proteinAbundance.setId(rs.getLong(1));
-                            proteinAbundance.setAbundance(rs.getDouble(2));
-                            proteinAbundance.setSampleID(rs.getString(3));
-                            return proteinAbundance;
-                        }
-                    });
-                return new DataSetProxy<ProteinAbundance>(list);
-            } finally
-            {
-                operationLog.info("(" + (System.currentTimeMillis() - time)
-                        + "ms) listProteinWithAbundanceByExperiment");
-            }
-        }
-    }
-    
-    private IProteinQueryDAO proteinQueryDAO;
-    private DatabaseConfigurationContext context;
-
-    DAOFactoryWithCache(IPhosphoNetXDAOFactory daoFactory, String typeOfCaching)
-    {
-        proteinQueryDAO = new ProteinQueryDAO(daoFactory.getProteinQueryDAO(), daoFactory.getContext());
-        context = daoFactory.getContext();
-    }
-
-    public IProteinQueryDAO getProteinQueryDAO()
-    {
-        return proteinQueryDAO;
-    }
-
-    public DatabaseConfigurationContext getContext()
-    {
-        return context;
-    }
-
-}
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/ErrorModel.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/ErrorModel.java
index 945ecc7b86a560e6bca73ab47546d66b9dfc5c55..d1681f9b23d060b068b268fb8519f08ed181a805 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/ErrorModel.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/ErrorModel.java
@@ -26,7 +26,7 @@ import ch.systemsx.cisd.openbis.plugin.phosphonetx.server.dataaccess.IProteinQue
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.ProbabilityToFDRCalculator;
 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.ProteinReferenceWithProbability;
+import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReferenceWithProtein;
 
 /**
  * @author Franz-Josef Elmer
@@ -43,7 +43,7 @@ class ErrorModel
         this.specificDAOFactory = specificDAOFactory;
     }
 
-    boolean passProtein(ProteinReferenceWithProbability protein, double falseDiscoveryRate)
+    boolean passProtein(ProteinReferenceWithProtein protein, double falseDiscoveryRate)
     {
         ProbabilityToFDRCalculator calculator = getCalculator(protein.getDataSetID());
         return calculator.calculateFDR(protein.getProbability()) <= falseDiscoveryRate;
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/ProteinInfoTable.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/ProteinInfoTable.java
index 337c15436f4adb1d937b1556694ce41a27c03c5d..53bb3ef4fbcb740847ea33a33e017846bc487175 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/ProteinInfoTable.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/ProteinInfoTable.java
@@ -38,7 +38,6 @@ import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.AbundanceCol
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.AggregateFunction;
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinInfo;
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinAbundance;
-import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReferenceWithProbability;
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReferenceWithProtein;
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinWithAbundances;
 
@@ -124,91 +123,60 @@ class ProteinInfoTable extends AbstractBusinessObject implements IProteinInfoTab
             double falseDiscoveryRate)
     {
         AbundanceManager abundanceManager = new AbundanceManager(sampleProvider);
-        IPhosphoNetXDAOFactory daoFactory = getSpecificDAOFactory();
-        ErrorModel errorModel = new ErrorModel(daoFactory);
-        IProteinQueryDAO proteinQueryDAO = daoFactory.getProteinQueryDAO();
-        DataSet<ProteinReferenceWithProtein> ds1 = proteinQueryDAO.listProteinReferencesByExperiment(experimentPermID);
-        List<ProteinReferenceWithProtein> prs = new ArrayList<ProteinReferenceWithProtein>();
+        IPhosphoNetXDAOFactory specificDAOFactory = getSpecificDAOFactory();
+        IProteinQueryDAO dao = specificDAOFactory.getProteinQueryDAO();
+        DataSet<ProteinReferenceWithProtein> dataSet =
+                dao.listProteinReferencesByExperiment(experimentPermID);
+        List<ProteinReferenceWithProtein> proteins = new ArrayList<ProteinReferenceWithProtein>();
         LongOpenHashSet proteinIDs = new LongOpenHashSet();
         try
         {
-            for (ProteinReferenceWithProtein protein : ds1)
+            for (ProteinReferenceWithProtein protein : dataSet)
             {
-                prs.add(protein);
+                proteins.add(protein);
                 proteinIDs.add(protein.getProteinID());
             }
         } finally
         {
-            ds1.close();
+            dataSet.close();
         }
-        DataSet<ProteinAbundance> ds2 = proteinQueryDAO.listProteinWithAbundanceByExperiment(proteinIDs);
-        Map<Long, List<ProteinAbundance>> p2a = new HashMap<Long, List<ProteinAbundance>>();
+        Map<Long, List<ProteinAbundance>> abundancesPerProtein = getAbudancesPerProtein(proteinIDs);
+        ErrorModel errorModel = new ErrorModel(specificDAOFactory);
+        for (ProteinReferenceWithProtein protein : proteins)
+        {
+            if (errorModel.passProtein(protein, falseDiscoveryRate))
+            {
+                List<ProteinAbundance> list = abundancesPerProtein.get(protein.getProteinID());
+                abundanceManager.handle(protein, list);
+            }
+        }
+        return abundanceManager;
+    }
+
+    private Map<Long, List<ProteinAbundance>> getAbudancesPerProtein(LongOpenHashSet proteinIDs)
+    {
+        IProteinQueryDAO dao = getSpecificDAOFactory().getProteinQueryDAO();
+        DataSet<ProteinAbundance> dataSet = dao.listProteinWithAbundanceByExperiment(proteinIDs);
+        Map<Long, List<ProteinAbundance>> abundancesPerProtein =
+                new HashMap<Long, List<ProteinAbundance>>();
         try
         {
-            for (ProteinAbundance proteinAbundance : ds2)
+            for (ProteinAbundance proteinAbundance : dataSet)
             {
                 long proteinID = proteinAbundance.getId();
-                List<ProteinAbundance> list = p2a.get(proteinID);
+                List<ProteinAbundance> list = abundancesPerProtein.get(proteinID);
                 if (list == null)
                 {
                     list = new ArrayList<ProteinAbundance>();
-                    p2a.put(proteinID, list);
+                    abundancesPerProtein.put(proteinID, list);
                 }
                 list.add(proteinAbundance);
             }
         } finally
         {
-            ds2.close();
-        }
-        for (ProteinReferenceWithProtein proteinReferenceWithProtein : prs)
-        {
-            ProteinReferenceWithProbability protein = translate(proteinReferenceWithProtein);
-            if (errorModel.passProtein(protein, falseDiscoveryRate))
-            {
-                List<ProteinAbundance> list = p2a.get(proteinReferenceWithProtein.getProteinID());
-                if (list == null)
-                {
-                    abundanceManager.handle(protein);
-                } else
-                {
-                    for (ProteinAbundance proteinAbundance : list)
-                    {
-                        protein.setAbundance(proteinAbundance.getAbundance());
-                        protein.setSamplePermID(proteinAbundance.getSamplePermID());
-                        abundanceManager.handle(protein);
-                    }
-                }
-            }
+            dataSet.close();
         }
-//        DataSet<ProteinReferenceWithProbability> resultSet =
-//                proteinQueryDAO.listProteinsByExperiment(experimentPermID);
-//        try
-//        {
-//            for (ProteinReferenceWithProbability protein : resultSet)
-//            {
-//                if (errorModel.passProtein(protein, falseDiscoveryRate))
-//                {
-//                    abundanceManager.handle(protein);
-//                }
-//            }
-//        } finally
-//        {
-//            resultSet.close();
-//        }
-        return abundanceManager;
-    }
-
-    private ProteinReferenceWithProbability translate(
-            ProteinReferenceWithProtein proteinReferenceWithProtein)
-    {
-        ProteinReferenceWithProbability proteinReferenceWithProbability = new ProteinReferenceWithProbability();
-        proteinReferenceWithProbability.setId(proteinReferenceWithProtein.getId());
-        proteinReferenceWithProbability.setAccessionNumber(proteinReferenceWithProtein.getAccessionNumber());
-        proteinReferenceWithProbability.setDescription(proteinReferenceWithProtein.getDescription());
-        proteinReferenceWithProbability.setCoverage(proteinReferenceWithProtein.getCoverage());
-        proteinReferenceWithProbability.setProbability(proteinReferenceWithProtein.getProbability());
-        proteinReferenceWithProbability.setDataSetID(proteinReferenceWithProtein.getDataSetID());
-        return proteinReferenceWithProbability;
+        return abundancesPerProtein;
     }
 
     private static double[] concatenate(double[] array1OrNull, double[] array2OrNull)
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 2e5a22a4d421e8c0b5add212039155f0c1276af1..3eb157ccf0c0ced52cf0d0612d6dc862eb2efdda 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
@@ -28,7 +28,6 @@ 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.ProteinAbundance;
 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.ProteinReferenceWithProbabilityAndPeptide;
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReferenceWithProtein;
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.SampleAbundance;
@@ -44,9 +43,6 @@ public interface IProteinQueryDAO extends BaseQuery
     @Select(sql = "select * from probability_fdr_mappings where dase_id = ?{1}", disconnected = true)
     public DataSet<ProbabilityFDRMapping> getProbabilityFDRMapping(long dataSetID);
     
-    @Select("select blob from protein_view_cache where experiment_perm_id = ?{1}")
-    public byte[] tryToGetCachedProteinView(String experimentPermID);
-    
     @Select("select d.id as data_set_id, p.id as protein_id, probability, coverage, "
             + "pr.id, accession_number, description from protein_references as pr "
             + "left join sequences as s on s.prre_id = pr.id "
@@ -63,19 +59,6 @@ public interface IProteinQueryDAO extends BaseQuery
             + "where p.id = any (?{1})", parameterBindings = { LongSetMapper.class })
     public DataSet<ProteinAbundance> listProteinWithAbundanceByExperiment(LongSet proteinIDs);
     
-    @Select("select pr.id, pr.accession_number, pr.description, d.id as data_set_id, p.probability, " 
-    		+ "   ip.coverage, a.value as abundance, samples.perm_id as sample_perm_id "
-            + "from identified_proteins as ip left join proteins as p on ip.prot_id = p.id "
-            + "left join data_sets as d on p.dase_id = d.id "
-            + "left join experiments as e on d.expe_id = e.id "
-            + "left join sequences as s on ip.sequ_id = s.id "
-            + "left join protein_references as pr on s.prre_id = pr.id "
-            + "left join abundances as a on p.id = a.prot_id "
-            + "left join samples on a.samp_id = samples.id "
-            + "where e.perm_id = ?{1}")
-    public DataSet<ProteinReferenceWithProbability> listProteinsByExperiment(String experimentPermID);
-
-    
     @Select(sql = "select p.dase_id as data_set_id, p.probability, s.prre_id as id, pe.sequence "
             + "from identified_proteins as ip left join sequences as s on ip.sequ_id = s.id "
             + "left join proteins as p on ip.prot_id = p.id "
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/dataaccess/db/migration/MigrationStepFrom002To003.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/dataaccess/db/migration/MigrationStepFrom002To003.java
index 7439043104d50ba0668446452a082f7da2b5605f..ec250df1430b26153ec3f8541cb5d2746c0d6d71 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/dataaccess/db/migration/MigrationStepFrom002To003.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/dataaccess/db/migration/MigrationStepFrom002To003.java
@@ -16,9 +16,6 @@
 
 package ch.systemsx.cisd.openbis.plugin.phosphonetx.server.dataaccess.db.migration;
 
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.ArrayList;
@@ -28,23 +25,17 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.commons.lang.SerializationUtils;
 import org.apache.log4j.Logger;
 import org.springframework.dao.DataAccessException;
 import org.springframework.jdbc.core.JdbcOperations;
 import org.springframework.jdbc.core.ResultSetExtractor;
-import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
 import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
-import org.springframework.jdbc.support.JdbcUtils;
-
-import sun.print.PSPrinterJob.EPSPrinter;
 
 import ch.systemsx.cisd.common.logging.LogCategory;
 import ch.systemsx.cisd.common.logging.LogFactory;
 import ch.systemsx.cisd.dbmigration.java.MigrationStepAdapter;
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.Occurrence;
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.OccurrenceUtil;
-import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReferenceWithProbability;
 
 /**
  * 
@@ -64,7 +55,6 @@ public class MigrationStepFrom002To003 extends MigrationStepAdapter
         List<Object[]> coverageValues = calculateCoverageValues(simpleJdbcTemplate);
         operationLog.info("update " + coverageValues.size() + " identified proteins");
         simpleJdbcTemplate.batchUpdate("update identified_proteins set coverage = ? where id = ?", coverageValues);
-        createProteinView(simpleJdbcTemplate);
     }
     
     private List<Object[]> calculateCoverageValues(SimpleJdbcTemplate simpleJdbcTemplate)
@@ -99,67 +89,6 @@ public class MigrationStepFrom002To003 extends MigrationStepAdapter
         return values;
     }
     
-    private void createProteinView(SimpleJdbcTemplate simpleJdbcTemplate)
-    {
-        List<String> experiments =
-                simpleJdbcTemplate.query("select perm_id from experiments",
-                        new ParameterizedRowMapper<String>()
-                            {
-                                public String mapRow(ResultSet rs, int rowNum) throws SQLException
-                                {
-                                    return rs.getString(1);
-                                }
-                            });
-        operationLog.info("create protein views for " + experiments.size() + " experiments");
-        logMemory();
-        JdbcOperations jdbcOperations = simpleJdbcTemplate.getJdbcOperations();
-        Object[] arguments = new Object[1];
-        for (final String experiment : experiments)
-        {
-            arguments[0] = experiment;
-            List<ProteinReferenceWithProbability> rows = simpleJdbcTemplate.query(
-                    "select pr.id, pr.accession_number, pr.description, d.id, p.probability, "
-                            + "ip.coverage, a.value, samples.perm_id "
-                            + "from identified_proteins as ip "
-                            + "left join proteins as p on ip.prot_id = p.id "
-                            + "left join data_sets as d on p.dase_id = d.id "
-                            + "left join experiments as e on d.expe_id = e.id "
-                            + "left join sequences as s on ip.sequ_id = s.id "
-                            + "left join protein_references as pr on s.prre_id = pr.id "
-                            + "left join abundances as a on p.id = a.prot_id "
-                            + "left join samples on a.samp_id = samples.id "
-                            + "where e.perm_id = ?", new ParameterizedRowMapper<ProteinReferenceWithProbability>()
-                                {
-
-                                    public ProteinReferenceWithProbability mapRow(ResultSet rs,
-                                            int rowNum) throws SQLException
-                                    {
-                                        ProteinReferenceWithProbability protein = new ProteinReferenceWithProbability();
-                                        protein.setId(rs.getLong(1));
-                                        protein.setAccessionNumber(rs.getString(2));
-                                        protein.setDescription(rs.getString(3));
-                                        protein.setDataSetID(rs.getLong(4));
-                                        protein.setProbability(rs.getDouble(5));
-                                        protein.setCoverage(rs.getDouble(6));
-                                        protein.setAbundance(getDoubleOrNull(rs, 7));
-                                        protein.setSamplePermID(rs.getString(8));
-                                        return protein;
-                                    }
-                                }, experiment);
-            operationLog.info("insert " + rows.size() + " rows into protein_view_cache for experiment "
-                    + experiment);
-            byte[] serializedRows = SerializationUtils.serialize((Serializable) rows);
-            simpleJdbcTemplate.update("insert into protein_view_cache (experiment_perm_id, blob) "
-                    + "values(?, ?)", experiment, serializedRows);
-            logMemory();
-        }
-    }
-    private Double getDoubleOrNull(ResultSet rs, int index) throws SQLException
-    {
-        double result = rs.getDouble(index);
-        return rs.wasNull() ? null : result;
-    }
-
     private Map<Long, List<String>> getPeptides(JdbcOperations jdbcOperations)
     {
         final Map<Long, List<String>> peptides = new HashMap<Long, List<String>>();
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/dto/ProteinWithAbundances.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/dto/ProteinWithAbundances.java
index 8a16a8f4bbe98e8143accd2ea357a2727c11691b..4888189e7a8e98833ff7074ee5079bf13b9b53a8 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/dto/ProteinWithAbundances.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/dto/ProteinWithAbundances.java
@@ -16,6 +16,8 @@
 
 package ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto;
 
+import it.unimi.dsi.fastutil.doubles.DoubleArrayList;
+
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Set;
@@ -33,7 +35,7 @@ public class ProteinWithAbundances extends ProteinReference
     
     private double coverage;
     
-    private final Map<Long, double[]> abundances = new LinkedHashMap<Long, double[]>();
+    private final Map<Long, DoubleArrayList> abundances = new LinkedHashMap<Long, DoubleArrayList>();
     
     public double getCoverage()
     {
@@ -47,15 +49,13 @@ public class ProteinWithAbundances extends ProteinReference
     
     public void addAbundanceFor(long sampleID, double abundance)
     {
-        double[] array = abundances.get(sampleID);
-        if (array == null)
+        DoubleArrayList list = abundances.get(sampleID);
+        if (list == null)
         {
-            array = EMPTY_ARRAY;
+            list = new DoubleArrayList();
+            abundances.put(sampleID, list);
         }
-        double[] newArray = new double[array.length + 1];
-        System.arraycopy(array, 0, newArray, 0, array.length);
-        newArray[array.length] = abundance;
-        abundances.put(sampleID, newArray);
+        list.add(abundance);
     }
     
     public Set<Long> getSampleIDs()
@@ -65,7 +65,7 @@ public class ProteinWithAbundances extends ProteinReference
     
     public double[] getAbundancesForSample(long sampleID)
     {
-        double[] values = abundances.get(sampleID);
-        return values == null ? EMPTY_ARRAY : values;
+        DoubleArrayList list = abundances.get(sampleID);
+        return list == null ? EMPTY_ARRAY : list.toDoubleArray();
     }
 }
diff --git a/rtd_phosphonetx/source/java/phosphonetx-applicationContext.xml b/rtd_phosphonetx/source/java/phosphonetx-applicationContext.xml
index f07dc588873328398414440d98db65fc985e08c6..6014a32b9ae6cdb42cb4e06a77f1d3331348461f 100644
--- a/rtd_phosphonetx/source/java/phosphonetx-applicationContext.xml
+++ b/rtd_phosphonetx/source/java/phosphonetx-applicationContext.xml
@@ -20,7 +20,7 @@
         <property name="urlHostPart" value="${phosphonetx.database.url-host-part}" />
         <property name="adminUser" value="${phosphonetx.database.admin-user}" />
         <property name="owner" value="${phosphonetx.database.owner}" />
-        <property name="readOnlyGroup" value="openbis_readonly" />
+        <property name="readOnlyGroup" value="phosphonetx_readonly" />
         <property name="password" value="${phosphonetx.database.owner-password}" />
         <property name="adminPassword" value="${phosphonetx.database.admin-password}" />
         <property name="databaseKind" value="${phosphonetx.database.kind}" />
@@ -38,7 +38,6 @@
           class="ch.systemsx.cisd.openbis.plugin.phosphonetx.server.business.BusinessObjectFactory">
         <constructor-arg ref="dao-factory"/>
         <constructor-arg ref="phosphonetx-dao-factory"/>
-        <constructor-arg value="${type-of-caching}"/>
     </bean>      
     
     <!-- 
diff --git a/rtd_phosphonetx/source/java/service.properties b/rtd_phosphonetx/source/java/service.properties
index 05992f1a3441496bfa8e5b9bbfac90fe178f6fd3..15fd9cc901bc7a00c0a2b1f157397d831eea90d5 100644
--- a/rtd_phosphonetx/source/java/service.properties
+++ b/rtd_phosphonetx/source/java/service.properties
@@ -66,5 +66,3 @@ query-database.label = Protein Data
 query-database.databaseEngineCode = ${phosphonetx.database.engine}
 query-database.basicDatabaseName = phosphonetx
 query-database.databaseKind = ${phosphonetx.database.kind}
-
-#type-of-caching = file_system
\ No newline at end of file
diff --git a/rtd_phosphonetx/source/sql/postgresql/003/grant-003.sql b/rtd_phosphonetx/source/sql/postgresql/003/grant-003.sql
new file mode 100644
index 0000000000000000000000000000000000000000..2e85f4fb1f6fcbb7f072005f9d1ab5ad9e1fe713
--- /dev/null
+++ b/rtd_phosphonetx/source/sql/postgresql/003/grant-003.sql
@@ -0,0 +1,18 @@
+-- Granting SELECT privilege to group PHOSPHONETX_READONLY
+
+GRANT SELECT ON TABLE EXPERIMENTS TO GROUP PHOSPHONETX_READONLY;
+GRANT SELECT ON TABLE DATA_SETS TO GROUP PHOSPHONETX_READONLY;
+GRANT SELECT ON TABLE MODIFICATIONS TO GROUP PHOSPHONETX_READONLY;
+GRANT SELECT ON TABLE PEPTIDES TO GROUP PHOSPHONETX_READONLY;
+GRANT SELECT ON TABLE PROTEINS TO GROUP PHOSPHONETX_READONLY;
+GRANT SELECT ON TABLE SAMPLES TO GROUP PHOSPHONETX_READONLY;
+GRANT SELECT ON TABLE SEQUENCES TO GROUP PHOSPHONETX_READONLY;
+GRANT SELECT ON TABLE IDENTIFIED_PROTEINS TO GROUP PHOSPHONETX_READONLY;
+GRANT SELECT ON TABLE ABUNDANCES TO GROUP PHOSPHONETX_READONLY;
+GRANT SELECT ON TABLE PROBABILITY_FDR_MAPPINGS TO GROUP PHOSPHONETX_READONLY;
+GRANT SELECT ON TABLE PROTEIN_REFERENCES TO GROUP PHOSPHONETX_READONLY;
+GRANT SELECT ON TABLE DATABASES TO GROUP PHOSPHONETX_READONLY;
+GRANT SELECT ON TABLE MODIFIED_PEPTIDES TO GROUP PHOSPHONETX_READONLY;
+GRANT SELECT ON TABLE SPECTRUM_REFERENCES TO GROUP PHOSPHONETX_READONLY;
+GRANT SELECT ON TABLE MODIFICATION_FRACTIONS TO GROUP PHOSPHONETX_READONLY;
+GRANT SELECT ON TABLE EVENTS TO GROUP PHOSPHONETX_READONLY;
diff --git a/rtd_phosphonetx/source/sql/postgresql/003/schema-003.png b/rtd_phosphonetx/source/sql/postgresql/003/schema-003.png
new file mode 100755
index 0000000000000000000000000000000000000000..da8cae484122317fee9b24a68fa70670bec52989
Binary files /dev/null and b/rtd_phosphonetx/source/sql/postgresql/003/schema-003.png differ
diff --git a/rtd_phosphonetx/source/sql/postgresql/003/schema-003.sql b/rtd_phosphonetx/source/sql/postgresql/003/schema-003.sql
index 1c4cf2041d7e5a258b885a9ef9fd312bad247fa9..4dd90b2711ca06f202543708fd0d7e3caef40f6c 100755
--- a/rtd_phosphonetx/source/sql/postgresql/003/schema-003.sql
+++ b/rtd_phosphonetx/source/sql/postgresql/003/schema-003.sql
@@ -5,8 +5,8 @@
 /* Project name:                                                          */
 /* Author:                                                                */
 /* Script type:           Database creation script                        */
-/* Created on:            2009-12-07 11:03                                */
-/* Model version:         Version 2009-12-07                              */
+/* Created on:            2010-03-31 16:10                                */
+/* Model version:         Version 2010-03-31                              */
 /* ---------------------------------------------------------------------- */
 
 
@@ -40,18 +40,6 @@ CREATE DOMAIN SPECTRUM_REFERENCE AS CHARACTER VARYING(100);
 /* Tables                                                                 */
 /* ---------------------------------------------------------------------- */
 
-/* ---------------------------------------------------------------------- */
-/* Add table "PROTEIN_VIEW"                                                */
-/* ---------------------------------------------------------------------- */
-
-CREATE TABLE PROTEIN_VIEW_CACHE (
-    ID BIGSERIAL  NOT NULL,
-    EXPERIMENT_PERM_ID CODE  NOT NULL,
-    BLOB BYTEA NOT NULL,
-    CONSTRAINT PK_PROTEIN_VIEW PRIMARY KEY (ID)
-);
-
-
 /* ---------------------------------------------------------------------- */
 /* Add table "EXPERIMENTS"                                                */
 /* ---------------------------------------------------------------------- */
diff --git a/rtd_phosphonetx/source/sql/postgresql/migration/migration-002-003.sql b/rtd_phosphonetx/source/sql/postgresql/migration/migration-002-003.sql
index f2f9b1ecea66eadef5956f2781f1d56aac531eba..639f94657a5f066a34d862909c8e7ded53784ad6 100644
--- a/rtd_phosphonetx/source/sql/postgresql/migration/migration-002-003.sql
+++ b/rtd_phosphonetx/source/sql/postgresql/migration/migration-002-003.sql
@@ -2,10 +2,3 @@
 
 ALTER TABLE IDENTIFIED_PROTEINS ADD COLUMN COVERAGE REAL_NUMBER;
 
-CREATE TABLE PROTEIN_VIEW_CACHE (
-    ID BIGSERIAL  NOT NULL,
-    EXPERIMENT_PERM_ID CODE  NOT NULL,
-    BLOB BYTEA NOT NULL,
-    CONSTRAINT PK_PROTEIN_VIEW PRIMARY KEY (ID)
-);
-
diff --git a/rtd_phosphonetx/source/sql/postgresql/schema.dez b/rtd_phosphonetx/source/sql/postgresql/schema.dez
index db19fe662755156618c655a908252c195dac69d8..f7c4d30fd3339b751c32db2d62671e1fa0e16fad 100755
--- a/rtd_phosphonetx/source/sql/postgresql/schema.dez
+++ b/rtd_phosphonetx/source/sql/postgresql/schema.dez
@@ -4,14 +4,14 @@
 <VERSION>
 <PROJECTSETTINGS>
 <PROJECTFILENAME>D:\User\felmer\dev-workspace\rtd_phosphonetx\source\sql\postgresql\phosphonetx.dez</PROJECTFILENAME>
-<MODIFIED>2009-12-07</MODIFIED>
+<MODIFIED>2010-03-31</MODIFIED>
 <CREATED>2009-06-29</CREATED>
 <CREATED2></CREATED2>
 <PROJECTNAME></PROJECTNAME>
 <DESCRIPTION></DESCRIPTION>
 <AUTHOR></AUTHOR>
 <COPYRIGHT></COPYRIGHT>
-<LASTGENERATEDFILES>N:\group\cisd\phosphonetx\datamodel\schema.sql;N:\group\cisd\phosphonetx\datamodel\drop.sql;C:\Users\felmer\Documents\CreateDBLog_200912073.txt</LASTGENERATEDFILES>
+<LASTGENERATEDFILES>N:\group\cisd\phosphonetx\datamodel\schema.sql;N:\group\cisd\phosphonetx\datamodel\drop.sql;\\d.ethz.ch\dfs\groups\bsse\users\cisd\felmer\Documents\CreateDBLog_201003311.txt</LASTGENERATEDFILES>
 </PROJECTSETTINGS>
 <CONNECTIONSETTINGS>
 <SQLFILE>D:\User\felmer\dev-workspace\rtd_phosphonetx\source\sql\postgresql\001\schema-001.sql</SQLFILE>
@@ -1209,7 +1209,7 @@
 <POSNR>0</POSNR>
 <SCHEMA></SCHEMA>
 <DESC></DESC>
-<ATTRLASTID>5</ATTRLASTID>
+<ATTRLASTID>6</ATTRLASTID>
 <IDXLASTID>1</IDXLASTID>
 <TRGLASTID>1</TRGLASTID>
 <CONLASTID>1</CONLASTID>
@@ -1309,6 +1309,19 @@
 </ATTRIBUTEIDS>
 </NNCON>
 </ATTR>
+<ATTR>
+<NAME>COVERAGE</NAME>
+<ID>6</ID>
+<POSNR>0</POSNR>
+<SCHEMA></SCHEMA>
+<DESC></DESC>
+<DOMAINID>8</DOMAINID>
+<DT>
+<DTLISTNAME>DOUBLE PRECISION</DTLISTNAME>
+<SD>0</SD>
+<INC>1</INC>
+</DT>
+</ATTR>
 </ATTRIBUTES>
 </ENT>
 <ENT>
@@ -2194,6 +2207,7 @@
 </ENT>
 <ENT>
 <NAME>EVENTS</NAME>
+<NAMETEMPLATE>NN_%column%</NAMETEMPLATE>
 <ID>176</ID>
 <POSNR>0</POSNR>
 <SCHEMA></SCHEMA>
@@ -2205,6 +2219,7 @@
 <ATTRIBUTES>
 <ATTR>
 <NAME>LAST_SEEN_DELETION_EVENT_ID</NAME>
+<NAMETEMPLATE>NN_%column%</NAMETEMPLATE>
 <ID>2</ID>
 <POSNR>0</POSNR>
 <SCHEMA></SCHEMA>
@@ -3061,9 +3076,9 @@
 <ENTC>
 <ID>47</ID>
 <DIAGRAMID>1</DIAGRAMID>
-<W>142</W>
-<H>78</H>
-<L>541</L>
+<W>167</W>
+<H>93</H>
+<L>518</L>
 <T>328</T>
 <BRUSH>0,16777215</BRUSH>
 <PEN>0,1,4,0</PEN>
@@ -3087,7 +3102,7 @@
 <ENTC>
 <ID>96</ID>
 <DIAGRAMID>1</DIAGRAMID>
-<W>245</W>
+<W>243</W>
 <H>93</H>
 <L>490</L>
 <T>182</T>
@@ -3305,7 +3320,7 @@
 <FROMRELATIVEX>5000</FROMRELATIVEX>
 <FROMRELATIVEY>5000</FROMRELATIVEY>
 <TORELATIVEX>5000</TORELATIVEX>
-<TORELATIVEY>5000</TORELATIVEY>
+<TORELATIVEY>4194</TORELATIVEY>
 <POINTS>
 <POINT>
 <X>454</X>
@@ -3320,7 +3335,7 @@
 <Y>367</Y>
 </POINT>
 <POINT>
-<X>540</X>
+<X>517</X>
 <Y>367</Y>
 </POINT>
 </POINTS>
@@ -3331,25 +3346,25 @@
 <FONT>Arial,8,,0,clWindowText,0</FONT>
 <PEN>1,1,4,0</PEN>
 <FROMRELATIVEX>2840</FROMRELATIVEX>
-<FROMRELATIVEY>3611</FROMRELATIVEY>
+<FROMRELATIVEY>4259</FROMRELATIVEY>
 <TORELATIVEX>5000</TORELATIVEX>
-<TORELATIVEY>5000</TORELATIVEY>
+<TORELATIVEY>4946</TORELATIVEY>
 <POINTS>
 <POINT>
 <X>735</X>
-<Y>367</Y>
+<Y>374</Y>
 </POINT>
 <POINT>
-<X>705</X>
-<Y>367</Y>
+<X>722</X>
+<Y>374</Y>
 </POINT>
 <POINT>
-<X>705</X>
-<Y>367</Y>
+<X>722</X>
+<Y>374</Y>
 </POINT>
 <POINT>
-<X>683</X>
-<Y>367</Y>
+<X>685</X>
+<Y>374</Y>
 </POINT>
 </POINTS>
 </RELC>
diff --git a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/AbundanceManagerTest.java b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/AbundanceManagerTest.java
index 99d399a15d46a33e09024c784f7bd6ad5903a3f6..9c1b081cfd1aadfff3995142851993e397494c07 100644
--- a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/AbundanceManagerTest.java
+++ b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/AbundanceManagerTest.java
@@ -16,7 +16,9 @@
 
 package ch.systemsx.cisd.openbis.plugin.phosphonetx.server.business;
 
+import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
 
 import org.jmock.Expectations;
@@ -25,7 +27,8 @@ import org.testng.annotations.Test;
 
 import ch.systemsx.cisd.openbis.generic.shared.AbstractServerTestCase;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample;
-import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReferenceWithProbability;
+import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinAbundance;
+import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReferenceWithProtein;
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinWithAbundances;
 
 /**
@@ -64,18 +67,19 @@ public class AbundanceManagerTest extends AbstractServerTestCase
     public void testHandleTwoProteinReferencesButOnlyOneHasAnAbundance()
     {
         prepareSampleIDProvider();
-        ProteinReferenceWithProbability protein1 = new ProteinReferenceWithProbability();
+        ProteinReferenceWithProtein protein1 = new ProteinReferenceWithProtein();
         protein1.setId(1);
         protein1.setAccessionNumber("abc1");
         protein1.setDescription("abc one");
-        protein1.setSamplePermID(PERM_ID1);
-        protein1.setAbundance(1.5);
-        abundanceManager.handle(protein1);
-        ProteinReferenceWithProbability protein2 = new ProteinReferenceWithProbability();
+        ProteinAbundance proteinAbundance = new ProteinAbundance();
+        proteinAbundance.setSampleID(PERM_ID1);
+        proteinAbundance.setAbundance(1.5);
+        abundanceManager.handle(protein1, Collections.singletonList(proteinAbundance));
+        ProteinReferenceWithProtein protein2 = new ProteinReferenceWithProtein();
         protein2.setId(2);
         protein2.setAccessionNumber("abc2");
         protein2.setDescription("abc two");
-        abundanceManager.handle(protein2);
+        abundanceManager.handle(protein2, null);
         
         assertEquals(1, abundanceManager.getSampleIDs().size());
         Collection<ProteinWithAbundances> proteinsWithAbundances = abundanceManager.getProteinsWithAbundances();
@@ -103,11 +107,13 @@ public class AbundanceManagerTest extends AbstractServerTestCase
     public void testHandleProteinReferencesWithManyAbundancesForTwoSamples()
     {
         prepareSampleIDProvider();
-        abundanceManager.handle(createProteinReference(PERM_ID1, 1.5));
-        abundanceManager.handle(createProteinReference(PERM_ID1, 2.25));
-        abundanceManager.handle(createProteinReference(PERM_ID2, 42));
-        abundanceManager.handle(createProteinReference(PERM_ID2, 4.75));
-        abundanceManager.handle(createProteinReference(PERM_ID2, 7.5));
+        ProteinReferenceWithProtein protein1 = new ProteinReferenceWithProtein();
+        protein1.setId(1);
+        protein1.setAccessionNumber("abc1");
+        protein1.setDescription("abc one");
+
+        abundanceManager.handle(protein1, Arrays.asList(a(PERM_ID1, 1.5), a(PERM_ID1, 2.25), a(
+                PERM_ID2, 42), a(PERM_ID2, 4.75), a(PERM_ID2, 7.5)));
         
         assertEquals(2, abundanceManager.getSampleIDs().size());
         Collection<ProteinWithAbundances> proteinsWithAbundances = abundanceManager.getProteinsWithAbundances();
@@ -150,14 +156,11 @@ public class AbundanceManagerTest extends AbstractServerTestCase
             });
     }
 
-    private ProteinReferenceWithProbability createProteinReference(String samplePermID, double abundance)
+    private ProteinAbundance a(String samplePermID, double abundance)
     {
-        ProteinReferenceWithProbability protein1 = new ProteinReferenceWithProbability();
-        protein1.setId(1);
-        protein1.setAccessionNumber("abc1");
-        protein1.setDescription("abc one");
-        protein1.setSamplePermID(samplePermID);
-        protein1.setAbundance(abundance);
-        return protein1;
+        ProteinAbundance protein = new ProteinAbundance();
+        protein.setSampleID(samplePermID);
+        protein.setAbundance(abundance);
+        return protein;
     }
 }
diff --git a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/ProteinInfoTableTest.java b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/ProteinInfoTableTest.java
index 04c35faf6ca32b9353b6bde4928f6953ff9e1aae..6e2d588865e34fd9ea0b8ba58cba63d98f7b13b5 100644
--- a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/ProteinInfoTableTest.java
+++ b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/business/ProteinInfoTableTest.java
@@ -16,11 +16,16 @@
 
 package ch.systemsx.cisd.openbis.plugin.phosphonetx.server.business;
 
+import it.unimi.dsi.fastutil.longs.LongArraySet;
+import it.unimi.dsi.fastutil.longs.LongSet;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Map;
 
+import net.lemnik.eodsql.DataSet;
+
 import org.jmock.Expectations;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -36,14 +41,14 @@ import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.AbundanceCol
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.AggregateFunction;
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinInfo;
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProbabilityFDRMapping;
-import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReferenceWithProbability;
+import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinAbundance;
+import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.dto.ProteinReferenceWithProtein;
 
 /**
  * 
  *
  * @author Franz-Josef Elmer
  */
-@Test(groups="broken")
 public class ProteinInfoTableTest extends AbstractServerTestCase
 {
     private static final double COVERAGE = 0.5;
@@ -52,7 +57,8 @@ public class ProteinInfoTableTest extends AbstractServerTestCase
     private static final long SAMPLE_ID_2 = 102L;
     private static final long SAMPLE_ID_1 = 101L;
     private static final Double ABUNDANCE = new Double(47.11);
-    private static final long PROTEIN_ID = 41L;
+    private static final long PROTEIN_ID = 4141L;
+    private static final long PROTEIN_REFERENCE_ID = 41L;
     private static final String SAMPLE_PERM_ID = "s47-11";
     private static final long SAMPLE_ID = 4711;
     private static final long DATA_SET_ID = 42L;
@@ -101,42 +107,50 @@ public class ProteinInfoTableTest extends AbstractServerTestCase
     @Test
     public void testLoadLeadingToAnEmptyTable()
     {
-        final MockDataSet<ProteinReferenceWithProbability> dataSet =
-                new MockDataSet<ProteinReferenceWithProbability>();
-        prepareLoadDataSet(dataSet);
+        MockDataSet<ProteinReferenceWithProtein> proteinReferences = new MockDataSet<ProteinReferenceWithProtein>();
+        MockDataSet<ProteinAbundance> proteinAbundances = new MockDataSet<ProteinAbundance>();
+        prepareLoadDataSet(proteinReferences, proteinAbundances);
         
         table.load(Arrays.<AbundanceColumnDefinition> asList(), EXPERIMENT_ID,
                 FALSE_DISCOVERY_RATE, AggregateFunction.MEAN, false);
         
         assertEquals(0, table.getProteinInfos().size());
         
-        assertEquals(true, dataSet.hasCloseBeenInvoked());
+        assertEquals(true, proteinReferences.hasCloseBeenInvoked());
+        assertEquals(true, proteinAbundances.hasCloseBeenInvoked());
         context.assertIsSatisfied();
     }
 
     @Test
     public void testSimpleLoad()
     {
-        final MockDataSet<ProteinReferenceWithProbability> dataSet =
-            new MockDataSet<ProteinReferenceWithProbability>();
-        ProteinReferenceWithProbability proteinReference = new ProteinReferenceWithProbability();
+        MockDataSet<ProteinReferenceWithProtein> proteinReferences =
+            new MockDataSet<ProteinReferenceWithProtein>();
+        MockDataSet<ProteinAbundance> abundances = new MockDataSet<ProteinAbundance>();
+        ProteinReferenceWithProtein proteinReference = new ProteinReferenceWithProtein();
         proteinReference.setDataSetID(DATA_SET_ID);
-        proteinReference.setSamplePermID(SAMPLE_PERM_ID);
+        proteinReference.setProteinID(PROTEIN_ID);
         proteinReference.setAccessionNumber(ACCESSION_NUMBER);
-        proteinReference.setId(PROTEIN_ID);
-        proteinReference.setAbundance(ABUNDANCE);
-        dataSet.add(proteinReference);
-        proteinReference = new ProteinReferenceWithProbability();
+        proteinReference.setId(PROTEIN_REFERENCE_ID);
+        proteinReferences.add(proteinReference);
+        ProteinAbundance proteinAbundance = new ProteinAbundance();
+        proteinAbundance.setId(PROTEIN_ID);
+        proteinAbundance.setAbundance(ABUNDANCE);
+        proteinAbundance.setSampleID(SAMPLE_PERM_ID);
+        abundances.add(proteinAbundance);
+        proteinReference = new ProteinReferenceWithProtein();
+        proteinReference.setProteinID(PROTEIN_ID);
+        proteinReference.setId(PROTEIN_REFERENCE_ID);
         proteinReference.setProbability(1);
         proteinReference.setDataSetID(DATA_SET_ID);
-        dataSet.add(proteinReference);
+        proteinReferences.add(proteinReference);
         final MockDataSet<ProbabilityFDRMapping> mappings = new MockDataSet<ProbabilityFDRMapping>();
         mappings.add(new ProbabilityFDRMapping());
         ProbabilityFDRMapping mapping = new ProbabilityFDRMapping();
         mapping.setProbability(1);
         mapping.setFalseDiscoveryRate(1);
         mappings.add(mapping);
-        prepareLoadDataSet(dataSet);
+        prepareLoadDataSet(proteinReferences, abundances);
         context.checking(new Expectations()
             {
                 {
@@ -158,10 +172,10 @@ public class ProteinInfoTableTest extends AbstractServerTestCase
         Collection<ProteinInfo> proteins = table.getProteinInfos();
         assertEquals(1, proteins.size());
         ProteinInfo protein = proteins.iterator().next();
-        assertEquals(PROTEIN_ID, protein.getId().getId().longValue());
+        assertEquals(PROTEIN_REFERENCE_ID, protein.getId().getId().longValue());
         assertEquals(ACCESSION_NUMBER, protein.getAccessionNumber());
         
-        assertEquals(true, dataSet.hasCloseBeenInvoked());
+        assertEquals(true, proteinReferences.hasCloseBeenInvoked());
         assertEquals(true, mappings.hasCloseBeenInvoked());
         context.assertIsSatisfied();
     }
@@ -180,19 +194,27 @@ public class ProteinInfoTableTest extends AbstractServerTestCase
     
     private void checkAggregationType(double expectedAbundance, boolean aggregateOriginal)
     {
-        final MockDataSet<ProteinReferenceWithProbability> dataSet =
-            new MockDataSet<ProteinReferenceWithProbability>();
-        dataSet.add(createProtein(SAMPLE_ID_1, 1));
-        dataSet.add(createProtein(SAMPLE_ID_1, 2));
-        dataSet.add(createProtein(SAMPLE_ID_2, 3));
-        dataSet.add(createProtein(SAMPLE_ID_3, 20));
+        final MockDataSet<ProteinReferenceWithProtein> proteinReferences =
+            new MockDataSet<ProteinReferenceWithProtein>();
+        ProteinReferenceWithProtein proteinReference = new ProteinReferenceWithProtein();
+        proteinReference.setProteinID(PROTEIN_ID);
+        proteinReference.setDataSetID(DATA_SET_ID);
+        proteinReference.setAccessionNumber(ACCESSION_NUMBER);
+        proteinReference.setId(PROTEIN_REFERENCE_ID);
+        proteinReference.setCoverage(COVERAGE);
+        proteinReferences.add(proteinReference);
+        MockDataSet<ProteinAbundance> proteinAbundances = new MockDataSet<ProteinAbundance>();
+        proteinAbundances.add(createProteinAbundance(SAMPLE_ID_1, 1));
+        proteinAbundances.add(createProteinAbundance(SAMPLE_ID_1, 2));
+        proteinAbundances.add(createProteinAbundance(SAMPLE_ID_2, 3));
+        proteinAbundances.add(createProteinAbundance(SAMPLE_ID_3, 20));
         final MockDataSet<ProbabilityFDRMapping> mappings = new MockDataSet<ProbabilityFDRMapping>();
         mappings.add(new ProbabilityFDRMapping());
         ProbabilityFDRMapping mapping = new ProbabilityFDRMapping();
         mapping.setProbability(1);
         mapping.setFalseDiscoveryRate(1);
         mappings.add(mapping);
-        prepareLoadDataSet(dataSet);
+        prepareLoadDataSet(proteinReferences, proteinAbundances);
         context.checking(new Expectations()
             {
                 {
@@ -215,7 +237,7 @@ public class ProteinInfoTableTest extends AbstractServerTestCase
         Collection<ProteinInfo> proteins = table.getProteinInfos();
         assertEquals(1, proteins.size());
         ProteinInfo protein = proteins.iterator().next();
-        assertEquals(PROTEIN_ID, protein.getId().getId().longValue());
+        assertEquals(PROTEIN_REFERENCE_ID, protein.getId().getId().longValue());
         assertEquals(ACCESSION_NUMBER, protein.getAccessionNumber());
         Map<Long, Double> abundances = protein.getAbundances();
         assertEquals(2, abundances.size());
@@ -223,12 +245,14 @@ public class ProteinInfoTableTest extends AbstractServerTestCase
         assertEquals(20.0, abundances.get(SAMPLE_ID_3).doubleValue());
         assertEquals(100 * COVERAGE, protein.getCoverage());
         
-        assertEquals(true, dataSet.hasCloseBeenInvoked());
+        assertEquals(true, proteinReferences.hasCloseBeenInvoked());
         assertEquals(true, mappings.hasCloseBeenInvoked());
         context.assertIsSatisfied();
     }
     
-    private void prepareLoadDataSet(final MockDataSet<ProteinReferenceWithProbability> dataSet)
+    private void prepareLoadDataSet(
+            final MockDataSet<ProteinReferenceWithProtein> proteinReferences,
+            final DataSet<ProteinAbundance> proteinAbundances)
     {
         context.checking(new Expectations()
             {
@@ -238,22 +262,27 @@ public class ProteinInfoTableTest extends AbstractServerTestCase
                     experimentPE.setPermId(EXPERIMENT_PERM_ID);
                     will(returnValue(experimentPE));
 
-                    one(proteinDAO).listProteinsByExperiment(EXPERIMENT_PERM_ID);
-                    will(returnValue(dataSet));
+                    one(proteinDAO).listProteinReferencesByExperiment(EXPERIMENT_PERM_ID);
+                    will(returnValue(proteinReferences));
+                    
+                    LongSet proteinIDs = new LongArraySet();
+                    for (ProteinReferenceWithProtein p : proteinReferences)
+                    {
+                        proteinIDs.add(p.getProteinID());
+                    }
+                    one(proteinDAO).listProteinWithAbundanceByExperiment(proteinIDs);
+                    will(returnValue(proteinAbundances));
                 }
             });
     }
     
-    private ProteinReferenceWithProbability createProtein(long sampleID, double abundance)
+    private ProteinAbundance createProteinAbundance(long sampleID, double abundance)
     {
-        ProteinReferenceWithProbability proteinReference = new ProteinReferenceWithProbability();
-        proteinReference.setDataSetID(DATA_SET_ID);
-        proteinReference.setSamplePermID(PERM_ID_PREFIX + sampleID);
-        proteinReference.setAccessionNumber(ACCESSION_NUMBER);
-        proteinReference.setId(PROTEIN_ID);
-        proteinReference.setAbundance(abundance);
-        proteinReference.setCoverage(COVERAGE);
-        return proteinReference;
+        ProteinAbundance proteinAbundance = new ProteinAbundance();
+        proteinAbundance.setSampleID(PERM_ID_PREFIX + sampleID);
+        proteinAbundance.setId(PROTEIN_ID);
+        proteinAbundance.setAbundance(abundance);
+        return proteinAbundance;
     }
 
 }