Get pandas.DataFrame with metadata about the PWM's. Columns:

    - PWM_id (id of the PWM - pass to get_pwm_list() for getting the pwm
    - info1 - additional information about the motifs
    - info2
    - consensus: PWM consensus sequence
551195
def get_metadata():
    
    motifs = _load_motifs()

    motif_names = sorted(list(motifs.keys()))
    df = pd.Series(motif_names).str.split(expand=True)
    df.rename(columns={0: "PWM_id", 1: "info1", 2: "info2"}, inplace=True)

    # compute the consensus
    consensus = pd.Series([PWM(motifs[m]).get_consensus() for m in motif_names])
    df["consensus"] = consensus
    return df
151561
def get_current_frames():
    
    return dict(
        (thread_id, {'frame': thread2list(frame), 'time': None})
        for thread_id, frame in sys._current_frames().items()
    )
1130851
def get_attrs(self):
        
        self.non_index_axes = getattr(
            self.attrs, 'non_index_axes', None) or []
        self.data_columns = getattr(
            self.attrs, 'data_columns', None) or []
        self.info = getattr(
            self.attrs, 'info', None) or dict()
        self.nan_rep = getattr(self.attrs, 'nan_rep', None)
        self.encoding = _ensure_encoding(
            getattr(self.attrs, 'encoding', None))
        self.errors = _ensure_decoded(getattr(self.attrs, 'errors', 'strict'))
        self.levels = getattr(
            self.attrs, 'levels', None) or []
        self.index_axes = [
            a.infer(self) for a in self.indexables if a.is_an_indexable
        ]
        self.values_axes = [
            a.infer(self) for a in self.indexables if not a.is_an_indexable
        ]
        self.metadata = getattr(
            self.attrs, 'metadata', None) or []
113804
def _get_sma(cls, df, column, windows):
        
        window = cls.get_only_one_positive_int(windows)
        column_name = '{}_{}_sma'.format(column, window)
        df[column_name] = df[column].rolling(min_periods=1, window=window,
                                             center=False).mean()
1165545
def as_id_dict(self):
		
		d = {}
		for row in self:
			if row.experiment_id not in d:
				d[row.experiment_id] = {}
			if (row.time_slide_id, row.veto_def_name, row.datatype, row.sim_proc_id) in d[row.experiment_id]:
				# entry already exists, raise error
				raise KeyError("duplicate entries in experiment_summary table")
			d[row.experiment_id][(row.time_slide_id, row.veto_def_name, row.datatype, row.sim_proc_id)] = row.experiment_summ_id

		return d
475631
def get_dataframe(self, sort_key="wall_time", **kwargs):
        
        import pandas as pd
        frame = pd.DataFrame(columns=AbinitTimerSection.FIELDS)

        for osect in self.order_sections(sort_key):
            frame = frame.append(osect.to_dict(), ignore_index=True)

        # Monkey patch
        frame.info =  self.info
        frame.cpu_time =  self.cpu_time
        frame.wall_time =  self.wall_time
        frame.mpi_nprocs =  self.mpi_nprocs
        frame.omp_nthreads =  self.omp_nthreads
        frame.mpi_rank =  self.mpi_rank
        frame.fname =  self.fname

        return frame
815144
def _get_data(self) -> BaseFrameManager:
        

        def iloc(partition, row_internal_indices, col_internal_indices):
            return partition.iloc[row_internal_indices, col_internal_indices]

        masked_data = self.parent_data.apply_func_to_indices_both_axis(
            func=iloc,
            row_indices=self.index_map.values,
            col_indices=self.columns_map.values,
            lazy=False,
            keep_remaining=False,
        )
        return masked_data
1291013
def get_metadata(engine_name=None):
    
    dispatch.get(None, 'load_models')

    engine = engine_manager[engine_name]
    
    for tablename, m in engine.models.items():
        get_model(tablename, engine_name, signal=False)
        if hasattr(m, '__dynamic__') and getattr(m, '__dynamic__'):
            m.table.__mapping_only__ = True
    return engine.metadata
251443
def _get_pdm(cls, df, windows):
        
        window = cls.get_only_one_positive_int(windows)
        column_name = 'pdm_{}'.format(window)
        um, dm = df['um'], df['dm']
        df['pdm'] = np.where(um > dm, um, 0)
        if window > 1:
            pdm = df['pdm_{}_ema'.format(window)]
        else:
            pdm = df['pdm']
        df[column_name] = pdm
1250020
def _get_s(cls, df, column, shifts):
        
        shift = cls.to_int(shifts)
        shifted_key = "{}_{}_s".format(column, shift)
        df[shifted_key] = df[column].shift(-shift)
        StockDataFrame.set_nan(df[shifted_key], shift)
548865
def information_content(self):
        
        ic = 0
        for row in self.pwm:
            ic += 2.0 + np.sum([row[x] * log(row[x])/log(2) for x in range(4) if row[x] > 0])
        return ic
678391
def get_column_info(engine: Engine, tablename: str,
                    columnname: str) -> Optional[SqlaColumnInspectionInfo]:
    
    for info in gen_columns_info(engine, tablename):
        if info.name == columnname:
            return info
    return None
1286512
def get_ptms(self, ptm_df):
        
        logger.info('Processing PTMs...')
        # Iterate over the rows of the dataframe
        for ix, row in ptm_df.iterrows():
            # Check the modification type; if we can't make an INDRA statement
            # for it, then skip it
            ptm_class = _ptm_map[row['MOD_TYPE']]
            if ptm_class is None:
                continue
            # Use the Refseq protein ID for the substrate to make sure that
            # we get the right Uniprot ID for the isoform
            sub_ag = self._make_agent(row['HPRD_ID'],
                                      refseq_id=row['REFSEQ_PROTEIN'])

            # If we couldn't get the substrate, skip the statement
            if sub_ag is None:
                continue
            enz_id = _nan_to_none(row['ENZ_HPRD_ID'])
            enz_ag = self._make_agent(enz_id)
            res = _nan_to_none(row['RESIDUE'])
            pos = _nan_to_none(row['POSITION'])
            if pos is not None and ';' in pos:
                pos, dash = pos.split(';')
                assert dash == '-'
            # As a fallback for later site mapping, we also get the protein
            # sequence information in case there was a problem with the
            # RefSeq->Uniprot mapping
            assert res
            assert pos
            motif_dict = self._get_seq_motif(row['REFSEQ_PROTEIN'], res, pos)
            # Get evidence
            ev_list = self._get_evidence(
                    row['HPRD_ID'], row['HPRD_ISOFORM'], row['PMIDS'],
                    row['EVIDENCE'], 'ptms', motif_dict)
            stmt = ptm_class(enz_ag, sub_ag, res, pos, evidence=ev_list)
            self.statements.append(stmt)
396515
def df_kegg_metadata(self):
        """"""
        kegg_pre_df = []
        df_cols = ['gene', 'kegg', 'refseq', 'uniprot', 'num_pdbs', 'pdbs', 'seq_len', 'sequence_file', 'metadata_file']

        for g in self.genes:
            kegg_mappings = g.protein.filter_sequences(KEGGProp)
            for kegg_prop in kegg_mappings:
                kegg_dict = kegg_prop.get_dict(df_format=True, only_attributes=df_cols)
                kegg_dict['gene'] = g.id
                kegg_pre_df.append(kegg_dict)

        # Save a dataframe of the file mapping info
        df = pd.DataFrame.from_records(kegg_pre_df, columns=df_cols).set_index('gene')
        if df.empty:
            log.warning('Empty dataframe')
            return df
        else:
            return ssbio.utils.clean_df(df)
299184
def get_dataframes(symbols=("sne", "goog", "tsla"), source='yahoo', refresh=False):
    
    symbols = util.make_symbols(list(symbols))
    if refresh:
        symbols_to_refresh = symbols
    else:
        symbols_to_refresh = [sym for sym in symbols if not Equity.objects.filter(symbol=sym).exists()]
    source = source.lower().strip()
    if source in ('yahoo', 'google'):
        source += '_finance'
    if source[:3] == 'fed':
        source = 'federal_reserve_economic_data'
    ccpanda = ccp.ConcurrentPandas()
    # set the data source
    getattr(ccpanda, "set_source_" + source)()
    if symbols_to_refresh:
        # tell concurrent pandas which keys/symbols to retrieve
        ccpanda.insert_keys(symbols_to_refresh)
        # start concurrentpandas threads
        ccpanda.consume_keys_asynchronous_threads()
        # FIXME: is there a better/faster iterator to use like `ccpanda.output_map` attribute?
        pseudodict = ccpanda.return_map()
    else:
        pseudodict = {}
    table = {}
    for sym in symbols:
        e, created = None, False
        if not sym in symbols_to_refresh:
            e, created = Equity.objects.get_or_create(symbol=sym)
        if created or not e or not e.time_series or sym in symbols_to_refresh:
            e, created = Equity.objects.get_or_create(
                symbol=sym,
                name=sym,  # FIXME: use data source to find equity name!
                time_series=pseudodict[sym].to_json(),
                )
        table[sym] = pd.io.json.read_json(path_or_buf=e.time_series, orient='columns', typ='frame', convert_dates=True)
    return table
817793
def _set_pwm(self, raw_values):
        
        for i in range(len(self._pins)):
            self._device.set_pwm(self._pins[i], 0, raw_values[i])
48687
def help_dataframe_memory(self):
        
        help =  '%sMaking a DataFrame: %s how to make a dataframe from memory_forensics sample' % (color.Yellow, color.Green)
        help += '\n\n%sMemory Images Example:'  % (color.Green)
        help += '\n\t%s> load_sample /path/to/pcap/exemplar4.vmem [\'bad\', \'aptz13\']' % (color.LightBlue)
        help += '\n\t%s> view # view is your friend use it often' % (color.LightBlue)
        help += '\n\t%s> <<< TODO :) >>> %s' % (color.LightBlue, color.Normal)
        return help