All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.maizegenetics.dna.snp.score.MaskAlleleProbability Maven / Gradle / Ivy

Go to download

TASSEL is a software package to evaluate traits associations, evolutionary patterns, and linkage disequilibrium.

The newest version!
/*
 *  MaskAlleleProbability
 * 
 *  Created on May 7, 2016
 */
package net.maizegenetics.dna.snp.score;

import java.util.Collection;
import net.maizegenetics.dna.snp.MaskMatrix;
import net.maizegenetics.dna.snp.byte2d.Byte2D;

/**
 *
 * @author Terry Casstevens
 */
public class MaskAlleleProbability extends AlleleProbability {

    private final AlleleProbability myProbability;
    private final MaskMatrix myMask;

    public MaskAlleleProbability(AlleleProbability probability, MaskMatrix mask) {
        super(probability.numTaxa(), probability.numSites());
        myProbability = probability;
        myMask = mask;
    }

    @Override
    public float value(int taxon, int site, SITE_SCORE_TYPE scoreType) {
        if (myMask.get(taxon, site)) {
            return 0.0f;
        } else {
            return myProbability.value(taxon, site, scoreType);
        }
    }

    @Override
    Collection byteStorage() {
        return null;
    }

    public AlleleProbability base() {
        return myProbability;
    }

    public MaskMatrix mask() {
        return myMask;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy