temp checkin for reorganization
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2774 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
83b9d63d59
commit
1ce0f06216
|
|
@ -7,13 +7,11 @@ import java.util.*;
|
|||
|
||||
|
||||
/**
|
||||
* Common superclass of VariantContext and Genotype
|
||||
*
|
||||
* @author depristo
|
||||
* <p/>
|
||||
* Class AttributedObject
|
||||
* <p/>
|
||||
* Common functions in VariantContext
|
||||
*/
|
||||
public class AttributedObject {
|
||||
public abstract class AttributedObject {
|
||||
public static final double NO_NEG_LOG_10PERROR = 0.0;
|
||||
private double negLog10PError = NO_NEG_LOG_10PERROR;
|
||||
private Set<Object> filters = new HashSet<Object>();
|
||||
|
|
@ -61,7 +59,7 @@ public class AttributedObject {
|
|||
filters.add(filter);
|
||||
}
|
||||
|
||||
public void addFilters(Collection<? extends Object> filters) {
|
||||
public void addFilters(Collection<?> filters) {
|
||||
if ( filters == null ) throw new IllegalArgumentException("BUG: Attempting to add null filters at" + this);
|
||||
for ( Object f : filters )
|
||||
addFilter(f);
|
||||
|
|
@ -71,7 +69,7 @@ public class AttributedObject {
|
|||
filters.clear();
|
||||
}
|
||||
|
||||
public void setFilters(Collection<? extends Object> filters) {
|
||||
public void setFilters(Collection<?> filters) {
|
||||
clearFilters();
|
||||
addFilters(filters);
|
||||
}
|
||||
|
|
@ -169,14 +167,14 @@ public class AttributedObject {
|
|||
return defaultValue;
|
||||
}
|
||||
|
||||
public AttributedObject getAttributes(Collection<Object> keys) {
|
||||
AttributedObject selected = new AttributedObject();
|
||||
|
||||
for ( Object key : keys )
|
||||
selected.putAttribute(key, this.getAttribute(key));
|
||||
|
||||
return selected;
|
||||
}
|
||||
// public AttributedObject getAttributes(Collection<Object> keys) {
|
||||
// AttributedObject selected = new AttributedObject();
|
||||
//
|
||||
// for ( Object key : keys )
|
||||
// selected.putAttribute(key, this.getAttribute(key));
|
||||
//
|
||||
// return selected;
|
||||
// }
|
||||
|
||||
|
||||
public String getAttributeAsString(Object key) { return (String)getAttribute(key); }
|
||||
|
|
|
|||
|
|
@ -20,6 +20,13 @@ public class Genotype extends AttributedObject {
|
|||
// todo -- pass around both a Variant Context and genotypes. Although users can always just package up
|
||||
// the associated genotypes into the VC itself.
|
||||
|
||||
// todo -- this should really be something like subcontext -- fixme, maybe move into converter code
|
||||
|
||||
// todo -- add flat variant manager class that is available via refmetadatatracker and provides simple
|
||||
// access to VariantContexts that can be obtained from rod tracks. Add simple functions to get
|
||||
// first record, all records, only those starting at current locus, etc. to deal with dbSNP monstrosity
|
||||
|
||||
// todo -- add name to variant context
|
||||
public Genotype(VariantContext vc, List<String> alleles, String sampleName, double negLog10PError) {
|
||||
this(resolveAlleles(vc, alleles), sampleName, negLog10PError);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,8 +182,25 @@ public class VariantContext extends AttributedObject {
|
|||
|
||||
if ( loc == null ) { throw new StingException("GenomeLoc cannot be null"); }
|
||||
this.loc = loc;
|
||||
}
|
||||
} A
|
||||
|
||||
// todo Add Allele... alleles syntax
|
||||
|
||||
// todo Make root of VariantContext and Genotype immutatable, but extend the system to have MutableVariantContext
|
||||
// and MutableGenotype, providing mutation operations. Then provide .freeze() method on mutable objects to
|
||||
// make them immutable
|
||||
|
||||
// todo -- - I'm personally not a huge fan of blanket types like Type.UNDETERMINED, especially when the types are
|
||||
// todo public and you have to add 'DON'T USE THIS' to the Javadoc. Couldn't you use null to represent this type instead?
|
||||
|
||||
// todo wrap collections that are returned directly so that users can't modify them. return Collections.unmodifiableSet()
|
||||
|
||||
// todo -- rename I'm uncomfortable with the entire AttributedObject system. The name Object is too general for the application. The name AttributedObject suggests that it can be used to add attributes to any object, much like Lisp property lists. However, it contains a negLog10PError member, making the class only applicable to variants.
|
||||
|
||||
// todo move all of attribute object attributes into Map<> and make special filter value for printing out values when
|
||||
// emitting VC -> VCF or whatever
|
||||
|
||||
// todo -- Map<String,Object> in attributed object instead of Map<Object,Object>
|
||||
public VariantContext(GenomeLoc loc, Collection<Allele> alleles) {
|
||||
this(loc, alleles, (Map<Object, Object>)null);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue