def __init__(self, contig, position): if isinstance(contig, int): contig = str(contig) jrep = scala_object(Env.hail().variant, 'Locus').apply(contig, position) self._init_from_java(jrep) self._contig = contig self._position = position
def __init__(self, element_type, required = False): """ :param :class:`.Type` element_type: Hail type of array element """ jtype = scala_object(Env.hail().expr, 'TAggregable').apply(element_type._jtype, required) self.element_type = element_type super(TAggregable, self).__init__(jtype)
def __init__(self, element_type): """ :param :class:`.Type` element_type: Hail type of array element """ jtype = scala_object(Env.hail().expr, 'TArray').apply(element_type._jtype) self.element_type = element_type super(TArray, self).__init__(jtype)
def parse(string): """Parses a locus object from a CHR:POS string. :rtype: :class:`.Locus` """ return Locus._from_java(scala_object(env.hail.variant, 'Locus').parse(string))
def parse(string): """Parses a locus object from a CHR:POS string. :rtype: :class:`.Locus` """ return Locus._from_java(scala_object(Env.hail().variant, 'Locus').parse(string))
def __init__(self, element_type): """ :param :class:`.Type` element_type: Hail type of set element """ jtype = scala_object(env.hail.expr, 'TSet').apply(element_type._jtype) self.element_type = element_type super(TSet, self).__init__(jtype)
def __init__(self, contig, position): if isinstance(contig, int): contig = str(contig) jrep = scala_object(env.hail.variant, 'Locus').apply(contig, position) self._init_from_java(jrep) self._contig = contig self._position = position
def __init__(self, element_type): """ :param :class:`.Type` element_type: Hail type of set element """ jtype = scala_object(Env.hail().expr, 'TSet').apply(element_type._jtype) self.element_type = element_type super(TSet, self).__init__(jtype)
def __init__(self, contig, start, ref, alts): if isinstance(contig, int): contig = str(contig) jrep = scala_object(Env.hail().variant, 'Variant').apply(contig, start, ref, alts) self._init_from_java(jrep) self._contig = contig self._start = start self._ref = ref
def __init__(self, contig, start, ref, alts): if isinstance(contig, int): contig = str(contig) jrep = scala_object(env.hail.variant, 'Variant').apply(contig, start, ref, alts) self._init_from_java(jrep) self._contig = contig self._start = start self._ref = ref
def __init__(self, start, end): if not isinstance(start, Locus) and isinstance(end, Locus): raise TypeError( 'expect arguments of type (Locus, Locus) but found (%s, %s)' % (type(start), type(end))) jrep = scala_object(env.hail.variant, 'Locus').makeInterval(start._jrep, end._jrep) self._init_from_java(jrep)
def _convert_to_j(self, annotation): if annotation is not None: return scala_object(Env.hail().annotations, 'Annotation').fromSeq( Env.jutils().arrayListToISeq([ f.typ._convert_to_j(annotation[f.name]) for f in self.fields ])) else: return annotation
def _convert_to_j(self, annotation): if annotation is not None: return scala_object(Env.hail().annotations, 'Annotation').fromSeq( Env.jutils().arrayListToISeq( [f.typ._convert_to_j(annotation.get(f.name)) for f in self.fields] ) ) else: return annotation
def from_fields(cls, fields, required=False): """Creates a new TStruct from field objects. :param fields: The TStruct fields. :type fields: list of :class:`.Field` :param bool required: Flag for whether the struct can be missing. :return: TStruct from input fields :rtype: :class:`.TStruct` """ struct = TStruct.__new__(cls) struct.fields = fields jfields = [scala_object(Env.hail().expr, 'Field').apply( f.name, f.typ._jtype, i, Env.jutils().javaMapToMap(f.attributes)) for i,f in enumerate(fields)] jtype = scala_object(Env.hail().expr, 'TStruct').apply(jindexed_seq(jfields), required) return TStruct._from_java(jtype)
def __init__(self, names, types): """ """ if len(names) != len(types): raise ValueError('length of names and types not equal: %d and %d' % (len(names), len(types))) jtype = scala_object(Env.hail().expr, 'TStruct').apply(names, map(lambda t: t._jtype, types)) self.fields = [Field(names[i], types[i]) for i in xrange(len(names))] super(TStruct, self).__init__(jtype)
def parse(cls, string): """Parses a locus object from a CHR:POS string. **Examples** >>> l1 = Locus.parse('1:101230') >>> l2 = Locus.parse('X:4201230') :rtype: :class:`.Locus` """ return Locus._from_java(scala_object(Env.hail().variant, 'Locus').parse(string))
def parse(cls, string): """Parses a locus object from a CHR:POS string. **Examples** >>> l1 = Locus.parse('1:101230') >>> l2 = Locus.parse('X:4201230') :rtype: :class:`.Locus` """ return Locus._from_java( scala_object(Env.hail().variant, 'Locus').parse(string))
def parse(string): """Parses a variant object from a string. There are two acceptable formats: CHR:POS:REF:ALT, and CHR:POS:REF:ALT1,ALT2,...ALTN. Below is an example of each: >>> v_biallelic = Variant.parse('16:20012:A:TT') >>> v_multiallelic = Variant.parse('16:12311:T:C,TTT,A') :rtype: :class:`.Variant` """ jrep = scala_object(env.hail.variant, 'Variant').parse(string) return Variant._from_java(jrep)
def parse(cls, string): """Parses a variant object from a string. There are two acceptable formats: CHR:POS:REF:ALT, and CHR:POS:REF:ALT1,ALT2,...ALTN. Below is an example of each: >>> v_biallelic = Variant.parse('16:20012:A:TT') >>> v_multiallelic = Variant.parse('16:12311:T:C,TTT,A') :rtype: :class:`.Variant` """ jrep = scala_object(Env.hail().variant, 'Variant').parse(string) return Variant._from_java(jrep)
def parse(string): """Parses a genomic interval from string representation. There are two acceptable representations, CHR:POS-CHR:POS and CHR:POS-POS. In the second case, the second locus is assumed to have the same chromosome. The second locus must be ordered after the first (later chromosome / position). Example: >>> interval_1 = Interval.parse('X:100005-X:150020') >>> interval_2 = Interval.parse('16:29500000-30200000') :rtype: :class:`.Interval` """ jrep = scala_object(env.hail.variant, 'Locus').parseInterval(string) return Interval._from_java(jrep)
def __init__(self): super(TLong, self).__init__(scala_object(env.hail.expr, 'TLong'))
def __init__(self, reference_genome=None, required = False): self._rg = reference_genome if reference_genome else Env.hc().default_reference jtype = scala_object(Env.hail().expr, 'TInterval').apply(self._rg._jrep, required) super(TInterval, self).__init__(jtype)
def __init__(self): super(TLocus, self).__init__(scala_object(Env.hail().expr, 'TLocus'))
def __init__(self): super(TInt, self).__init__(scala_object(Env.hail().expr, 'TInt'))
def __init__(self): super(TBoolean, self).__init__(scala_object(Env.hail().expr, 'TBoolean'))
def __init__(self): super(TCall, self).__init__(scala_object(Env.hail().expr, 'TCall'))
def __init__(self, ref, alt): jaa = scala_object(env.hail.variant, 'AltAllele').apply(ref, alt) self._init_from_java(jaa) self._ref = ref self._alt = alt
def __init__(self): super(TAltAllele, self).__init__(scala_object(Env.hail().expr, 'TAltAllele'))
def __init__(self): jtype = scala_object(Env.hail().expr, 'TInterval').apply(Env.hail().variant.GenomeReference.GRCh37()) super(TInterval, self).__init__(jtype)
def __init__(self): super(TVariant, self).__init__(scala_object(env.hail.expr, 'TVariant'))
def __init__(self): super(TGenotype, self).__init__(scala_object(Env.hail().expr, 'TGenotype'))
def __init__(self, ref, alt): jaa = scala_object(Env.hail().variant, 'AltAllele').apply(ref, alt) self._init_from_java(jaa) self._ref = ref self._alt = alt
def __init__(self): super(TFloat, self).__init__(scala_object(env.hail.expr, 'TFloat'))
def __init__(self, required = False): super(TCall, self).__init__(scala_object(Env.hail().expr, 'TCall').apply(required))
def __init__(self): super(TDouble, self).__init__(scala_object(Env.hail().expr, 'TDouble'))
def __init__(self): super(TInterval, self).__init__(scala_object(env.hail.expr, 'TInterval'))
def _jstate(self, jvds): return self._hail.driver.State( self._jsc, self._jsql_context, jvds, scala_object(self._jvm.scala.collection.immutable, 'Map').empty())
def __init__(self): super(TString, self).__init__(scala_object(Env.hail().expr, 'TString'))
def __init__(self, key_type, value_type): jtype = scala_object(Env.hail().expr, 'TDict').apply(key_type._jtype, value_type._jtype) self.key_type = key_type self.value_type = value_type super(TDict, self).__init__(jtype)
def __init__(self): super(TFloat64, self).__init__(scala_object(Env.hail().expr, 'TFloat64'))