Search in sources :

Example 16 with Sample

use of function.genotype.base.Sample in project atav by igm-team.

the class ListSiblingComphet method doOutput.

private void doOutput(ArrayList<CompHetOutput> geneOutputList) {
    StringBuilder sb = new StringBuilder();
    int outputSize = geneOutputList.size();
    CompHetOutput output1, output2;
    for (int i = 0; i < outputSize - 1; i++) {
        output1 = geneOutputList.get(i);
        for (int j = i + 1; j < outputSize; j++) {
            output2 = geneOutputList.get(j);
            for (Family family : FamilyManager.getList()) {
                for (int c1 = 0; c1 < family.getChildList().size() - 1; c1++) {
                    for (int c2 = c1 + 1; c2 < family.getChildList().size(); c2++) {
                        Sample child1 = family.getChildList().get(c1);
                        Sample child2 = family.getChildList().get(c2);
                        // child1 trio comp het flag
                        String child1Flag = getTrioCompHetFlag(output1, output2, child1, family.getMother(), family.getFather());
                        // child2 trio comp het flag
                        String child2Flag = getTrioCompHetFlag(output1, output2, child2, family.getMother(), family.getFather());
                        // sibling comp het flag
                        String flag = getFlag(child1Flag, child2Flag);
                        doOutput(sb, output1, output2, child1, child1Flag, child2, child2Flag, flag);
                    }
                }
            }
        }
    }
}
Also used : Sample(function.genotype.base.Sample)

Example 17 with Sample

use of function.genotype.base.Sample in project atav by igm-team.

the class TrioManager method getCoOccurrenceFreq.

/*
     * The number of people who have BOTH of the variants divided by the total
     * number of covered people. freq[0] Frequency of Variant #1 & #2
     * (co-occurance) in cases. freq[1] Frequency of Variant #1 & #2
     * (co-occurance) in ctrls
     */
public static double[] getCoOccurrenceFreq(TrioOutput output1, TrioOutput output2) {
    double[] freq = new double[2];
    int quanlifiedCaseCount = 0, qualifiedCtrlCount = 0;
    int totalCaseCount = 0, totalCtrlCount = 0;
    for (Sample sample : SampleManager.getList()) {
        if (sample.getName().equals(output1.fatherName) || // ignore parents trio
        sample.getName().equals(output1.motherName)) {
            continue;
        }
        boolean isCoQualifiedGeno = isCoQualifiedGeno(output1, output2, sample.getIndex());
        if (sample.isCase()) {
            totalCaseCount++;
            if (isCoQualifiedGeno) {
                quanlifiedCaseCount++;
            }
        } else {
            totalCtrlCount++;
            if (isCoQualifiedGeno) {
                qualifiedCtrlCount++;
            }
        }
    }
    freq[Index.CTRL] = MathManager.devide(qualifiedCtrlCount, totalCtrlCount);
    freq[Index.CASE] = MathManager.devide(quanlifiedCaseCount, totalCaseCount);
    return freq;
}
Also used : Sample(function.genotype.base.Sample)

Example 18 with Sample

use of function.genotype.base.Sample in project atav by igm-team.

the class TrioManager method initTriosFromInputSamples.

private static void initTriosFromInputSamples() {
    for (Sample sample : SampleManager.getList()) {
        if (sample.isCase() && !sample.getPaternalId().equals("0") && !sample.getMaternalId().equals("0") && !sample.getPaternalId().equals(sample.getMaternalId())) {
            Trio trio = new Trio(sample);
            if (trio.isValid()) {
                trioList.add(trio);
                parentIdSet.add(trio.getFatherId());
                parentIdSet.add(trio.getMotherId());
            }
        }
    }
    if (trioList.isEmpty()) {
        ErrorManager.print("Missing trio from sample file.", ErrorManager.INPUT_PARSING);
    } else {
        LogManager.writeAndPrint("Total trios: " + trioList.size());
    }
}
Also used : Sample(function.genotype.base.Sample)

Example 19 with Sample

use of function.genotype.base.Sample in project atav by igm-team.

the class TrioOutput method deleteSampleGeno.

public void deleteSampleGeno(int id) {
    if (id != Data.NA) {
        Sample sample = SampleManager.getMap().get(id);
        int geno = calledVar.getGenotype(sample.getIndex());
        int type = getGenoType(geno, sample);
        deleteSampleGeno(type, sample.getPheno());
        genoCount[Index.MISSING][sample.getPheno()]++;
    }
}
Also used : Sample(function.genotype.base.Sample)

Example 20 with Sample

use of function.genotype.base.Sample in project atav by igm-team.

the class TrioOutput method addSampleGeno.

public void addSampleGeno(int id) {
    if (id != Data.NA) {
        Sample sample = SampleManager.getMap().get(id);
        int geno = calledVar.getGenotype(sample.getIndex());
        int type = getGenoType(geno, sample);
        addSampleGeno(type, sample.getPheno());
        genoCount[Index.MISSING][sample.getPheno()]--;
    }
}
Also used : Sample(function.genotype.base.Sample)

Aggregations

Sample (function.genotype.base.Sample)29 HashMap (java.util.HashMap)2 SimpleRegression (org.apache.commons.math3.stat.regression.SimpleRegression)2 BufferedWriter (java.io.BufferedWriter)1 File (java.io.File)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 RandomAccessFile (java.io.RandomAccessFile)1 SummaryStatistics (org.apache.commons.math3.stat.descriptive.SummaryStatistics)1