<commit_before>/*
 * The Gemma project Copyright (c) 2009 University of British Columbia Licensed under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the
 * License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the specific language governing permissions and limitations
 * under the License.
 */
package ubic.gemma.analysis.sequence;

import ubic.gemma.apps.Blat;
import ubic.gemma.model.genome.sequenceAnalysis.BlatResult;

/**
 * Holds parameters for how mapping should be done.
 * 
 * @author paul
 * @version $Id$
 */
public class ProbeMapperConfig {

    /**
     * Sequence identity below which we throw hits away.
     */
    public static final double DEFAULT_IDENTITY_THRESHOLD = 0.80;

    /**
     * BLAT score threshold below which we do not consider hits. This reflects the fraction of aligned bases.
     * 
     * @see Blat for the use of a similar parameter, used to determine the retention of raw Blat results.
     * @see BlatResult for how the score is computed.
     */
    public static final double DEFAULT_SCORE_THRESHOLD = 0.75;

    /**
     * Sequences which hybridize to this many or more sites in the genome are candidates to be considered non-specific.
     * This is used in combination with the REPEAT_FRACTION_MAXIMUM. Note that many sequences which contain repeats
     * nonetheless only align to very few sites in the genome.
     */
    public static final int NON_SPECIFIC_SITE_THRESHOLD = 3;

    /*
     * (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "# Configuration:\n# blatScoreThreshold=" + this.blatScoreThreshold + "\n# identityThreshold="
                + this.identityThreshold + "\n# maximumRepeatFraction=" + this.maximumRepeatFraction
                + "\n# nonSpecificSiteCountThreshold=" + this.nonSpecificSiteCountThreshold
                + "\n# minimumExonOverlapFraction=" + this.minimumExonOverlapFraction + "\n# useRefGene=" + this.useRefGene
                + "\n# useAcembly=" + this.useAcembly + "\n# useNscan=" + this.useNscan + "\n# useEnsembl="
                + this.useEnsembl + "\n# useMrnas=" + this.useMrnas + "\n# useMiRNA=" + this.useMiRNA + "\n# useEsts="
                + this.useEsts + "\n# useKnownGene=" + this.useKnownGene + "\n";

    }

    /**
     * Sequences which have more than this fraction accounted for by repeats (via repeatmasker) will not be examined if
     * they produce multiple alignments to the genome, regardless of the alignment quality.
     */
    public static final double REPEAT_FRACTION_MAXIMUM = 0.3;

    /**
     * Limit below which BLAT results are ignored. If BLAT was run with a threshold higher than this, it won't have any
     * effect.
     */
    private double blatScoreThreshold = DEFAULT_SCORE_THRESHOLD;

    private double identityThreshold = DEFAULT_IDENTITY_THRESHOLD;

    private double maximumRepeatFraction = REPEAT_FRACTION_MAXIMUM;

    public static final double DEFAULT_MINIMUM_EXON_OVERLAP_FRACTION = 0.0;

    /**
     * Sequences that contain more than the maximumRepeatFraction of repeat sequences AND which align to more than this
     * number of sites will be left unmapped. FIXME we might modify this behavior.
     */
    private double nonSpecificSiteCountThreshold = NON_SPECIFIC_SITE_THRESHOLD;

    private boolean useAcembly = true;

    private boolean useEnsembl = true;
<commit_msg>add another configuration control for non-specific probes that are not repeats.<commit_after>/*
 * The Gemma project Copyright (c) 2009 University of British Columbia Licensed under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the
 * License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the specific language governing permissions and limitations
 * under the License.
 */
package ubic.gemma.analysis.sequence;

import ubic.gemma.apps.Blat;
import ubic.gemma.model.genome.sequenceAnalysis.BlatResult;

/**
 * Holds parameters for how mapping should be done.
 * 
 * @author paul
 * @version $Id$
 */
public class ProbeMapperConfig {

    /**
     * Sequence identity below which we throw hits away.
     */
    public static final double DEFAULT_IDENTITY_THRESHOLD = 0.80;

    /**
     * BLAT score threshold below which we do not consider hits. This reflects the fraction of aligned bases.
     * 
     * @see Blat for the use of a similar parameter, used to determine the retention of raw Blat results.
     * @see BlatResult for how the score is computed.
     */
    public static final double DEFAULT_SCORE_THRESHOLD = 0.75;

    /**
     * Sequences which hybridize to this many or more sites in the genome are candidates to be considered non-specific.
     * This is used in combination with the REPEAT_FRACTION_MAXIMUM. Note that many sequences which contain repeats
     * nonetheless only align to very few sites in the genome.
     */
    public static final int NON_SPECIFIC_SITE_THRESHOLD = 3;

    /**
     * Sequences which hybridize to this many or more sites in the genome are candidates to be considered non-specific.
     * This is used even if the sequence does not contain a repeat.
     */
    public static final int NON_REPEAT_NON_SPECIFIC_SITE_THRESHOLD = 10;

    /*
     * (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "# Configuration:\n# blatScoreThreshold=" + this.blatScoreThreshold + "\n# identityThreshold="
                + this.identityThreshold + "\n# maximumRepeatFraction=" + this.maximumRepeatFraction
                + "\n# nonSpecificSiteCountThreshold=" + this.nonSpecificSiteCountThreshold
                + "\n# nonRepeatNonSpecificSiteCountThreshold=" + this.nonRepeatNonSpecificSiteCountThreshold
                + "\n# minimumExonOverlapFraction=" + this.minimumExonOverlapFraction + "\n# useRefGene="
                + this.useRefGene + "\n# useAcembly=" + this.useAcembly + "\n# useNscan=" + this.useNscan
                + "\n# useEnsembl=" + this.useEnsembl + "\n# useMrnas=" + this.useMrnas + "\n# useMiRNA="
                + this.useMiRNA + "\n# useEsts=" + this.useEsts + "\n# useKnownGene=" + this.useKnownGene + "\n";

    }

    public double getNonRepeatNonSpecificSiteCountThreshold() {
        return nonRepeatNonSpecificSiteCountThreshold;
    }

    public void setNonRepeatNonSpecificSiteCountThreshold( double nonRepeatNonSpecificSiteCountThreshold ) {
        this.nonRepeatNonSpecificSiteCountThreshold = nonRepeatNonSpecificSiteCountThreshold;
    }

    /**
     * Sequences which have more than this fraction accounted for by repeats (via repeatmasker) will not be examined if
     * they produce multiple alignments to the genome, regardless of the alignment quality.
     */
    public static final double REPEAT_FRACTION_MAXIMUM = 0.3;

    /**
     * Limit below which BLAT results are ignored. If BLAT was run with a threshold higher than this, it won't have any
     * effect.
     */
    private double blatScoreThreshold = DEFAULT_SCORE_THRESHOLD;

    private double identityThreshold = DEFAULT_IDENTITY_THRESHOLD;

    private double maximumRepeatFraction = REPEAT_FRACTION_MAXIMUM;

    public static final double DEFAULT_MINIMUM_EXON_OVERLAP_FRACTION = 0.0;

    /**
     * Sequences that contain more than the maximumRepeatFraction of repeat sequences AND which align to more than this
     * number of sites will be left unmapped. FIXME we might modify this behavior.
     */
    private double nonSpecificSiteCountThreshold = NON_SPECIFIC_SITE_THRESHOLD;

    /**
     * @see NON_REPEAT_NON_SPECIFIC_SITE_THRESHOLD
     */
    private double nonRepeatNonSpecificSiteCountThreshold = NON_REPEAT_NON_SPECIFIC_SITE_THRESHOLD;

    private boolean useAcembly = true;

    private boolean useEnsembl = true;

{'fraction_non_alphanumeric': 0.07386767844439175, 'fraction_numerical': 0.0047427080863172875, 'mean_word_length': 3.264408493427705, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '832276', 'n_tokens_mistral': 2427, 'n_tokens_neox': 2278, 'n_words': 843}