Returns a dictionary with position information
    
    Args:
        variant(cyvcf2.Variant)
    
    Returns:
        coordinates(dict)
438180
def get_coords(variant):
    
    coordinates = {
        'chrom': None,
        'end_chrom': None,
        'sv_length': None,
        'sv_type': None,
        'pos': None,
        'end': None,
    }
    chrom = variant.CHROM
    if chrom.startswith(('chr', 'CHR', 'Chr')):
        chrom = chrom[3:]
    coordinates['chrom'] = chrom
    end_chrom = chrom
    
    pos = int(variant.POS)
    alt = variant.ALT[0]

    # Get the end position
    # This will be None for non-svs
    end_pos = variant.INFO.get('END')
    if end_pos:
        end = int(end_pos)
    else:
        end = int(variant.end)
    coordinates['end'] = end
    
    sv_type = variant.INFO.get('SVTYPE')
    length = variant.INFO.get('SVLEN')
    if length:
        sv_len = abs(length)
    else:
        sv_len = end - pos

    # Translocations will sometimes have a end chrom that differs from chrom
    if sv_type == 'BND':
        other_coordinates = alt.strip('ACGTN[]').split(':')
        end_chrom = other_coordinates[0]
        if end_chrom.startswith(('chr', 'CHR', 'Chr')):
            end_chrom = end_chrom[3:]

        end = int(other_coordinates[1])

        #Set 'infinity' to length if translocation
        sv_len = float('inf')

    # Insertions often have length 0 in VCF
    if (sv_len == 0 and alt != '<INS>'):
        sv_len = len(alt)

    if (pos == end) and (sv_len > 0):
        end = pos + sv_len

    position = Position(chrom, pos)
    end_position = Position(end_chrom, end)
    
    # If 'start' is greater than 'end', switch positions
    if is_greater(position, end_position):
        end_chrom = position.chrom
        end = position.pos
        
        chrom = end_position.chrom
        pos = end_position.pos
    
    coordinates['end_chrom'] = end_chrom
    coordinates['pos'] = pos
    coordinates['end'] = end
    coordinates['sv_length'] = sv_len
    coordinates['sv_type'] = sv_type
    
    return coordinates
1093799
def to_dict(self):
        
        return dict(
            variants=self.variants,
            distinct=self.distinct,
            sort_key=self.sort_key,
            sources=self.sources,
            source_to_metadata_dict=self.source_to_metadata_dict)
1108651
def is_position_aes(vars_):
    
    try:
        return all([aes_to_scale(v) in {'x', 'y'} for v in vars_])
    except TypeError:
        return aes_to_scale(vars_) in {'x', 'y'}
183791
public String getVariant(String variantType) {
		String variant = null;
		if (bundleVariants != null) {
			variant = (String) bundleVariants.get(variantType);
		}
		return variant;
	}
1317944
def get_variant_value(identifier)
      data = Gxapi.with_error_handling do
        Timeout::timeout(2.0) do
          Gxapi.cache.fetch(self.cache_key(identifier)) do
            @interface.get_variant(identifier).to_hash
          end
        end
      end
      Ostruct.new(
        data.is_a?(Hash) ? data : self.default_values
      )
    end
358617
def _define_variant(self):
        """"""
        space = None
        variants = {
            # to be expanded once addtional spaces are supported
            'space1': ['fsaverage5', 'MNI152NLin2009cAsym'],
            'space2': ['fsaverage6', 'MNI152NLin2009cAsym'],
        }
        for sp, targets in variants.items():
            if all(target in targets for target in
                    [self.inputs.surface_target, self.inputs.volume_target]):
                space = sp
        if space is None:
            raise NotImplementedError

        variant_key = os.path.abspath('dtseries_variant.json')
        with open(variant_key, 'w') as fp:
            json.dump({space: variants[space]}, fp)
        return variant_key, space
748046
def get_element_offset(self, ty, position):
        

        offset = ffi.lib.LLVMPY_OffsetOfElement(self, ty, position)
        if offset == -1:
            raise ValueError("Could not determined offset of {}th "
                    "element of the type '{}'. Is it a struct type?".format(
                    position, str(ty)))
        return offset
132642
def iter_variants(self):
        """"""
        for v in self.get_vcf():
            yield Variant(v.ID, v.CHROM, v.POS, {v.REF} | set(v.ALT))
1248025
def variant_indices(self):
        
        variant_start_index = len(self.prefix)
        variant_len = len(self.alt)
        variant_end_index = variant_start_index + variant_len
        return variant_start_index, variant_end_index
1058228
def format_variant(variant, variant_type='snv'):
    
    chrom = variant.get('chrom')
    pos = variant.get('start')
    
    ref = variant.get('ref')
    alt = variant.get('alt')
    
    if variant_type == 'sv':
        pos = int((variant['pos_left'] + variant['pos_right'])/2)
        ref = 'N'
        alt = f"<{variant['sv_type']}>"

    info = None
    
    info = format_info(variant, variant_type=variant_type)

    variant_line = f"{chrom}\t{pos}\t.\t{ref}\t{alt}\t.\t.\t{info}"
    
    return variant_line
69258
def get_coordinates(self):
        
        resource_list = self.get_resource()
        coordinates = namedtuple('coordinates', ['latitude', 'longitude'])
        try:
            return [coordinates(*resource['point']['coordinates'])
                    for resource in resource_list]
        except (KeyError, TypeError):
            try:
                if isinstance(resource_list, dict):
                    resource_list = [resource_list]
                return [coordinates(resource['Point']['Latitude'],
                                    resource['Point']['Longitude'])
                        for resource in resource_list]
            except (KeyError, ValueError) as exc:
                print(exc)
1305445
def annotate_variant(variant, var_obj=None):
    
    if var_obj:
    
        variant.INFO['Obs'] = var_obj['observations']
        if var_obj.get('homozygote'):
            variant.INFO['Hom'] = var_obj['homozygote']
        if var_obj.get('hemizygote'):
            variant.INFO['Hem'] = var_obj['hemizygote']
    
    return variant
1024525
def var_str(shape):
    

    if shape in [None, ()]:
        return ['v1', ]

    size = np.prod(shape)
    indices = (np.indices(shape) + 1).reshape(-1, size)
    return ['v' + '_'.join(list(map(str, i))) for i in zip(*indices)]
982701
public static String getVariantKey(Map<String, String> variants) {

		String variantKey = "";
		if (variants != null) {
			variantKey = getVariantKey(variants, variants.keySet());
		}

		return variantKey;
	}
1242570
def get_nodes_positions(self):
        
        nodes = self.get_nodes()
        output = {}
        for node in nodes:
            output[node[0]] = (float(node[1][consts.Consts.x]), float(node[1][consts.Consts.y]))
        return output
51498
def firstVariant():
        
        def fget(self):
            if self.variants:
                return self.variants[0]
            else:
                variant = Variant()
                return variant

        return locals()
184968
def _get_update(self, variant):
        
        update = {
                '$inc': {
                    'homozygote': variant.get('homozygote', 0),
                    'hemizygote': variant.get('hemizygote', 0),
                    'observations': 1
                },
                '$set': {
                    'chrom': variant.get('chrom'),
                    'start': variant.get('pos'),
                    'end': variant.get('end'),
                    'ref': variant.get('ref'),
                    'alt': variant.get('alt'),
                }
             }
        if variant.get('case_id'):
            update['$push'] = {
                                'families': {
                                '$each': [variant.get('case_id')],
                                '$slice': -50
                                }
                            }
        return update