<commit_before>package uk.ac.ebi.eva.commons.models.converters.data;

import com.mongodb.DBObject;
import org.opencb.biodata.models.variant.stats.VariantGlobalStats;
import org.springframework.core.convert.converter.Converter;

public class DbObjectToVariantGlobalStatsConverter implements Converter<DBObject, VariantGlobalStats> {

    public final static String NUMSAMPLES_FIELD = "nSamp";
    public final static String NUMVARIANTS_FIELD = "nVar";
    public final static String NUMSNPS_FIELD = "nSnp";
    public final static String NUMINDELS_FIELD = "nIndel";
    public final static String NUMSTRUCTURAL_FIELD = "nSv";
    public final static String NUMPASSFILTERS_FIELD = "nPass";
    public final static String NUMTRANSITIONS_FIELD = "nTi";
    public final static String NUMTRANSVERSIONS_FIELD = "nTv";
    public final static String MEANQUALITY_FIELD = "meanQ";

    @Override
    public VariantGlobalStats convert(DBObject statsObject) {
        return new VariantGlobalStats(
                (int) statsObject.get(NUMVARIANTS_FIELD),
                (int) statsObject.get(NUMSAMPLES_FIELD),
                (int) statsObject.get(NUMSNPS_FIELD),
                (int) statsObject.get(NUMINDELS_FIELD),
                0, // TODO Add structural variants to schema!
                (int) statsObject.get(NUMPASSFILTERS_FIELD),
                (int) statsObject.get(NUMTRANSITIONS_FIELD),
                (int) statsObject.get(NUMTRANSVERSIONS_FIELD),
                -1,
                ((Integer) statsObject.get(MEANQUALITY_FIELD)).floatValue(),
                null
        );
    }
}
<commit_msg>Change back to cast to Double, in mongo it is stored as a double<commit_after>package uk.ac.ebi.eva.commons.models.converters.data;

import com.mongodb.DBObject;
import org.opencb.biodata.models.variant.stats.VariantGlobalStats;
import org.springframework.core.convert.converter.Converter;

public class DbObjectToVariantGlobalStatsConverter implements Converter<DBObject, VariantGlobalStats> {

    public final static String NUMSAMPLES_FIELD = "nSamp";
    public final static String NUMVARIANTS_FIELD = "nVar";
    public final static String NUMSNPS_FIELD = "nSnp";
    public final static String NUMINDELS_FIELD = "nIndel";
    public final static String NUMSTRUCTURAL_FIELD = "nSv";
    public final static String NUMPASSFILTERS_FIELD = "nPass";
    public final static String NUMTRANSITIONS_FIELD = "nTi";
    public final static String NUMTRANSVERSIONS_FIELD = "nTv";
    public final static String MEANQUALITY_FIELD = "meanQ";

    @Override
    public VariantGlobalStats convert(DBObject statsObject) {
        return new VariantGlobalStats(
                (int) statsObject.get(NUMVARIANTS_FIELD),
                (int) statsObject.get(NUMSAMPLES_FIELD),
                (int) statsObject.get(NUMSNPS_FIELD),
                (int) statsObject.get(NUMINDELS_FIELD),
                0, // TODO Add structural variants to schema!
                (int) statsObject.get(NUMPASSFILTERS_FIELD),
                (int) statsObject.get(NUMTRANSITIONS_FIELD),
                (int) statsObject.get(NUMTRANSVERSIONS_FIELD),
                -1,
                ((Double) statsObject.get(MEANQUALITY_FIELD)).floatValue(),
                null
        );
    }
}

{'fraction_non_alphanumeric': 0.08292533659730722, 'fraction_numerical': 0.0012239902080783353, 'mean_word_length': 3.0964912280701755, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7595341', 'n_tokens_mistral': 982, 'n_tokens_neox': 947, 'n_words': 215}