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

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

Go to download

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

The newest version!
/*
 *  ReferenceProbability
 */
package net.maizegenetics.dna.snp.score;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import net.maizegenetics.dna.snp.byte2d.Byte2D;

/**
 *
 * @author Terry Casstevens
 */
public class ReferenceProbability implements SiteScore {

    private final Byte2D myStorage;
    private final int myNumTaxa;
    private final int myNumSites;

    ReferenceProbability(Byte2D value) {
        myStorage = value;
        myNumTaxa = myStorage.numTaxa();
        myNumSites = myStorage.numSites();
    }
    
    ReferenceProbability(int numTaxa, int numSites) {
        myStorage = null;
        myNumTaxa = numTaxa;
        myNumSites = numSites;
    }

    public float value(int taxon, int site) {
        return SiteScoreUtil.byteToFloatPercentage(myStorage.valueForAllele(taxon, site));
    }

    Byte2D byteStorage() {
        return myStorage;
    }

    @Override
    public Set siteScoreTypes() {
        return new HashSet<>(Arrays.asList(SITE_SCORE_TYPE.Dosage));
    }

    @Override
    public int numTaxa() {
        return myNumTaxa;
    }

    @Override
    public int numSites() {
        return myNumSites;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy