Set the phenotype_label column according to our rules for mutual exclusion
2484
def fill_phenotype_label(self,inplace=False):
        
        def _get_phenotype(d):
            vals = [k for k,v in d.items() if v ==  1]
            return np.nan if len(vals) == 0 else vals[0]
        if inplace:
            if self.shape[0] == 0: return self
            self['phenotype_label'] = self.apply(lambda x: _get_phenotype(x['phenotype_calls']),1)
            return
        fixed = self.copy()
        if fixed.shape[0] == 0: return fixed
        fixed['phenotype_label'] = fixed.apply(lambda x: _get_phenotype(x['phenotype_calls']),1)
        return fixed
849454
def SetColumnValues(self, col, value):
        
        try:
            self.dataframe.iloc[:, col] = value
        except ValueError:
            self.dataframe.loc[:, col] = value
1343057
@Override
    public void setConf(Configuration conf) {
        super.setConf(conf);
        featureFirstColumn = conf.getInt(FEATURE_FIRST_COLUMN, 0);
        hasLabel = conf.getBoolean(HAS_LABELS, true);
        multilabel = conf.getBoolean(MULTILABEL, false);
        labelFirstColumn = conf.getInt(LABEL_FIRST_COLUMN, -1);
        labelLastColumn = conf.getInt(LABEL_LAST_COLUMN, -1);
        featureLastColumn = conf.getInt(FEATURE_LAST_COLUMN, labelFirstColumn > 0 ? labelFirstColumn-1 : -1);
        zeroBasedIndexing = conf.getBoolean(ZERO_BASED_INDEXING, false);
        zeroBasedLabelIndexing = conf.getBoolean(ZERO_BASED_LABEL_INDEXING, false);
    }
1077848
def add_subgroup(label, &proc)
      columns = ActiveScaffold::DataStructures::ActionColumns.new
      columns.label = label
      columns.action = action
      columns.configure(&proc)
      exclude columns.collect_columns
      add columns
    end
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.")
1010481
def set_label(self, label, lineno, local=False):
        
        ex_label, namespace = Memory.id_name(label)

        if ex_label in self.local_labels[-1].keys():
            result = self.local_labels[-1][ex_label]
            result.lineno = lineno
        else:
            result = self.local_labels[-1][ex_label] = Label(ex_label, lineno, namespace=NAMESPACE)

        if result.local == local:
            warning(lineno, "label '%s' already declared as LOCAL" % label)

        result.local = local

        return result
935614
def remove_col_label(self, event):#, include_pmag=True):
        
        er_possible_headers = self.grid_headers[self.grid_type]['er'][2]
        pmag_possible_headers = self.grid_headers[self.grid_type]['pmag'][2]
        er_actual_headers = self.grid_headers[self.grid_type]['er'][0]
        pmag_actual_headers = self.grid_headers[self.grid_type]['pmag'][0]
        col = event.GetCol()
        label = self.grid.GetColLabelValue(col)
        if '**' in label:
            label = label.strip('**')
        if label in self.grid_headers[self.grid_type]['er'][1]:
            pw.simple_warning("That header is required, and cannot be removed")
            return False
        #elif include_pmag and label in self.grid_headers[self.grid_type]['pmag'][1]:
        #    pw.simple_warning("That header is required, and cannot be removed")
        #    return False
        else:
            print('That header is not required:', label)
            self.grid.remove_col(col)
            #if label in er_possible_headers:
            try:
                print('removing {} from er_actual_headers'.format(label))
                er_actual_headers.remove(label)
            except ValueError:
                pass
            #if label in pmag_possible_headers:
            try:
                pmag_actual_headers.remove(label)
            except ValueError:
                pass
        # causes resize on each column header delete
        # can leave this out if we want.....
        self.main_sizer.Fit(self)
553232
def repr_setup(self, name=None, col_names=None, col_types=None):
        
        self._name = name or self._name
        self._col_names = col_names or self._col_names
        self._col_types = col_types or self._col_types
        if self._original:
            self._col_names = self._col_names[:len(self._original[0])]
