use of function.genotype.base.Sample in project atav by igm-team.
the class CoverageAnalysisBase method outputSampleGeneSummary.
private void outputSampleGeneSummary(Gene gene) {
try {
StringBuilder sb = new StringBuilder();
for (Sample sample : SampleManager.getList()) {
sb.append(sample.getName()).append(",");
sb.append(gene.getName()).append(",");
sb.append(gene.getChr()).append(",");
sb.append(gene.getLength()).append(",");
sb.append(geneSampleCoverage[gene.getIndex()][sample.getIndex()]).append(",");
double ratio = MathManager.devide(geneSampleCoverage[gene.getIndex()][sample.getIndex()], gene.getLength());
sb.append(FormatManager.getSixDegitDouble(ratio)).append(",");
int pass = ratio >= CoverageCommand.minPercentRegionCovered ? 1 : 0;
sb.append(pass);
writeToFile(sb.toString(), bwCoverageDetails);
sb.setLength(0);
// count region per sample
sampleCoverageCount[sample.getIndex()] += pass;
}
} catch (Exception ex) {
ErrorManager.send(ex);
}
}
use of function.genotype.base.Sample in project atav by igm-team.
the class CoverageSummary method outputCoverageDetailsByExon.
private void outputCoverageDetailsByExon(HashMap<Integer, Integer> sampleCoveredLengthMap, Gene gene, Exon exon) {
try {
StringBuilder sb = new StringBuilder();
for (Sample sample : SampleManager.getList()) {
sb.append(sample.getName()).append(",");
sb.append(gene.getName()).append(",");
sb.append(exon.getChrStr()).append(",");
sb.append(exon.getIdStr()).append(",");
sb.append(exon.getStartPosition()).append(",");
sb.append(exon.getEndPosition()).append(",");
sb.append(exon.getLength()).append(",");
Integer coveredLength = sampleCoveredLengthMap.get(sample.getId());
if (coveredLength == null) {
coveredLength = 0;
}
sb.append(coveredLength).append(",");
double ratio = MathManager.devide(coveredLength, exon.getLength());
sb.append(FormatManager.getSixDegitDouble(ratio)).append(",");
sb.append(ratio >= CoverageCommand.minPercentRegionCovered ? 1 : 0);
writeToFile(sb.toString(), bwCoverageDetailsByExon);
sb.setLength(0);
}
} catch (Exception e) {
ErrorManager.send(e);
}
}
use of function.genotype.base.Sample in project atav by igm-team.
the class FamilyManager method initList.
private static void initList() {
HashMap<String, Family> familyMap = new HashMap<>();
for (Sample sample : SampleManager.getList()) {
if (!sample.getPaternalId().equals("0") || !sample.getMaternalId().equals("0")) {
if (familyMap.containsKey(sample.getFamilyId())) {
Family family = familyMap.get(sample.getFamilyId());
family.addChild(sample);
} else {
Family family = new Family(sample);
familyMap.put(sample.getFamilyId(), family);
}
}
}
for (Family family : familyMap.values()) {
familyList.add(family);
}
if (familyList.isEmpty()) {
ErrorManager.print("Missing family in sample file", ErrorManager.INPUT_PARSING);
} else {
LogManager.writeAndPrint("Total families: " + familyList.size());
}
}
use of function.genotype.base.Sample in project atav by igm-team.
the class ParentalMosaic method processVariant.
@Override
public void processVariant(CalledVariant calledVar) {
try {
ParentalOutput output = new ParentalOutput(calledVar);
output.countSampleGeno();
output.calculate();
if (output.isValid()) {
for (Family family : FamilyManager.getList()) {
for (Sample child : family.getChildList()) {
if (output.isChildValid(child)) {
for (Sample parent : family.getParentList()) {
if (output.isParentValid(parent)) {
doOutput(output.getString());
}
}
}
}
}
}
} catch (Exception e) {
ErrorManager.send(e);
}
}
use of function.genotype.base.Sample in project atav by igm-team.
the class FamilyManager method initList.
private static void initList() {
HashMap<String, Family> familyMap = new HashMap<String, Family>();
for (Sample sample : SampleManager.getList()) {
if (sample.isCase() && !sample.getPaternalId().equals("0") && !sample.getMaternalId().equals("0")) {
if (familyMap.containsKey(sample.getFamilyId())) {
Family sibling = familyMap.get(sample.getFamilyId());
sibling.addChild(sample);
} else {
Family sibling = new Family(sample);
familyMap.put(sample.getFamilyId(), sibling);
}
}
}
for (Family family : familyMap.values()) {
familyList.add(family);
}
if (familyList.isEmpty()) {
ErrorManager.print("Missing sibling in sample file", ErrorManager.INPUT_PARSING);
} else {
LogManager.writeAndPrint("Total siblings: " + familyList.size());
}
}
Aggregations