<commit_before>package ae3.model;

import ae3.service.AtlasStatisticsQueryService;
import ae3.service.structuredquery.UpdownCounter;
import uk.ac.ebi.gxa.utils.EfvTree;

import java.util.*;

public class ExperimentalFactor {
    public int RESULT_ALL_VALUES_SIZE = 6;
    public static final int NONDE_COUNTS_FOR_ALL_EFVS = -1;
    private AtlasGene gene;
    private Collection<String> omittedEfs = new ArrayList<String>();
    private String name;
    private HashMap<Long, String> experimentAccessions = new HashMap<Long, String>();
    private AtlasStatisticsQueryService atlasStatisticsQueryService;

    public ExperimentalFactor(AtlasGene gene, String name, Collection<String> omittedEfs, AtlasStatisticsQueryService atlasStatisticsQueryService) {
        this.name = name;
        this.gene = gene;
        this.omittedEfs.addAll(omittedEfs);
        this.atlasStatisticsQueryService = atlasStatisticsQueryService;
    }

    public String getName() {
        return this.name;
    }

    public List<EfvTree.EfEfv<UpdownCounter>> getValues() {
        List<EfvTree.EfEfv<UpdownCounter>> result = new ArrayList<EfvTree.EfEfv<UpdownCounter>>();

        for (EfvTree.EfEfv<UpdownCounter> f : gene.getHeatMap(this.name, omittedEfs, atlasStatisticsQueryService, true, NONDE_COUNTS_FOR_ALL_EFVS).getNameSortedList()) {
            if (f.getEf().equals(this.name)) {
                result.add(f);
            }
        }

        return result;
    }

    public List<EfvTree.EfEfv<UpdownCounter>> getTopValues() {
        List<EfvTree.EfEfv<UpdownCounter>> result = new ArrayList<EfvTree.EfEfv<UpdownCounter>>();

        for (EfvTree.EfEfv<UpdownCounter> f : gene.getHeatMap(this.name, omittedEfs, atlasStatisticsQueryService, true, RESULT_ALL_VALUES_SIZE).getNameSortedList()) {
            if (f.getEf().equals(this.name)) {
                if (result.size() < RESULT_ALL_VALUES_SIZE) {
                    result.add(f);
                }
            }
        }<commit_msg>Ticket #2752 - Modified to sort efvs on gene page by their experiment counts rather than alphabetically.<commit_after>package ae3.model;

import ae3.service.AtlasStatisticsQueryService;
import ae3.service.structuredquery.UpdownCounter;
import uk.ac.ebi.gxa.utils.EfvTree;

import java.util.*;

public class ExperimentalFactor {
    public int RESULT_ALL_VALUES_SIZE = 6;
    public static final int NONDE_COUNTS_FOR_ALL_EFVS = -1;
    private AtlasGene gene;
    private Collection<String> omittedEfs = new ArrayList<String>();
    private String name;
    private HashMap<Long, String> experimentAccessions = new HashMap<Long, String>();
    private AtlasStatisticsQueryService atlasStatisticsQueryService;

    public ExperimentalFactor(AtlasGene gene, String name, Collection<String> omittedEfs, AtlasStatisticsQueryService atlasStatisticsQueryService) {
        this.name = name;
        this.gene = gene;
        this.omittedEfs.addAll(omittedEfs);
        this.atlasStatisticsQueryService = atlasStatisticsQueryService;
    }

    public String getName() {
        return this.name;
    }

    public List<EfvTree.EfEfv<UpdownCounter>> getValues() {
        List<EfvTree.EfEfv<UpdownCounter>> result = new ArrayList<EfvTree.EfEfv<UpdownCounter>>();

        for (EfvTree.EfEfv<UpdownCounter> f : gene.getHeatMap(this.name, omittedEfs, atlasStatisticsQueryService, true, NONDE_COUNTS_FOR_ALL_EFVS).getValueSortedList()) {
            if (f.getEf().equals(this.name)) {
                result.add(f);
            }
        }

        return result;
    }

    public List<EfvTree.EfEfv<UpdownCounter>> getTopValues() {
        List<EfvTree.EfEfv<UpdownCounter>> result = new ArrayList<EfvTree.EfEfv<UpdownCounter>>();

        for (EfvTree.EfEfv<UpdownCounter> f : gene.getHeatMap(this.name, omittedEfs, atlasStatisticsQueryService, true, RESULT_ALL_VALUES_SIZE).getValueSortedList()) {
            if (f.getEf().equals(this.name)) {
                if (result.size() < RESULT_ALL_VALUES_SIZE) {
                    result.add(f);
                }
            }
        }
{'fraction_non_alphanumeric': 0.09928553830992855, 'fraction_numerical': 0.0034491254003449125, 'mean_word_length': 3.3609022556390977, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 41, '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': '5009089', 'n_tokens_mistral': 1337, 'n_tokens_neox': 1235, 'n_words': 227}