Moved removePLs to VariantContextUtils
This commit is contained in:
parent
054c475416
commit
4397ce8653
|
|
@ -74,13 +74,6 @@ public class Genotype {
|
||||||
return new Genotype(g.getSampleName(), g.getAlleles(), g.getNegLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, attributes, g.isPhased());
|
return new Genotype(g.getSampleName(), g.getAlleles(), g.getNegLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, attributes, g.isPhased());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Genotype removePLs(Genotype g) {
|
|
||||||
Map<String, Object> attrs = new HashMap<String, Object>(g.getAttributes());
|
|
||||||
attrs.remove(VCFConstants.PHRED_GENOTYPE_LIKELIHOODS_KEY);
|
|
||||||
attrs.remove(VCFConstants.GENOTYPE_LIKELIHOODS_KEY);
|
|
||||||
return new Genotype(g.getSampleName(), g.getAlleles(), g.getNegLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, attrs, g.isPhased());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Genotype modifyAlleles(Genotype g, List<Allele> alleles) {
|
public static Genotype modifyAlleles(Genotype g, List<Allele> alleles) {
|
||||||
return new Genotype(g.getSampleName(), alleles, g.getNegLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, g.getAttributes(), g.isPhased());
|
return new Genotype(g.getSampleName(), alleles, g.getNegLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, g.getAttributes(), g.isPhased());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,13 @@ public class VariantContextUtils {
|
||||||
return "%." + precision + "f";
|
return "%." + precision + "f";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Genotype removePLs(Genotype g) {
|
||||||
|
Map<String, Object> attrs = new HashMap<String, Object>(g.getAttributes());
|
||||||
|
attrs.remove(VCFConstants.PHRED_GENOTYPE_LIKELIHOODS_KEY);
|
||||||
|
attrs.remove(VCFConstants.GENOTYPE_LIKELIHOODS_KEY);
|
||||||
|
return new Genotype(g.getSampleName(), g.getAlleles(), g.getNegLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, attrs, g.isPhased());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple but common wrapper for matching VariantContext objects using JEXL expressions
|
* A simple but common wrapper for matching VariantContext objects using JEXL expressions
|
||||||
*/
|
*/
|
||||||
|
|
@ -740,7 +747,7 @@ public class VariantContextUtils {
|
||||||
Map<String, Genotype> newGs = new HashMap<String, Genotype>(genotypes.size());
|
Map<String, Genotype> newGs = new HashMap<String, Genotype>(genotypes.size());
|
||||||
|
|
||||||
for ( Map.Entry<String, Genotype> g : genotypes.entrySet() ) {
|
for ( Map.Entry<String, Genotype> g : genotypes.entrySet() ) {
|
||||||
newGs.put(g.getKey(), g.getValue().hasLikelihoods() ? Genotype.removePLs(g.getValue()) : g.getValue());
|
newGs.put(g.getKey(), g.getValue().hasLikelihoods() ? removePLs(g.getValue()) : g.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
return newGs;
|
return newGs;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue