<commit_before>package uk.ac.ebi.gxa.netcdf.generator.helper;

import uk.ac.ebi.microarray.atlas.model.ArrayDesign;
import uk.ac.ebi.microarray.atlas.model.ExpressionAnalysis;
import uk.ac.ebi.microarray.atlas.model.Gene;

import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;

/**
 * Javadocs go here!
 *
 * @author <NAME>
 * @date 28-Oct-2009
 */
public class DesignElementSlicer extends CallableSlicer<Void> {
    // required initial resources
    private final ArrayDesign arrayDesign;
    private final DataSlice dataSlice;

    public DesignElementSlicer(ExecutorService service, ArrayDesign arrayDesign, DataSlice dataSlice) {
        super(service);
        this.arrayDesign = arrayDesign;
        this.dataSlice = dataSlice;
    }

    public Void call() throws Exception {
        getLog().debug("Fetching design element data for " + arrayDesign.getAccession());
        Map<Integer, String> designElements =
                getAtlasDAO().getDesignElementsByArrayAccession(arrayDesign.getAccession());
        // and store
        dataSlice.storeDesignElements(designElements);

        // genes for this experiment were prefetched -
        // compare to design elements and store, correctly indexed
        // fetch design elements specific to this array design
        getLog().debug("Indexing gene data by design element ID for " + arrayDesign.getAccession());
        fetchGenesTask.get();
        getLog().debug("Gene data for " + arrayDesign.getAccession() + " acquired");

        Set<Integer> deKeys = dataSlice.getDesignElements().keySet();
        for (Gene gene : fetchGenesTask.get()) {<commit_msg>Do not load arraydesign's elements twice<commit_after>package uk.ac.ebi.gxa.netcdf.generator.helper;

import uk.ac.ebi.microarray.atlas.model.ArrayDesign;
import uk.ac.ebi.microarray.atlas.model.ExpressionAnalysis;
import uk.ac.ebi.microarray.atlas.model.Gene;

import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;

/**
 * Javadocs go here!
 *
 * @author <NAME>
 * @date 28-Oct-2009
 */
public class DesignElementSlicer extends CallableSlicer<Void> {
    // required initial resources
    private final ArrayDesign arrayDesign;
    private final DataSlice dataSlice;

    public DesignElementSlicer(ExecutorService service, ArrayDesign arrayDesign, DataSlice dataSlice) {
        super(service);
        this.arrayDesign = arrayDesign;
        this.dataSlice = dataSlice;
    }

    public Void call() throws Exception {
        getLog().debug("Fetching design element data for " + arrayDesign.getAccession());
        // and store
        dataSlice.storeDesignElements(arrayDesign.getDesignElements());

        // genes for this experiment were prefetched -
        // compare to design elements and store, correctly indexed
        // fetch design elements specific to this array design
        getLog().debug("Indexing gene data by design element ID for " + arrayDesign.getAccession());
        fetchGenesTask.get();
        getLog().debug("Gene data for " + arrayDesign.getAccession() + " acquired");

        Set<Integer> deKeys = dataSlice.getDesignElements().keySet();
        for (Gene gene : fetchGenesTask.get()) {
{'fraction_non_alphanumeric': 0.10226919490208268, 'fraction_numerical': 0.003730183400683867, 'mean_word_length': 3.457063711911357, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, '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': '1121342', 'n_tokens_mistral': 916, 'n_tokens_neox': 881, 'n_words': 223}