Returns dicts with header-keys and psm statistic values
179109
def generate_split_tsv_lines(fn, header):
    """"""
    for line in generate_tsv_psms_line(fn):
        yield {x: y for (x, y) in zip(header, line.strip().split('\t'))}
168903
def _identify_dict(core):
    """"""
    if not core:
        return {}, 1, (), int

    core = core.copy()
    key = sorted(core.keys(), key=chaospy.poly.base.sort_key)[0]
    shape = numpy.array(core[key]).shape
    dtype = numpy.array(core[key]).dtype
    dim = len(key)
    return core, dim, shape, dtype
220760
def get_psms(self):
        """"""
        self.header = actions.create_header(self.oldheader, self.spectracol)
        self.psms = actions.generate_psms_spectradata(self.lookup, self.fn,
                                                      self.oldheader)
43556
def get_headers(hide_env=True):
    """"""

    headers = dict(request.headers.items())

    if hide_env and ('show_env' not in request.args):
        for key in ENV_HEADERS:
            try:
                del headers[key]
            except KeyError:
                pass

    return CaseInsensitiveDict(headers.items())
364562
def combined_dict(*dicts):
  """"""
  return {k: v for d in dicts for k, v in d.items()}
1262107
def map_keys(pvs, keys):
    
    rs = []
    for pv in pvs:
        r = dict((v, None) for k, v in keys.items())
        for k, v in pv.items():
            if k in keys:
                r[keys[k]] = v
            r[k] = v
        rs.append(r)
    return rs
1120682
def stats_to_list(stats_dict, localize=pytz):
    
    result = stats_dict['GetSendStatisticsResponse']['GetSendStatisticsResult']
    # Make a copy, so we don't change the original stats_dict.
    result = copy.deepcopy(result)
    datapoints = []
    if localize:
        current_tz = localize.timezone(settings.TIME_ZONE)
    else:
        current_tz = None
    for dp in result['SendDataPoints']:
        if current_tz:
            utc_dt = datetime.strptime(dp['Timestamp'], '%Y-%m-%dT%H:%M:%SZ')
            utc_dt = localize.utc.localize(utc_dt)
            dp['Timestamp'] = current_tz.normalize(
                utc_dt.astimezone(current_tz))
        datapoints.append(dp)

    datapoints.sort(key=lambda x: x['Timestamp'])

    return datapoints
163114
def get_headers(server):
    """"""
    try:
        response = requests.head(
            server, allow_redirects=False, verify=False, timeout=5)
    except requests.exceptions.ConnectionError:
        return False

    return dict(response.headers)
533091
def as_dict(self):
        
        d = {"@module": self.__class__.__module__,
             "@class": self.__class__.__name__,
             "structure": self.structure.as_dict(),
             "frequencies": list(self.frequencies),
             "densities": list(self.densities),
             "pdos": []}
        if len(self.pdos) > 0:
            for at in self.structure:
                d["pdos"].append(list(self.pdos[at]))
        return d
1088665
def tophat_general_stats_table(self):
        

        headers = OrderedDict()
        headers['overall_aligned_percent'] = {
            'title': '% Aligned',
            'description': 'overall read mapping rate',
            'max': 100,
            'min': 0,
            'suffix': '%',
            'scale': 'YlGn'
        }
        headers['aligned_not_multimapped_discordant'] = {
            'title': '{} Aligned'.format(config.read_count_prefix),
            'description': 'Aligned reads, not multimapped or discordant ({})'.format(config.read_count_desc),
            'min': 0,
            'scale': 'PuRd',
            'modify': lambda x: x * config.read_count_multiplier,
            'shared_key': 'read_count'
        }
        self.general_stats_addcols(self.tophat_data, headers)
798050
def get_metadata(headers):
  """"""
  return dict((k, v) for k, v in headers.iteritems()
              if any(k.lower().startswith(valid) for valid in _GCS_METADATA))
1069970
def get_stats_dict(a_in, full=True):
    
    d = {}
    a = checkma(a_in)
    d['count'] = a.count()
    thresh = 4E6
    if not full and d['count'] > thresh:
        a = a.compressed()
        stride = int(np.around(a.size / thresh))
        #a = np.ma.array(a[::stride])
        a = a[::stride]
    d['min'] = a.min()
    d['max'] = a.max()
    d['ptp'] = d['max'] - d['min']
    d['mean'] = a.mean(dtype='float64')
    d['std'] = a.std(dtype='float64')
    d['nmad'], d['med'] = mad(a, return_med=True)
    d['median'] = d['med']
    d['p16'], d['p84'], d['spread'] = robust_spread(a)
    from scipy.stats.mstats import mode 
    d['mode'] = mode(a, axis=None)[0]
    for i in d:
        d[i] = float(d[i])
    d['count'] = int(d['count'])
    return d
729420
def render_headers(self):
        
        lines = []

        sort_keys = ['Content-Disposition', 'Content-Type', 'Content-Location']
        for sort_key in sort_keys:
            if self.headers.get(sort_key, False):
                lines.append('%s: %s' % (sort_key, self.headers[sort_key]))

        for header_name, header_value in self.headers.items():
            if header_name not in sort_keys:
                if header_value:
                    lines.append('%s: %s' % (header_name, header_value))

        lines.append('\r\n')
        return '\r\n'.join(lines)
1264768
def get_prottable_headerfields(headertypes, lookup=False, poolnames=False, genecentric=False):
    """"""
    field_defs = {'isoquant': get_isoquant_fields,
                  'precursorquant': get_precursorquant_fields,
                  'probability': get_probability_fields,
                  'proteindata': get_proteininfo_fields,
                  'proteinfdr': get_proteinfdr_fields,
                  'proteinpep': get_proteinpep_fields,
                  'bestpepscore': get_bestpeptide_fields,
                  }
    return generate_headerfields(headertypes, field_defs, poolnames, lookup, genecentric)
53981
def __convert_keys_1(self, header, d):
        
        d2 = {}
        try:
            for k, v in d.items():
                try:
                    d2[self.__get_noaa_key_w_context(header, k)] = v
                except KeyError:
                    pass
        except Exception:
            return d
        return d2
1164002
def build_header_parsers():
    
    result = {
        "ALT": MappingHeaderLineParser(header.AltAlleleHeaderLine),
        "contig": MappingHeaderLineParser(header.ContigHeaderLine),
        "FILTER": MappingHeaderLineParser(header.FilterHeaderLine),
        "FORMAT": MappingHeaderLineParser(header.FormatHeaderLine),
        "INFO": MappingHeaderLineParser(header.InfoHeaderLine),
        "META": MappingHeaderLineParser(header.MetaHeaderLine),
        "PEDIGREE": MappingHeaderLineParser(header.PedigreeHeaderLine),
        "SAMPLE": MappingHeaderLineParser(header.SampleHeaderLine),
        "__default__": StupidHeaderLineParser(),  # fallback
    }
    return result
287110
def get_from_headers(request, key):
    
    value = request.headers.get(key)
    return to_native(value)