Update the HPO gene list for a case based on current terms.
184418
def update_hpolist(self, case_obj):
        """"""
        hpo_list = self.case_genelist(case_obj)
        hpo_results = hpo_genes(case_obj.phenotype_ids(),
                                *self.phenomizer_auth)

        if hpo_results is None:
            pass
            # Why raise here?
            # raise RuntimeError("couldn't link to genes, try again")
        else:
            gene_ids = [result['gene_id'] for result in hpo_results
                        if result['gene_id']]
            hpo_list.gene_ids = gene_ids
            self.save()
852464
def update(self, new_vals):
        
        for k, v in six.iteritems(new_vals):
            k = k.strip()
            if k in self.row:
                warnings.warn("Adding history key ({}) that is already set in this step".format(
                    k), wandb.WandbWarning)
            self.row[k] = v
794507
def update_association(self, association):
        """"""
        bad_goids = set()
        # Loop through all sets of GO IDs for all genes
        for goids in association.values():
            parents = set()
            # Iterate thru each GO ID in the current gene's association
            for goid in goids:
                try:
                    parents.update(self[goid].get_all_parents())
                except:
                    bad_goids.add(goid.strip())
            # Add the GO parents of all GO IDs in the current gene's association
            goids.update(parents)
        if bad_goids:
            sys.stdout.write("{N} GO IDs in assc. are not found in the GO-DAG: {GOs}\n".format(
                N=len(bad_goids), GOs=" ".join(bad_goids)))
1030362
def _update_data(self, trial_job_id, trial_history):
        
        if trial_job_id not in self.running_history:
            self.running_history[trial_job_id] = []
        self.running_history[trial_job_id].extend(trial_history[len(self.running_history[trial_job_id]):])
1017497
def update_loci(self):
    """"""
    # Create sub-loci for each chromosome
    lbc = {}
    chroms = sorted([x.range.chr for x in self.loci])
    for chrom in chroms: lbc[chrom] = Loci()
    for x in self.loci: lbc[x.range.chr].add_locus(x)
    for chrom in sorted(lbc.keys()):
      if self.verbose: 
        lbc[chrom].verbose = True
        sys.stderr.write(chrom+"\n")
      lbc[chrom].overhang = self.overhang
      lbc[chrom].use_direction = self.use_direction
      lbc[chrom].merge_down_loci()
    self.loci = []
    for chrom in sorted(lbc.keys()):
      for locus in lbc[chrom].loci:  self.loci.append(locus)
64910
def _update_solution_data(self, s, HH, CC, C0):
        
        x = s["x"]
        Va_v = self.om.get_var("Va")
        Pg_v = self.om.get_var("Pg")

        Va = x[Va_v.i1:Va_v.iN + 1]
        Pg = x[Pg_v.i1:Pg_v.iN + 1]
#        f = 0.5 * dot(x.T * HH, x) + dot(CC.T, x)

        s["f"] = s["f"] + C0

        # Put the objective function value in the solution.
#        solution["f"] = f

        return Va, Pg
1023824
def _update_pathway_definitions(crosstalk_corrected_index_map,
                                gene_row_names,
                                pathway_column_names):
    
    corrected_pathway_definitions = {}
    for pathway_index, gene_indices in crosstalk_corrected_index_map.items():
        pathway = pathway_column_names[pathway_index]
        genes = set([gene_row_names[index] for index in list(gene_indices)])
        corrected_pathway_definitions[pathway] = genes
    return corrected_pathway_definitions
51742
def _update_dprx(self):
        """"""
        super(ExpCM_empirical_phi, self)._update_dprx()
        if 'beta' in self.freeparams:
            dphi_over_phi = scipy.zeros(N_CODON, dtype='float')
            for j in range(3):
                dphi_over_phi += (self.dphi_dbeta / self.phi)[CODON_NT_INDEX[j]]
            for r in range(self.nsites):
                self.dprx['beta'][r] += self.prx[r] * (dphi_over_phi
                        - scipy.dot(dphi_over_phi, self.prx[r]))
