<commit_before>package uk.ac.ebi.atlas.experimentpage.differential;

import com.google.common.collect.*;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import uk.ac.ebi.atlas.experimentpage.context.DifferentialRequestContext;
import uk.ac.ebi.atlas.experimentpage.context.DifferentialRequestContextFactory;
import uk.ac.ebi.atlas.model.AssayGroup;
import uk.ac.ebi.atlas.model.experiment.differential.*;
import uk.ac.ebi.atlas.model.experiment.differential.microarray.MicroarrayExperimentConfiguration;
import uk.ac.ebi.atlas.model.experiment.differential.microarray.MicroarrayExpression;
import uk.ac.ebi.atlas.model.experiment.differential.microarray.MicroarrayProfile;
import uk.ac.ebi.atlas.resource.MockDataFileHub;
import uk.ac.ebi.atlas.trader.ConfigurationTrader;
import uk.ac.ebi.atlas.web.DifferentialRequestPreferences;

import java.util.*;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class DifferentialPathwaysComparisonServiceTest {

    @Mock
    private DifferentialRequestContextFactory mockDifferentialRequestContextFactory;
    @Mock
    private DifferentialRequestContext mockRequestContext;
    @Mock
    private DifferentialRequestPreferences mockDifferentialRequestPreferences;
    @Mock
    private ConfigurationTrader mockConfigurationTrader;
    @Mock
    private MicroarrayExperimentConfiguration mockMicroarrayExperimentConfiguration;
    @Mock
    private DifferentialProfilesHeatMap mockDifferentialProfilesHeatMap;
    @Mock
    private DifferentialExperiment mockDifferentialExperiment;

    private DifferentialPathwaysComparisonService subject;

    private AssayGroup referenceAssay1 = new AssayGroup("g1", "assay1");
    private AssayGroup testAssay1 = new AssayGroup("g2", "assay2");
    private AssayGroup referenceAssay2 = new AssayGroup("g3", "assay3");
    private AssayGroup testAssay2 = new AssayGroup("g4", "assay41", "assay42");

    private Contrast c1 = new Contrast("g3_g1", null, referenceAssay1, testAssay1, "first contrast");
    private Contrast c2 = new Contrast("g3_g2", null, referenceAssay2, testAssay2, "second contrast");

    private String[] c1s1 = new String[]{"Term", "Accession", "Genes (tot)", "Stat (non-dir.) p", "p adj (non-dir.)"};
    private String[] c1s2 = new String[]{"R-MMU-109581", "Apoptosis", "45", "0.535169358108118", "1"};
    private String[] c1s3 = new String[]{"R-MMU-109606", "Apoptosis", "16", "0.535169358108118", "1"};
    private String[] c1s4 = new String[]{"R-MMU-109688", "Apoptosis", "23", "0.535169358108118", "0.951294722034645"};
    private String[] c1s5 = new String[]{"R-MMU-110056", "Apoptosis", "10", "0.535169358108118", "0.7611075912506"};
    private String[] c1s6 = new String[]{"R-MMU-110362", "Apoptosis", "45", "0.535169358108118", "1"};
    private String[] c1s7 = new String[]{"R-MMU-111996", "Apoptosis", "45", "0.535169358108118", "1"};
    private String[] c1s8 = new String[]{"R-MMU-112040", "Apoptosis", "45", "0.535169358108118", "0.7611075912506"};
    private String[] c1s9 = new String[]{"R-MMU-1362300", "Apoptosis", "45", "0.535169358108118", "1"};
    private String[] c1s10 = new String[]{"R-MMU-141430", "Apoptosis", "45", "0.535169358108118", "0.87881981279076"};
    private String[] c1s11 = new String[]{"R-MMU-170822", "Apoptosis", "45", "0.535169358108118", "1"};

    private String[] c2s1 = new String[]{"Term", "Accession", "Genes (tot)", "Stat (non-dir.) p", "p adj (non-dir.)"};
    private String[] c2s2 = new String[]{"R-MMU-416482", "G alpha (12/13) signalling events", "33", "0.538397547287844", "0.0191488220970447"};
    private String[] c2s3 = new String[]{"R-MMU-2132295", "Apoptosis", "16", "0.535169358108118", "0.0280433635326222"};
    private String[] c2s4 = new String[]{"R-MMU-5620924", "Apoptosis", "23", "0.535169358108118", "0.0280433635326222"};
    private String[] c2s5 = new String[]{"R-MMU-397014", "Muscle contraction", "10", "0.535169358108118", "0.0280433635326222"};
    private String[] c2s6 = new String[]{"R-MMU-193648", "NRAGE signals death through JNK", "45", "0.535169358108118", "0.0280433635326222"};
    private String[] c2s7 = new String[]{"R-MMU-373760", "Apoptosis", "45", "0.535169358108118", "0.0280433635326222"};
    private String[] c2s8 = new String[]{"R-MMU-199418", "Negative regulation of the PI3K/AKT network", "45", "0.535169358108118", "0.0436946551249873"};
    private String[] c2s9 = new String[]{"R-MMU-2029480", "Fcgamma receptor (FCGR) dependent phagocytosis", "45", "0.535169358108118", "0.0436946551249873"};
    private String[] c2s10 = new String[]{"R-MMU-5654741", "Signaling by FGFR3", "45", "0.535169358108118", "0.0436946551249873"};
    private String[] c2s11 = new String[]{"R-MMU-1483206", "Apoptosis", "45", "0.535169358108118", "0.0436946551249873"};


    @Before
    public void setUp() throws Exception {
        MockDataFileHub mockDataFileHub = new MockDataFileHub();<commit_msg>Changed instantiation of MockDataFileHub in the test<commit_after>package uk.ac.ebi.atlas.experimentpage.differential;

import com.google.common.collect.*;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import uk.ac.ebi.atlas.experimentpage.context.DifferentialRequestContext;
import uk.ac.ebi.atlas.experimentpage.context.DifferentialRequestContextFactory;
import uk.ac.ebi.atlas.model.AssayGroup;
import uk.ac.ebi.atlas.model.experiment.differential.*;
import uk.ac.ebi.atlas.model.experiment.differential.microarray.MicroarrayExperimentConfiguration;
import uk.ac.ebi.atlas.model.experiment.differential.microarray.MicroarrayExpression;
import uk.ac.ebi.atlas.model.experiment.differential.microarray.MicroarrayProfile;
import uk.ac.ebi.atlas.resource.MockDataFileHub;
import uk.ac.ebi.atlas.trader.ConfigurationTrader;
import uk.ac.ebi.atlas.web.DifferentialRequestPreferences;

import java.util.*;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class DifferentialPathwaysComparisonServiceTest {

    @Mock
    private DifferentialRequestContextFactory mockDifferentialRequestContextFactory;
    @Mock
    private DifferentialRequestContext mockRequestContext;
    @Mock
    private DifferentialRequestPreferences mockDifferentialRequestPreferences;
    @Mock
    private ConfigurationTrader mockConfigurationTrader;
    @Mock
    private MicroarrayExperimentConfiguration mockMicroarrayExperimentConfiguration;
    @Mock
    private DifferentialProfilesHeatMap mockDifferentialProfilesHeatMap;
    @Mock
    private DifferentialExperiment mockDifferentialExperiment;

    private DifferentialPathwaysComparisonService subject;

    private AssayGroup referenceAssay1 = new AssayGroup("g1", "assay1");
    private AssayGroup testAssay1 = new AssayGroup("g2", "assay2");
    private AssayGroup referenceAssay2 = new AssayGroup("g3", "assay3");
    private AssayGroup testAssay2 = new AssayGroup("g4", "assay41", "assay42");

    private Contrast c1 = new Contrast("g3_g1", null, referenceAssay1, testAssay1, "first contrast");
    private Contrast c2 = new Contrast("g3_g2", null, referenceAssay2, testAssay2, "second contrast");

    private String[] c1s1 = new String[]{"Term", "Accession", "Genes (tot)", "Stat (non-dir.) p", "p adj (non-dir.)"};
    private String[] c1s2 = new String[]{"R-MMU-109581", "Apoptosis", "45", "0.535169358108118", "1"};
    private String[] c1s3 = new String[]{"R-MMU-109606", "Apoptosis", "16", "0.535169358108118", "1"};
    private String[] c1s4 = new String[]{"R-MMU-109688", "Apoptosis", "23", "0.535169358108118", "0.951294722034645"};
    private String[] c1s5 = new String[]{"R-MMU-110056", "Apoptosis", "10", "0.535169358108118", "0.7611075912506"};
    private String[] c1s6 = new String[]{"R-MMU-110362", "Apoptosis", "45", "0.535169358108118", "1"};
    private String[] c1s7 = new String[]{"R-MMU-111996", "Apoptosis", "45", "0.535169358108118", "1"};
    private String[] c1s8 = new String[]{"R-MMU-112040", "Apoptosis", "45", "0.535169358108118", "0.7611075912506"};
    private String[] c1s9 = new String[]{"R-MMU-1362300", "Apoptosis", "45", "0.535169358108118", "1"};
    private String[] c1s10 = new String[]{"R-MMU-141430", "Apoptosis", "45", "0.535169358108118", "0.87881981279076"};
    private String[] c1s11 = new String[]{"R-MMU-170822", "Apoptosis", "45", "0.535169358108118", "1"};

    private String[] c2s1 = new String[]{"Term", "Accession", "Genes (tot)", "Stat (non-dir.) p", "p adj (non-dir.)"};
    private String[] c2s2 = new String[]{"R-MMU-416482", "G alpha (12/13) signalling events", "33", "0.538397547287844", "0.0191488220970447"};
    private String[] c2s3 = new String[]{"R-MMU-2132295", "Apoptosis", "16", "0.535169358108118", "0.0280433635326222"};
    private String[] c2s4 = new String[]{"R-MMU-5620924", "Apoptosis", "23", "0.535169358108118", "0.0280433635326222"};
    private String[] c2s5 = new String[]{"R-MMU-397014", "Muscle contraction", "10", "0.535169358108118", "0.0280433635326222"};
    private String[] c2s6 = new String[]{"R-MMU-193648", "NRAGE signals death through JNK", "45", "0.535169358108118", "0.0280433635326222"};
    private String[] c2s7 = new String[]{"R-MMU-373760", "Apoptosis", "45", "0.535169358108118", "0.0280433635326222"};
    private String[] c2s8 = new String[]{"R-MMU-199418", "Negative regulation of the PI3K/AKT network", "45", "0.535169358108118", "0.0436946551249873"};
    private String[] c2s9 = new String[]{"R-MMU-2029480", "Fcgamma receptor (FCGR) dependent phagocytosis", "45", "0.535169358108118", "0.0436946551249873"};
    private String[] c2s10 = new String[]{"R-MMU-5654741", "Signaling by FGFR3", "45", "0.535169358108118", "0.0436946551249873"};
    private String[] c2s11 = new String[]{"R-MMU-1483206", "Apoptosis", "45", "0.535169358108118", "0.0436946551249873"};


    @Before
    public void setUp() throws Exception {
        MockDataFileHub mockDataFileHub = MockDataFileHub.create();
{'fraction_non_alphanumeric': 0.15542999425397433, 'fraction_numerical': 0.15361041945987358, 'mean_word_length': 5.605313092979127, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3234511', 'n_tokens_mistral': 4646, 'n_tokens_neox': 3599, 'n_words': 738}