use of com.github.lindenb.jvarkit.tools.burden.MafCalculator in project jvarkit by lindenb.
the class AFBySexChartFactory method visit.
@Override
public void visit(final VariantContext ctx) {
for (final Allele alt : ctx.getAlternateAlleles()) {
final MafCalculator[] mafCalculators = new MafCalculator[PedFile.Sex.values().length];
for (int i = 0; i < mafCalculators.length; ++i) {
mafCalculators[i] = new MafCalculator(alt, ctx.getContig());
}
for (final Genotype gt : ctx.getGenotypes()) {
final PedFile.Sample sample = getPedigree().get(gt.getSampleName());
if (sample == null) {
mafCalculators[PedFile.Sex.Unknown.ordinal()].add(gt, false);
} else {
mafCalculators[sample.getSex().ordinal()].add(gt, sample.isMale());
}
}
for (int i = 0; i < mafCalculators.length; ++i) {
if (mafCalculators[i].isEmpty())
continue;
final Total total = popcount.get(i);
total.num_maf++;
total.sum += mafCalculators[i].getMaf();
}
}
}
use of com.github.lindenb.jvarkit.tools.burden.MafCalculator in project jvarkit by lindenb.
the class AFByPopulationChartFactory method visit.
@Override
public void visit(final VariantContext ctx) {
for (final Allele alt : ctx.getAlternateAlleles()) {
final MafCalculator[] mafCalculators = new MafCalculator[PedFile.Status.values().length];
for (int i = 0; i < mafCalculators.length; ++i) {
mafCalculators[i] = new MafCalculator(alt, ctx.getContig());
}
for (final Genotype gt : ctx.getGenotypes()) {
final PedFile.Sample sample = getPedigree().get(gt.getSampleName());
if (sample == null) {
mafCalculators[PedFile.Status.Unknown.ordinal()].add(gt, false);
} else {
mafCalculators[sample.getStatus().ordinal()].add(gt, sample.isMale());
}
}
for (int i = 0; i < mafCalculators.length; ++i) {
if (mafCalculators[i].isEmpty())
continue;
final Total total = popcount.get(i);
total.num_maf++;
total.sum += mafCalculators[i].getMaf();
}
}
}
Aggregations