Add the gmaf frequency
        
        Args:
            variant_obj (puzzle.models.Variant)
            gemini_variant (GeminiQueryRow)
6548
def _add_gmaf(self, variant_obj, gemini_variant):
        
        max_af = gemini_variant['max_aaf_all']
        if max_af:
            max_af = float(max_af)
            if max_af != -1.0:
                variant_obj.set_max_freq(max_af)
336597
def default_freq(**indexer):
    """"""
    freq = 'AS-JAN'
    if indexer:
        if 'DJF' in indexer.values():
            freq = 'AS-DEC'
        if 'month' in indexer and sorted(indexer.values()) != indexer.values():
            raise (NotImplementedError)

    return freq
578648
def get_variant(self, index=None):
        
        for variant in self.iter_variants():
            if variant.index == index:
                return variant
2288
def _add_sv_coordinates(self, variant):
        
        variant.stop_chrom = variant.CHROM
        variant.start = int(variant.POS)
        
        # If we have a translocation:
        if ':' in variant.ALT:
            other_coordinates = variant.ALT.strip('ACGTN[]').split(':')
            variant.stop_chrom = other_coordinates[0].lstrip('chrCHR')
            other_position = other_coordinates[1]
            # variant.stop = other_position

            #Set 'infinity' to length if translocation
            variant.sv_len = float('inf')
            variant.sv_type = 'BND'
        else:
            variant.sv_len = variant.stop - variant.start

        variant['cytoband_start'] = get_cytoband_coord(
                                        chrom=variant.CHROM,
                                        pos=variant.start
                                        )

        variant['cytoband_stop'] = get_cytoband_coord(
                                    chrom=variant.stop_chrom,
                                    pos=variant.stop
                                    )
15602
public static Vertex newPlaceInstance(String realWord, int frequency)
    {
        return new Vertex(Predefine.TAG_PLACE, realWord, new CoreDictionary.Attribute(Nature.ns, frequency));
    }
328786
public void setVariant(int variant) {
        if (symbolMode != Mode.MICRO) {
            throw new IllegalArgumentException("Can only set variant when using MICRO mode.");
        }
        if (variant < 1 || variant > 34) {
            throw new IllegalArgumentException("Variant must be between 1 and 34.");
        }
        this.columns = MICRO_VARIANTS[variant - 1];
        this.rows = MICRO_VARIANTS[variant - 1 + 34];
    }
270999
def _add_genes(self, variant_obj):
        """"""
        genes = []
        ensembl_ids = []
        hgnc_symbols = []
        
        if variant_obj.transcripts:
            for transcript in variant_obj.transcripts:
                if transcript.ensembl_id:
                    ensembl_ids.append(transcript.ensembl_id)
                if transcript.hgnc_symbol:
                    hgnc_symbols.append(transcript.hgnc_symbol)

        else:
            hgnc_symbols = variant_obj.gene_symbols
        
        genes = get_gene_info(
                        ensembl_ids=ensembl_ids, 
                        hgnc_symbols=hgnc_symbols
                        )
            
        for gene in genes:
            variant_obj.add_gene(gene)
590496
public void addPostProcessVariant(String variantType, VariantSet variantSet) {

		Map<String, VariantSet> variantMap = new HashMap<>();
		variantMap.put(variantType, variantSet);
		addPostProcessVariant(variantMap);
	}
793932
function() {
        var jvmObject;
        this.logger = Logger.getLogger("PrefixSpanModelFreqSequence_js");
        if(arguments[0] instanceof org.apache.spark.mllib.fpm.PrefixSpan.FreqSequence) {
            jvmObject = arguments[0];
        } else {
            jvmObject = new org.apache.spark.mllib.fpm.PrefixSpan.FreqSequence(Utils.unwrapObject(arguments[0]), arguments[1]);
        }


        JavaWrapper.call(this, jvmObject);

    }