17328
def _setCellClass (self):
        ''' '''
        from .. import sim
        
        # Check whether it's a NeuroML2 based cell
        if 'originalFormat' in self.tags:
            if self.tags['originalFormat'] == 'NeuroML2':
                self.cellModelClass = sim.NML2Cell
            if self.tags['originalFormat'] == 'NeuroML2_SpikeSource':
                self.cellModelClass = sim.NML2SpikeSource

        else:
            # set cell class: CompartCell for compartmental cells of PointCell for point neurons (NetStims, IntFire1,...)
            try: # check if cellModel corresponds to an existing point process mechanism; if so, use PointCell

                    tmp = getattr(h, self.tags['cellModel'])
                    self.cellModelClass = sim.PointCell
                    excludeTags = ['pop', 'cellModel', 'cellType', 'numCells', 'density', 'cellsList',
                                'xRange', 'yRange', 'zRange', 'xnormRange', 'ynormRange', 'znormRange', 'vref', 'spkTimes']
                    params = {k: v for k,v in self.tags.items() if k not in excludeTags}
                    self.tags['params'] = params
                    for k in self.tags['params']: self.tags.pop(k)
                    sim.net.params.popTagsCopiedToCells.append('params')
            except:
                if getattr(self.tags, 'cellModel', None) in ['NetStim', 'VecStim', 'IntFire1', 'IntFire2', 'IntFire4']:
                    print('Warning: could not find %s point process mechanism required for population %s' % (self.tags['cellModel'], self.tags['pop']))
                self.cellModelClass = sim.CompartCell
125625
def label(self):
        """""""

        if self.valuetype_class.is_label():
            return self

        for c in self.table.columns:
            if c.parent == self.name and  c.valuetype_class.is_label():
                return c

        return None
707601
void removeInVertexLabel(VertexLabel lbl, boolean preserveData) {
        this.uncommittedRemovedInVertexLabels.add(lbl);
        if (!preserveData) {
            deleteColumn(lbl.getFullName() + Topology.IN_VERTEX_COLUMN_END);
        }
    }
1221479
def remove_phenotype(self, ind_obj, phenotypes=None):
        """"""
        if phenotypes is None:
            logger.info("delete all phenotypes related to %s", ind_obj.ind_id)
            self.query(PhenotypeTerm).filter_by(ind_id=ind_obj.id).delete()
        else:
            for term in ind_obj.phenotypes:
                if term.phenotype_id in phenotypes:
                    logger.info("delete phenotype: %s from %s",
                                term.phenotype_id, ind_obj.ind_id)
                    self.session.delete(term)
        logger.debug('persist removals')
        self.save()
        for case_obj in ind_obj.cases:
            self.update_hpolist(case_obj)
259574
def make_column_label(command_name, description, default):
    ''''''
    for (pattern, label) in description_map:
        if fnmatch.fnmatch(description, pattern):
            return label
    return default
8652
def setColumns(self, columns):
        
        self.setColumnCount(len(columns))
        self.setHeaderLabels(columns)
975602
def identify(label, column_type = :integer)
      if column_type == :uuid
        NamedSeeds.uuid_v5(label)
      else
        Zlib.crc32(label.to_s) % MAX_ID
      end
    end
165174
def set_labels(self, labels, axis='rows'):
        '''
        
        '''
        if axis.lower() in ('rows', 'row', 'r', 0):
            assigned_pos = set(v[0] for v in self._positions.itervalues())
            not_assigned = set(labels) - assigned_pos
            if len(not_assigned) > 0:
                msg = 'New labels must contain all assigned positions'
                raise ValueError(msg)
            self.row_labels = labels
        elif axis.lower() in ('cols', 'col', 'c', 1):
            self.col_labels = labels
        else:
            raise TypeError('Unsupported axis value %s' % axis)
577547
def randomise_labels(
            self,
            inplace=False,
    ):
        

        if not inplace:
            t = self.copy()
        else:
            t = self

        names = list(t.labels)
        random.shuffle(names)
        for l in t._tree.leaf_node_iter():
            l.taxon._label = names.pop()
        t._dirty = True
        return t