Exemplo n.º 1
0
 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
Exemplo n.º 2
0
    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))
Exemplo n.º 3
0
    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))
Exemplo n.º 4
0
 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
Exemplo n.º 5
0
 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)
Exemplo n.º 6
0
Arquivo: typ.py Projeto: wtsi-hgi/hail
 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)
Exemplo n.º 7
0
Arquivo: expr.py Projeto: Fedja/hail
 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)
Exemplo n.º 8
0
 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
Exemplo n.º 9
0
 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
Exemplo n.º 10
0
 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
Exemplo n.º 11
0
Arquivo: typ.py Projeto: wtsi-hgi/hail
    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)
Exemplo n.º 12
0
Arquivo: expr.py Projeto: Fedja/hail
 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
Exemplo n.º 13
0
    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)
Exemplo n.º 14
0
Arquivo: expr.py Projeto: Fedja/hail
    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)
Exemplo n.º 15
0
    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))
Exemplo n.º 16
0
    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))
Exemplo n.º 17
0
    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)
Exemplo n.º 18
0
    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)
Exemplo n.º 19
0
 def __init__(self):
     super(TDouble, self).__init__(scala_object(Env.hail().expr, 'TDouble'))
Exemplo n.º 20
0
Arquivo: expr.py Projeto: Fedja/hail
 def __init__(self):
     super(TLocus, self).__init__(scala_object(Env.hail().expr, 'TLocus'))
Exemplo n.º 21
0
Arquivo: expr.py Projeto: Fedja/hail
 def __init__(self):
     super(TGenotype, self).__init__(scala_object(Env.hail().expr, 'TGenotype'))
Exemplo n.º 22
0
Arquivo: utils.py Projeto: Fedja/hail
 def _to_java(self):
     """Convert to Java TextTableConfiguration object."""
     return Env.hail().utils.TextTableConfiguration.apply(self.types, self.comment,
                                                        self.delimiter, self.missing,
                                                        self.noheader, self.impute)
Exemplo n.º 23
0
Arquivo: expr.py Projeto: Fedja/hail
 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)
Exemplo n.º 24
0
Arquivo: expr.py Projeto: Fedja/hail
 def __init__(self):
     super(TBoolean, self).__init__(scala_object(Env.hail().expr, 'TBoolean'))
Exemplo n.º 25
0
Arquivo: expr.py Projeto: Fedja/hail
 def __init__(self):
     super(TDouble, self).__init__(scala_object(Env.hail().expr, 'TDouble'))
Exemplo n.º 26
0
 def __init__(self):
     super(TBoolean,
           self).__init__(scala_object(Env.hail().expr, 'TBoolean'))
Exemplo n.º 27
0
 def functions_rst(self, file_name):
     Env.hail().utils.FunctionDocumentation.makeFunctionsDocs(file_name)
Exemplo n.º 28
0
 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
Exemplo n.º 29
0
 def _jrep(self):
     return Env.hail().stats.BetaDist.apply(float(self.a), float(self.b))
Exemplo n.º 30
0
 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
Exemplo n.º 31
0
 def _jrep(self):
     return Env.hail().stats.TruncatedBetaDist.apply(
         float(self.a), float(self.b), float(self.minVal),
         float(self.maxVal))
Exemplo n.º 32
0
 def types_rst(self, file_name):
     Env.hail().utils.FunctionDocumentation.makeTypesDocs(file_name)
Exemplo n.º 33
0
 def functions_rst(self, file_name):
     Env.hail().utils.FunctionDocumentation.makeFunctionsDocs(file_name)
Exemplo n.º 34
0
 def __init__(self):
     super(TGenotype,
           self).__init__(scala_object(Env.hail().expr, 'TGenotype'))
Exemplo n.º 35
0
Arquivo: expr.py Projeto: Fedja/hail
 def __init__(self):
     super(TString, self).__init__(scala_object(Env.hail().expr, 'TString'))
Exemplo n.º 36
0
 def __init__(self):
     super(TLocus, self).__init__(scala_object(Env.hail().expr, 'TLocus'))
Exemplo n.º 37
0
Arquivo: typ.py Projeto: wtsi-hgi/hail
 def __init__(self, required = False):
     super(TGenotype, self).__init__(scala_object(Env.hail().expr, 'TGenotype').apply(required))
Exemplo n.º 38
0
 def __init__(self):
     jtype = scala_object(Env.hail().expr, 'TInterval').apply(Env.hail().variant.GenomeReference.GRCh37())
     super(TInterval, self).__init__(jtype)
Exemplo n.º 39
0
Arquivo: typ.py Projeto: wtsi-hgi/hail
 def __init__(self, required = False):
     super(TAltAllele, self).__init__(scala_object(Env.hail().expr, 'TAltAllele').apply(required))
Exemplo n.º 40
0
Arquivo: typ.py Projeto: wtsi-hgi/hail
 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)
Exemplo n.º 41
0
Arquivo: expr.py Projeto: Fedja/hail
 def __init__(self):
     super(TAltAllele, self).__init__(scala_object(Env.hail().expr, 'TAltAllele'))
Exemplo n.º 42
0
Arquivo: typ.py Projeto: wtsi-hgi/hail
 def __init__(self, required = False):
     super(TCall, self).__init__(scala_object(Env.hail().expr, 'TCall').apply(required))
Exemplo n.º 43
0
Arquivo: expr.py Projeto: Fedja/hail
 def __init__(self):
     super(TCall, self).__init__(scala_object(Env.hail().expr, 'TCall'))
Exemplo n.º 44
0
 def _to_java(self):
     """Convert to Java TextTableConfiguration object."""
     return Env.hail().utils.TextTableConfiguration.apply(
         self.types, self.comment, self.delimiter, self.missing,
         self.noheader, self.impute)
Exemplo n.º 45
0
Arquivo: expr.py Projeto: Fedja/hail
 def __init__(self):
     super(TInt, self).__init__(scala_object(Env.hail().expr, 'TInt'))
Exemplo n.º 46
0
 def types_rst(self, file_name):
     Env.hail().utils.FunctionDocumentation.makeTypesDocs(file_name)
Exemplo n.º 47
0
 def __init__(self):
     super(TString, self).__init__(scala_object(Env.hail().expr, 'TString'))
Exemplo n.º 48
0
 def _jrep(self):
     return Env.hail().stats.UniformDist.apply(float(self.minVal),
                                               float(self.maxVal))
Exemplo n.º 49
0
 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)
Exemplo n.º 50
0
 def _jrep(self):
     return Env.hail().stats.BetaDist.apply(float(self.a), float(self.b))
Exemplo n.º 51
0
 def __init__(self):
     super(TAltAllele,
           self).__init__(scala_object(Env.hail().expr, 'TAltAllele'))
Exemplo n.º 52
0
 def _jrep(self):
     return Env.hail().stats.UniformDist.apply(float(self.minVal), float(self.maxVal))
Exemplo n.º 53
0
 def __init__(self):
     super(TCall, self).__init__(scala_object(Env.hail().expr, 'TCall'))
Exemplo n.º 54
0
 def _jrep(self):
     return Env.hail().stats.TruncatedBetaDist.apply(float(self.a), float(self.b), float(self.minVal), float(self.maxVal))
Exemplo n.º 55
0
 def __init__(self):
     super(TInt, self).__init__(scala_object(Env.hail().expr, 'TInt'))
Exemplo n.º 56
0
 def __init__(self):
     super(TFloat64, self).__init__(scala_object(Env.hail().expr, 'TFloat64'))