909064
def variant(self, case_id, variant_id):
        """"""
        case_obj = self.case(case_id)
        plugin, case_id = self.select_plugin(case_obj)
        variant = plugin.variant(case_id, variant_id)
        return variant
40598
public void addFreq(int index, int freq) {
        switch (index) {
            case 11:
                this.end += freq;
                allFreq += freq;
                break;
            case 12:
                this.end += freq;
                this.begin += freq;
                allFreq += freq;
                break;
            case 44:
                this.split += freq;
                allFreq += freq;
                break;
        }
    }
768717
def add_from_vla_obs (src, Lband, Cband):
    
    if src in models:
        raise PKError ('already have a model for ' + src)

    fL = np.log10 (1425)
    fC = np.log10 (4860)

    lL = np.log10 (Lband)
    lC = np.log10 (Cband)

    A = (lL - lC) / (fL - fC)
    B = lL - A * fL

    def fluxdens (freq_mhz):
        return 10. ** (A * np.log10 (freq_mhz) + B)

    def spindex (freq_mhz):
        return A

    models[src] = fluxdens
    spindexes[src] = spindex
668550
def set_variant(self, identity, experiment_name, variant_name):
        
        try:
            experiment = model.Experiment.get_by(name=experiment_name)
            variant = model.Variant.get_by(name=variant_name)
            if experiment and variant and model.Participant.query.filter(and_(
                model.Participant.identity == identity,
                model.Participant.experiment_id == experiment.id,
                model.Participant.variant_id == variant.id
            )).count() == 0:
                model.Participant(
                    identity=identity,
                    experiment=experiment,
                    variant=variant
                )
                self.Session.commit()
        finally:
            self.Session.close()
601127
def register_variant(cls):
        

        if hasattr(cls, "val"):
            cls.registered_attributes[cls.val] = cls
        else:
            cls.registered_attributes[cls.type.default] = cls
602192
def annotate_gemini(data, retriever=None):
    
    r = dd.get_variation_resources(data)
    return all([r.get(k) and objectstore.file_exists_or_remote(r[k]) for k in ["exac", "gnomad_exome"]])
593742
def variants_in_coords(nucmer_matches, vcf_file):
        ''''''
        found_variants = {}
        f = pyfastaq.utils.open_file_read(vcf_file)
        for line in f:
            if line.startswith('#'):
                continue

            data = line.rstrip().split('\t')
            scaff = data[0]

            if scaff in nucmer_matches:
                position = int(data[1]) - 1
                i = pyfastaq.intervals.Interval(position, position)
                intersects = len([x for x in nucmer_matches[scaff] if x.intersects(i)]) > 0
                if intersects:
                    if scaff not in found_variants:
                        found_variants[scaff] = set()
                    found_variants[scaff].add(position)

        pyfastaq.utils.close(f)
        return found_variants
1346013
def delete_variants(adapter, vcf_obj, case_obj, case_id=None):
    
    case_id = case_id or case_obj['case_id']
    nr_deleted = 0
    start_deleting = datetime.now()
    chrom_time = datetime.now()
    current_chrom = None
    new_chrom = None
    
    for variant in vcf_obj:
        formated_variant = build_variant(
            variant=variant,
            case_obj=case_obj,
            case_id=case_id,
        )
        
        if not formated_variant:
            continue
        
        new_chrom = formated_variant.get('chrom')
        adapter.delete_variant(formated_variant)
        nr_deleted += 1
        
        if not current_chrom:
            LOG.info("Start deleting chromosome {}".format(new_chrom))
            current_chrom = new_chrom
            chrom_time = datetime.now()
            continue
        
        if new_chrom != current_chrom:
            LOG.info("Chromosome {0} done".format(current_chrom))
            LOG.info("Time to delete chromosome {0}: {1}".format(
                current_chrom, datetime.now()-chrom_time))
            LOG.info("Start deleting chromosome {0}".format(new_chrom))
            current_chrom = new_chrom


    return nr_deleted