349050
def _add_vcf_header_sample_cl(in_file, items, base_file):
    
    paired = vcfutils.get_paired(items)
    if paired:
        toadd = ["##SAMPLE=<ID=%s,Genomes=Tumor>" % paired.tumor_name]
        if paired.normal_name:
            toadd.append("##SAMPLE=<ID=%s,Genomes=Germline>" % paired.normal_name)
            toadd.append("##PEDIGREE=<Derived=%s,Original=%s>" % (paired.tumor_name, paired.normal_name))
        new_header = _update_header(in_file, base_file, toadd, _fix_generic_tn_names(paired))
        if vcfutils.vcf_has_variants(in_file):
            cmd = "bcftools reheader -h {new_header} | bcftools view "
            return cmd.format(**locals())
223296
def add_phenotype(self, ind_obj, phenotype_id):
        """"""
        if phenotype_id.startswith('HP:') or len(phenotype_id) == 7:
            logger.debug('querying on HPO term')
            hpo_results = phizz.query_hpo([phenotype_id])
        else:
            logger.debug('querying on OMIM term')
            hpo_results = phizz.query_disease([phenotype_id])

        added_terms = [] if hpo_results else None
        existing_ids = set(term.phenotype_id for term in ind_obj.phenotypes)
        for result in hpo_results:
            if result['hpo_term'] not in existing_ids:
                term = PhenotypeTerm(phenotype_id=result['hpo_term'],
                                     description=result['description'])
                logger.info('adding new HPO term: %s', term.phenotype_id)
                ind_obj.phenotypes.append(term)
                added_terms.append(term)

        logger.debug('storing new HPO terms')
        self.save()

        if added_terms is not None and len(added_terms) > 0:
            for case_obj in ind_obj.cases:
                self.update_hpolist(case_obj)

        return added_terms
447446
def _fix_genotypes_object(self, genotypes, variant_info):
        """"""
        # Checking the name (if there were duplications)
        if self.has_index and variant_info.name != genotypes.variant.name:
            if not variant_info.name.startswith(genotypes.variant.name):
                raise ValueError("Index file not synced with IMPUTE2 file")
            genotypes.variant.name = variant_info.name

        # Trying to set multi-allelic information
        if self.has_index and self._index_has_location:
            # Location was in the index, so we can automatically set the
            # multi-allelic state of the genotypes
            genotypes.multiallelic = variant_info.multiallelic

        else:
            # Location was not in the index, so we check one marker before and
            # after the one we found
            logging.warning("Multiallelic variants are not detected on "
                            "unindexed files.")
1165247
def _update_Prxy(self):
        """"""
        self.Prxy = self.Frxy * self.Qxy
        _fill_diagonals(self.Prxy, self._diag_indices)
1092279
public void updateFeatures() {
	for (int i = 0; i < feaGen.features.size(); i++) {
	    Feature f = (Feature)feaGen.features.get(i);
	    f.wgt = lambda[f.idx];    
	}
    }
565687
def update_rho(self, k, r, s):
        """"""

        if self.opt['AutoRho', 'Enabled']:
            tau = self.rho_tau
            mu = self.rho_mu
            xi = self.rho_xi
            if k != 0 and np.mod(k + 1, self.opt['AutoRho', 'Period']) == 0:
                if self.opt['AutoRho', 'AutoScaling']:
                    if s == 0.0 or r == 0.0:
                        rhomlt = tau
                    else:
                        rhomlt = np.sqrt(r / (s * xi) if r > s * xi else
                                         (s * xi) / r)
                        if rhomlt > tau:
                            rhomlt = tau
                else:
                    rhomlt = tau
                rsf = 1.0
                if r > xi * mu * s:
                    rsf = rhomlt
                elif s > (mu / xi) * r:
                    rsf = 1.0 / rhomlt
                self.rho *= self.dtype.type(rsf)
                self.U /= rsf
                if rsf != 1.0:
                    self.rhochange()
284044
def update(self, infos):
        """"""
        genes = [i for i in infos if isinstance(i, LearningGene)]
        for gene in genes:
            if (
                self.network.role == "experiment"
                and self.generation > 0
                and random.random() < 0.10
            ):
                self.mutate(gene)
            else:
                self.replicate(gene)
1247531
def update(self, mapping, prefix=""):
        
        for k, v in mapping.items():
            self.set("%s%s" % (prefix, k), v)
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