auxiliary data structure for mendelian concordance reporting; it's nice to have the latest version checked in in order for the code to compile...
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@479 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
ece3e9969e
commit
1f84b9647d
|
|
@ -1,5 +1,7 @@
|
|||
package org.broadinstitute.sting.playground.utils;
|
||||
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
|
||||
/**
|
||||
* This class is a trivial wrapper for keeping together and passing around counts of different possible outcomes of
|
||||
* comparisons in a trio. Mendelian walker uses this class to classify/accumulate events such as consistent snp, inconsistent snp
|
||||
|
|
@ -12,13 +14,16 @@ public class TrioConcordanceRecord {
|
|||
public long consistent_ref = 0; // number of assessed loci, where all 3 people have homogeneous reference allele
|
||||
public int consistent_snp = 0; // number of assessed loci where a SNP is observed in at least one individual and genotyping calls are consistent between the trio members
|
||||
public int inconsistent_snp = 0; // number of assessed loci where a SNP is observed in at least one individual and genotyping calls are inconsistent
|
||||
public int inconsistent_snp_in_parent = 0; // number of inconsistent snps (see above), where parent(s) have a snp but the kid does not while she should
|
||||
public int inconsistent_snp_in_kid = 0; // number of inconsistent snps (see above), where kid has a snp but the parents do not while they should
|
||||
public int missing_snp_in_parents = 0; // number of inconsistent snps (see above), where parent(s) have a snp but the kid does not while she should
|
||||
public int missing_snp_in_kid = 0; // number of inconsistent snps (see above), where kid has a snp but the parents do not while they should
|
||||
public int consistent_indels = 0; // *_indels are same as *_snps, see above
|
||||
public int consistent_indels_in_mother = 0; // *_indels are same as *_snps, see above
|
||||
public int consistent_indels_in_father = 0; // *_indels are same as *_snps, see above
|
||||
public int inconsistent_indels = 0 ;
|
||||
public int inconsistent_indels_in_parent = 0 ;
|
||||
public int inconsistent_indels_in_kid = 0 ;
|
||||
public int non_biallelic = 0; // number of variant calls that are not biallelic
|
||||
public int missing_indels_in_parents = 0 ;
|
||||
public int missing_indels_in_kid = 0 ;
|
||||
public int non_biallelic_snp = 0; // number of variant calls that are not biallelic
|
||||
public int non_biallelic_indel = 0; // number of variant calls that are not biallelic
|
||||
public long mom_assessed = 0; // number of assessed loci for mother (i.e. passing confidence threshold filter)
|
||||
public long dad_assessed = 0;
|
||||
public long kid_assessed = 0;
|
||||
|
|
@ -28,19 +33,26 @@ public class TrioConcordanceRecord {
|
|||
public long mom_snp = 0; // number of snp calls (out of total assessed)
|
||||
public long dad_snp = 0;
|
||||
public long kid_snp = 0;
|
||||
public long mom_indel = 0; // number of snp calls (out of total assessed)
|
||||
public long dad_indel = 0;
|
||||
public long kid_indel = 0;
|
||||
public long unclassified_events = 0;
|
||||
|
||||
public TrioConcordanceRecord add(TrioConcordanceRecord other) {
|
||||
this.assessed_loci += other.assessed_loci;
|
||||
this.consistent_ref += other.consistent_ref;
|
||||
this.consistent_snp += other.consistent_snp;
|
||||
this.inconsistent_snp += other.inconsistent_snp;
|
||||
this.inconsistent_snp_in_parent += other.inconsistent_snp_in_parent;
|
||||
this.inconsistent_snp_in_kid += other.inconsistent_snp_in_kid;
|
||||
this.missing_snp_in_parents += other.missing_snp_in_parents;
|
||||
this.missing_snp_in_kid += other.missing_snp_in_kid;
|
||||
this.consistent_indels += other.consistent_indels;
|
||||
this.consistent_indels_in_mother += other.consistent_indels_in_mother;
|
||||
this.consistent_indels_in_father += other.consistent_indels_in_father;
|
||||
this.inconsistent_indels += other.inconsistent_indels;
|
||||
this.inconsistent_indels_in_parent += other.inconsistent_indels_in_parent;
|
||||
this.inconsistent_indels_in_kid += other.inconsistent_indels_in_kid;
|
||||
this.non_biallelic += other.non_biallelic;
|
||||
this.missing_indels_in_parents += other.missing_indels_in_parents;
|
||||
this.missing_indels_in_kid += other.missing_indels_in_kid;
|
||||
this.non_biallelic_snp += other.non_biallelic_snp;
|
||||
this.non_biallelic_indel += other.non_biallelic_indel;
|
||||
this.mom_assessed += other.mom_assessed;
|
||||
this.dad_assessed += other.dad_assessed;
|
||||
this.kid_assessed += other.kid_assessed;
|
||||
|
|
@ -50,18 +62,38 @@ public class TrioConcordanceRecord {
|
|||
this.mom_snp += other.mom_snp;
|
||||
this.dad_snp += other.dad_snp;
|
||||
this.kid_snp += other.kid_snp;
|
||||
|
||||
this.mom_indel += other.mom_indel;
|
||||
this.dad_indel += other.dad_indel;
|
||||
this.kid_indel += other.kid_indel;
|
||||
this.unclassified_events += other.unclassified_events;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int totalSNP() { return consistent_snp + inconsistent_snp + non_biallelic; }
|
||||
public int totalSNP() { return consistent_snp + inconsistent_snp + non_biallelic_snp; }
|
||||
public int totalIndels() { return consistent_indels + inconsistent_indels + non_biallelic_indel; }
|
||||
|
||||
public String toString() {
|
||||
return String.format("%ntotal assessed in trio: %d%n reference: %d (%3.2f)%n total snp: %d%n consistent snp: %d (%3.2f)%n multiallelic: %d (%3.2f)%nper trio individual:%n assessed:%n mother: %d%n father: %d%n daughter: %d%n" ,
|
||||
assessed_loci, consistent_ref, ((double)consistent_ref*100.00)/assessed_loci,totalSNP(), consistent_snp, ((double)consistent_snp*100.0)/totalSNP(),
|
||||
non_biallelic, ((double)non_biallelic*100.0)/totalSNP(),mom_assessed,dad_assessed,kid_assessed);
|
||||
// return String.format("total assessed in trio: %d%n reference: %d (%3.2f)%n total snp: %d%n consistent snp: %d (%3.2f)%n multiallelic: %d (%3.2f)" ,
|
||||
// assessed_loci, consistent_ref, ((double)consistent_ref*100.00)/assessed_loci,totalSNP(), consistent_snp, ((double)consistent_snp*100.0)/totalSNP(),
|
||||
// non_biallelic, ((double)non_biallelic*100.0)/totalSNP());
|
||||
StringBuilder b = new StringBuilder();
|
||||
|
||||
b.append(String.format("%ntotal assessed in trio: %d%n reference: %d (%3.2f)%n", assessed_loci, consistent_ref, Utils.percentage(consistent_ref,assessed_loci )) );
|
||||
b.append(String.format(" total snp sites: %d%n consistent snp: %d (%3.2f)%n multiallelic snp: %d (%3.2f)%n inconsistent snp: %d (%3.2f)%n",
|
||||
totalSNP(), consistent_snp, Utils.percentage(consistent_snp,totalSNP() ), non_biallelic_snp, Utils.percentage(non_biallelic_snp,totalSNP()),
|
||||
inconsistent_snp, Utils.percentage(inconsistent_snp, totalSNP()) ) );
|
||||
|
||||
b.append(String.format(" total indel sites: %d%n consistent indel: %d (%3.2f)%n multiallelic indel: %d (%3.2f)%n inconsistent indels: %d (%3.2f)%n missing from daughter: %d (%3.2f)%n missing from both parents: %d (%3.2f)%n",
|
||||
totalIndels(), consistent_indels, Utils.percentage(consistent_indels,totalIndels()),
|
||||
non_biallelic_indel, Utils.percentage(non_biallelic_indel, totalIndels()),
|
||||
inconsistent_indels, Utils.percentage(inconsistent_indels, totalIndels()),
|
||||
missing_indels_in_kid, Utils.percentage(missing_indels_in_kid, inconsistent_indels),
|
||||
missing_indels_in_parents, Utils.percentage(missing_indels_in_parents, inconsistent_indels)
|
||||
));
|
||||
|
||||
b.append(String.format(" unclassified (snp+indel): %d%n", unclassified_events));
|
||||
|
||||
b.append( String.format("per trio individual:%n mother:%n assessed: %d%n ref: %d%n snps: %d%n indels: %d%n", mom_assessed, mom_ref, mom_snp,mom_indel) );
|
||||
b.append( String.format(" father:%n assessed: %d%n ref: %d%n snps: %d%n indels: %d%n", dad_assessed, dad_ref, dad_snp,dad_indel) );
|
||||
b.append( String.format(" daughter:%n assessed: %d%n ref: %d%n snps: %d%n indels: %d%n", kid_assessed, kid_ref, kid_snp,kid_indel) );
|
||||
|
||||
return b.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue