<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package de.charite.compbio.exomiser.priority;

import de.charite.compbio.exomiser.exception.ExomizerInitializationException;
import de.charite.compbio.exomiser.priority.util.DataMatrix;
import de.charite.compbio.exomiser.util.ExomiserSettings;
import jannovar.common.ModeOfInheritance;
import java.nio.file.Path;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.sql.DataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

/**
 * Factory class for handling creation of FilterType objects.
 *
 * @author <NAME> <<EMAIL>>
 */
@Component
public class PriorityFactory {

    private static final Logger logger = LoggerFactory.getLogger(PriorityFactory.class);

    @Autowired
    private DataSource dataSource;
    @Autowired
    @Lazy
    private DataMatrix randomWalkMatrix;
    @Autowired
    private Path phenomizerDataDirectory;
    @Autowired
    private Path hpoOntologyFilePath;
    @Autowired
    private Path hpoAnnotationFilePath;
    
    public PriorityFactory() {
    }

    public PriorityFactory(DataSource dataSource) {
        this.dataSource = dataSource;
    }
    public List<Priority> makePrioritisers(ExomiserSettings exomiserSettings) {
        
        String disease = exomiserSettings.getDiseaseId();
        String candidateGene = exomiserSettings.getCandidateGene();
        List<String> hpoIds = exomiserSettings.getHpoIds();
        List<Integer> entrezSeedGenes = exomiserSettings.getSeedGeneList();
        
        List<Priority> genePriorityList = new ArrayList<>();
        //TODO: these chaps are usually specified implicitly - perhaps they should be different types of ExomiserSettings?
        //probably better as a specific type of Exomiser - either a RareDiseaseExomiser or DefaultExomiser. These might be badly named as the OMIM proritiser is currently the default.
        //InheritancePriority ALWAYS runs but uses a default InheritanceMode.UNSPECIFIED<commit_msg>Reomved @Lazy from DataMatrix in PriorityFactory as this was passing in an empty DataMatrix to the prioritiser causing NPE.  <commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package de.charite.compbio.exomiser.priority;

import de.charite.compbio.exomiser.priority.util.DataMatrix;
import de.charite.compbio.exomiser.util.ExomiserSettings;
import jannovar.common.ModeOfInheritance;
import java.nio.file.Path;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.sql.DataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

/**
 * Factory class for handling creation of FilterType objects.
 *
 * @author <NAME> <<EMAIL>>
 */
@Component
public class PriorityFactory {

    private static final Logger logger = LoggerFactory.getLogger(PriorityFactory.class);

    @Autowired
    private DataSource dataSource;
    @Autowired
    private DataMatrix randomWalkMatrix;
    @Autowired
    private Path phenomizerDataDirectory;
    @Autowired
    private Path hpoOntologyFilePath;
    @Autowired
    private Path hpoAnnotationFilePath;
    
    public PriorityFactory() {
    }

    public PriorityFactory(DataSource dataSource) {
        this.dataSource = dataSource;
    }
    public List<Priority> makePrioritisers(ExomiserSettings exomiserSettings) {
        
        String disease = exomiserSettings.getDiseaseId();
        String candidateGene = exomiserSettings.getCandidateGene();
        List<String> hpoIds = exomiserSettings.getHpoIds();
        List<Integer> entrezSeedGenes = exomiserSettings.getSeedGeneList();
        
        List<Priority> genePriorityList = new ArrayList<>();
        //TODO: these chaps are usually specified implicitly - perhaps they should be different types of ExomiserSettings?
        //probably better as a specific type of Exomiser - either a RareDiseaseExomiser or DefaultExomiser. These might be badly named as the OMIM proritiser is currently the default.
        //InheritancePriority ALWAYS runs but uses a default InheritanceMode.UNSPECIFIED
{'fraction_non_alphanumeric': 0.0747800586510264, 'fraction_numerical': 0.0008378718056137411, 'mean_word_length': 4.167748917748917, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '142930', 'n_tokens_mistral': 1332, 'n_tokens_neox': 1314, 'n_words': 373}