<commit_before>/**
 * Copyright © 2011-2013 EMBL - European Bioinformatics Institute
 * 
 * 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 uk.ac.ebi.phenotype.dao;

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

import org.hibernate.HibernateException;

import uk.ac.ebi.phenotype.pojo.BiologicalModel;
import uk.ac.ebi.phenotype.pojo.CategoricalControlView;
import uk.ac.ebi.phenotype.pojo.CategoricalGroupKey;
import uk.ac.ebi.phenotype.pojo.CategoricalMutantView;
import uk.ac.ebi.phenotype.pojo.CategoricalResult;
import uk.ac.ebi.phenotype.pojo.Organisation;
import uk.ac.ebi.phenotype.pojo.Parameter;
import uk.ac.ebi.phenotype.pojo.PhenotypeCallSummary;
import uk.ac.ebi.phenotype.pojo.SexType;
import uk.ac.ebi.phenotype.pojo.ZygosityType;

public interface CategoricalStatisticsDAO {

	public List<String> getCategories(Parameter parameter);

	public Long countControl(SexType sex, Parameter parameter, String category, Integer populationId);
	public Long countMutant(SexType sex, ZygosityType zygosity, Parameter parameter, String category, Integer populationId);
	
	public BiologicalModel getControlBiologicalModelByPopulation(Integer populationId);
	public BiologicalModel getMutantBiologicalModelByPopulation(Integer populationId);

	public List<BiologicalModel> getBiologicalModelsByParameterAndGene(Parameter parameter, String accessionId);
	
	public List<BiologicalModel> getBiologicalModelsByParameter(Parameter parameter) ;

	public Double getpValueByParameterAndBiologicalModelAndSexAndZygosity(Parameter parameter, BiologicalModel biologicalModel, SexType sex, ZygosityType zygosity);
	public Double getMaxEffectSizeByParameterAndBiologicalModelAndSexAndZygosity(Parameter parameter, BiologicalModel biologicalModel, SexType sex, ZygosityType zygosity);
	
	public Organisation getOrganisationByPopulation(Integer populationId);
	public List<Integer> getPopulationIdsByParameter(Parameter parameter);
	public List<Integer> getPopulationIdsByParameterAndMutantBiologicalModel(Parameter parameter, BiologicalModel biologicalModel);

	public void saveCategoricalResult(CategoricalResult result);
	public void saveAnnotationAssociation(PhenotypeCallSummary pcs);

	public SexType getSexByPopulation(Integer populationId);
	public List<ZygosityType> getZygositiesByPopulation(Integer populationId);

	public void deleteCategoricalResultByParameter(Parameter parameter) throws HibernateException, SQLException;

	public Integer getPopulationIdByColonySexParameter(String colonyId, SexType sex, Parameter parameter);

	public List<CategoricalGroupKey> getControlCategoricalDataByParameter(Parameter parameter);
	public List<CategoricalGroupKey> getMutantCategoricalDataByParameter(Parameter parameter);

	public Map<Integer, Integer> getOrganisationsByParameter(Parameter parameter);
	public Set<Parameter> getAllCategoricalParametersForProcessing();
	

}<commit_msg>factor out common save method and introduce DAO inheritance for statistics DAOs<commit_after>/**
 * Copyright © 2011-2013 EMBL - European Bioinformatics Institute
 * 
 * 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 uk.ac.ebi.phenotype.dao;

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

import org.hibernate.HibernateException;

import uk.ac.ebi.phenotype.pojo.BiologicalModel;
import uk.ac.ebi.phenotype.pojo.CategoricalGroupKey;
import uk.ac.ebi.phenotype.pojo.Organisation;
import uk.ac.ebi.phenotype.pojo.Parameter;
import uk.ac.ebi.phenotype.pojo.SexType;
import uk.ac.ebi.phenotype.pojo.ZygosityType;

public interface CategoricalStatisticsDAO extends StatisticsDAO {

	public List<String> getCategories(Parameter parameter);

	public Long countControl(SexType sex, Parameter parameter, String category, Integer populationId) throws SQLException;
	public Long countMutant(SexType sex, ZygosityType zygosity, Parameter parameter, String category, Integer populationId) throws SQLException;
	
	public BiologicalModel getControlBiologicalModelByPopulation(Integer populationId);
	public BiologicalModel getMutantBiologicalModelByPopulation(Integer populationId);

	public List<BiologicalModel> getMutantBiologicalModelsByParameterAndGene(Parameter parameter, String accessionId);
	
	public List<BiologicalModel> getBiologicalModelsByParameter(Parameter parameter) ;

	public Double getpValueByParameterAndControlBiologicalModelAndSexAndZygosity(Parameter parameter, BiologicalModel biologicalModel, SexType sex, ZygosityType zygosity);
	
	public Double getpValueByParameterAndMutantBiologicalModelAndSexAndZygosity(Parameter parameter, BiologicalModel biologicalModel, SexType sex, ZygosityType zygosity);
	
	public Double getMaxEffectSizeByParameterAndMutantBiologicalModelAndSexAndZygosity(Parameter parameter, BiologicalModel biologicalModel, SexType sex, ZygosityType zygosity);
	
	public Organisation getOrganisationByPopulation(Integer populationId);
	public List<Integer> getPopulationIdsByParameter(Parameter parameter);
	public List<Integer> getPopulationIdsByParameterAndMutantBiologicalModel(Parameter parameter, BiologicalModel biologicalModel);

	public SexType getSexByPopulation(Integer populationId);
	public List<ZygosityType> getZygositiesByPopulation(Integer populationId);

	public void deleteCategoricalResultByParameter(Parameter parameter) throws HibernateException, SQLException;

	public Integer getPopulationIdByColonySexParameter(String colonyId, SexType sex, Parameter parameter);

	public List<CategoricalGroupKey> getControlCategoricalDataByParameter(Parameter parameter);
	public List<CategoricalGroupKey> getMutantCategoricalDataByParameter(Parameter parameter);

	public Map<Integer, Integer> getOrganisationsByParameter(Parameter parameter);
	
	public  List<Map<String,String>>  getListOfUniqueParametersAndGenes(int start, int length) throws SQLException;
	

}
{'fraction_non_alphanumeric': 0.06478260869565218, 'fraction_numerical': 0.0034782608695652175, 'mean_word_length': 7.426129426129426, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4940550', 'n_tokens_mistral': 1924, 'n_tokens_neox': 1775, 'n_words': 506}