Returns header fields for protein (group) information.
    Some fields are shared between pools, others are specific
    for a pool
334077
def get_proteininfo_fields(poolnames=False, genecentric=False):
    """"""
    allfields = OrderedDict()
    basefields = {
            False: [
                prottabledata.HEADER_GENEID, prottabledata.HEADER_GENENAME,
                prottabledata.HEADER_DESCRIPTION, prottabledata.HEADER_COVERAGE,
                prottabledata.HEADER_NO_PROTEIN, prottabledata.HEADER_CONTENTPROT,
                ],
            'genes': [
                prottabledata.HEADER_GENENAME, prottabledata.HEADER_PROTEINS,
                prottabledata.HEADER_DESCRIPTION],
            'assoc': [
                prottabledata.HEADER_GENEID, prottabledata.HEADER_PROTEINS,
                prottabledata.HEADER_DESCRIPTION],
            }[genecentric]
    poolfields = [prottabledata.HEADER_NO_UNIPEP,
                  prottabledata.HEADER_NO_PEPTIDE,
                  prottabledata.HEADER_NO_PSM,
                  ]
    for field in basefields:
        allfields[field] = False
    for field in poolfields:
        allfields[field] = poolnames
    return allfields
217648
def _collect_headers(self):
        
        res = []

        for prop in self.get_sorted_columns():

            main_infos = self._get_prop_infos(prop)

            if self._is_excluded(prop, main_infos):
                continue

            if isinstance(prop, RelationshipProperty):
                main_infos = self._collect_relationship(main_infos, prop, res)

                if not main_infos:
                    # If still no success, we forgot this one
                    print("Maybe there's missing some informations \
about a relationship")
                    continue
            else:
                main_infos = self._merge_many_to_one_field_from_fkey(
                    main_infos, prop, res
                )
                if not main_infos:
                    continue

            if isinstance(main_infos, (list, tuple)):
                # In case _collect_relationship returned a list
                res.extend(main_infos)
            else:
                res.append(main_infos)
        return res
965669
def _load_data_alignment(self, chain1, chain2):
        
        parser = PDB.PDBParser(QUIET=True)
        ppb = PDB.PPBuilder()

        structure1 = parser.get_structure(chain1, self.pdb1)
        structure2 = parser.get_structure(chain2, self.pdb2)

        seq1 = str(ppb.build_peptides(structure1)[0].get_sequence())
        seq2 = str(ppb.build_peptides(structure2)[0].get_sequence())

        # Alignment parameters taken from PconsFold renumbering script.
        align = pairwise2.align.globalms(seq1, seq2, 2, -1, -0.5, -0.1)[0]
        indexes = set(i for i, (s1, s2) in enumerate(zip(align[0], align[1]))
                      if s1 != '-' and s2 != '-')
        coord1 = np.hstack([np.concatenate((r['CA'].get_coord(), (1,)))[:, None]
                            for i, r in enumerate(structure1.get_residues())
                            if i in indexes and 'CA' in r]).astype(DTYPE,
                                                                   copy=False)
        coord2 = np.hstack([np.concatenate((r['CA'].get_coord(), (1,)))[:, None]
                            for i, r in enumerate(structure2.get_residues())
                            if i in indexes and 'CA' in r]).astype(DTYPE,
                                                                   copy=False)

        self.coord1 = coord1
        self.coord2 = coord2
        self.N = len(seq1)
822974
private Group getNewGroup(String recordName,Character aminoCode1, long seq_id,String groupCode3) {

		Group g = ChemCompGroupFactory.getGroupFromChemCompDictionary(groupCode3);
		if ( g != null && !g.getChemComp().isEmpty()) {
			if ( g instanceof AminoAcidImpl) {
				AminoAcidImpl aa = (AminoAcidImpl) g;
				aa.setId(seq_id);
			} else if ( g instanceof NucleotideImpl) {
				NucleotideImpl nuc =  (NucleotideImpl) g;
				nuc.setId(seq_id);
			} else if ( g instanceof HetatomImpl) {
				HetatomImpl het = (HetatomImpl)g;
				het.setId(seq_id);
			}
			return g;
		}



		Group group;
		if ( recordName.equals("ATOM") ) {
			if (StructureTools.isNucleotide(groupCode3))  {
				// it is a nucleotide
				NucleotideImpl nu = new NucleotideImpl();
				group = nu;
				nu.setId(seq_id);

			} else if (aminoCode1==null || aminoCode1 == StructureTools.UNKNOWN_GROUP_LABEL){
				HetatomImpl h = new HetatomImpl();
				h.setId(seq_id);
				group = h;

			} else {
				AminoAcidImpl aa = new AminoAcidImpl() ;
				aa.setAminoType(aminoCode1);
				aa.setId(seq_id);
				group = aa ;
			}
		}
		else {
			if (StructureTools.isNucleotide(groupCode3))  {
				// it is a nucleotide
				NucleotideImpl nu = new NucleotideImpl();
				group = nu;
				nu.setId(seq_id);
			}
			else if (aminoCode1 != null ) {
				AminoAcidImpl aa = new AminoAcidImpl() ;
				aa.setAminoType(aminoCode1);
				aa.setId(seq_id);
				group = aa ;
			} else {
				HetatomImpl h = new HetatomImpl();
				h.setId(seq_id);
				group = h;
			}
		}
		return  group ;
	}
1357738
def header(self):
        ''''''
        return (super(NestedAdapter, self).header() +
                [name for name, getter in self.get_nested_fields()])
51107
private Group getNewGroup(String recordName,Character aminoCode1, String aminoCode3) {

		Group g =  ChemCompGroupFactory.getGroupFromChemCompDictionary(aminoCode3);
		if ( g != null && !g.getChemComp().isEmpty())
			return g;


		Group group;
		if (aminoCode1 == null || StructureTools.UNKNOWN_GROUP_LABEL == aminoCode1 ){
			group = new HetatomImpl();

		} else if(StructureTools.isNucleotide(aminoCode3))  {
			// it is a nucleotide
			NucleotideImpl nu = new NucleotideImpl();
			group = nu;

		} else {
			AminoAcidImpl aa = new AminoAcidImpl() ;
			aa.setAminoType(aminoCode1);
			group = aa ;
		}

		//		System.out.println("new resNum type: "+ resNum.getType() );
		return  group ;
	}
943979
def get_acs_for_protein_seq(self, seq):
        
        md5 = seq_md5(seq)
        return [r['ac'] for r in self._fetchall(self._queries['acs_for_protein_md5'], [md5])
                ] + ['MD5_' + md5]
872518
def _characterize_header(self, header, hgroups):
        
        out = []
        for h in [header[g[0]] for g in hgroups]:
            this_ctype = None
            for ctype, names in self._col_types.items():
                if h.startswith(names):
                    this_ctype = ctype
                    break
            out.append(this_ctype)
        return out
1052861
def get_headers(environ):
    
    for key, value in environ.iteritems():
        key = str(key)
        if key.startswith('HTTP_') and key not in \
           ('HTTP_CONTENT_TYPE', 'HTTP_CONTENT_LENGTH'):
            yield key[5:].replace('_', '-').title(), value
        elif key in ('CONTENT_TYPE', 'CONTENT_LENGTH'):
            yield key.replace('_', '-').title(), value
73938
def build_proteintable(pqdb, headerfields, mergecutoff, isobaric=False,
                       precursor=False, probability=False, fdr=False,
                       pep=False, genecentric=False):
    """"""
    pdmap = create_featuredata_map(pqdb, genecentric=genecentric,
                                   psm_fill_fun=pinfo.add_psms_to_proteindata,
                                   pgene_fill_fun=pinfo.add_protgene_to_protdata,
                                   count_fun=pinfo.count_peps_psms,
                                   get_uniques=True)
    empty_return = lambda x, y, z: {}
    iso_fun = {True: get_isobaric_quant, False: empty_return}[isobaric]
    ms1_fun = {True: get_precursor_quant, False: empty_return}[precursor]
    prob_fun = {True: get_prot_probability,
                False: empty_return}[probability]
    fdr_fun = {True: get_prot_fdr,
               False: empty_return}[fdr]
    pep_fun = {True: get_prot_pep,
               False: empty_return}[pep]
    pdata_fun = {True: get_protein_data_genecentric,
                 False: get_protein_data}[genecentric is not False]
    protein_sql, sqlfieldmap = pqdb.prepare_mergetable_sql(precursor, isobaric,
                                                           probability, fdr,
                                                           pep)
    accession_field = prottabledata.ACCESSIONS[genecentric]
    proteins = pqdb.get_merged_features(protein_sql)
    protein = next(proteins)
    outprotein = {accession_field: protein[sqlfieldmap['p_acc']]}
    check_prot = {k: v for k, v in outprotein.items()}
    if not mergecutoff or protein_pool_fdr_cutoff(protein, sqlfieldmap,
                                                  mergecutoff):
        fill_mergefeature(outprotein, iso_fun, ms1_fun, prob_fun, fdr_fun,
                          pep_fun, pdata_fun, protein, sqlfieldmap,
                          headerfields, pdmap, accession_field)
    for protein in proteins:
        if mergecutoff and not protein_pool_fdr_cutoff(protein, sqlfieldmap,
                                                       mergecutoff):
            continue
        p_acc = protein[sqlfieldmap['p_acc']]
        if p_acc != outprotein[accession_field]:
            # check if protein has been filled, otherwise do not output
            # sometimes proteins have NA in all fields
            if outprotein != check_prot:
                yield outprotein
            outprotein = {accession_field: p_acc}
            check_prot = {k: v for k, v in outprotein.items()}
        fill_mergefeature(outprotein, iso_fun, ms1_fun, prob_fun, fdr_fun,
                          pep_fun, pdata_fun, protein, sqlfieldmap,
                          headerfields, pdmap, accession_field)
    if outprotein != check_prot:
        yield outprotein
1254990
HpackHeaderField getHeaderField(int index) {
        HeaderEntry entry = head;
        while (index-- >= 0) {
            entry = entry.before;
        }
        return entry;
    }
776951
protected String getGeneSymbol(ProteinReference pr)
	{
		for (Xref xr : pr.getXref())
		{
			String db = xr.getDb();
			if (db != null)
			{
				db = db.toLowerCase();
				if (db.startsWith("hgnc"))
				{
					String id = xr.getId();
					if (id != null)
					{
						String symbol = HGNC.getSymbol(id);
						if (symbol != null && !symbol.isEmpty())
						{
							return symbol;
						}
					}
				}
			}
		}

		return null;
	}
945941
def get_list_header(self):
        
        result = []
        for field_name in self.get_fields():
            item = {}
            if isinstance(field_name, tuple):
                # custom property that is not a field of the model
                item["name"] = field_name[0]
                item["label"] = field_name[1]
            else:
                item["name"] = field_name
                item["label"] = field_name.title()
            if item["name"] in self.get_ordering_fields():
                item["order_url"], item["order_direction"] = self.ordering_url(
                    item["name"]
                )
            result.append(item)

        return result
549781
def headerData(self, section, orientation, role):
        
        if role == Qt.DisplayRole:
            if self._separateFieldOrientation == orientation:

                nFields = len(self._fieldNames)
                varNr = section // nFields
                fieldNr = section % nFields
                header = str(varNr) + ' : ' if self._numbersInHeader else ''
                header += self._fieldNames[fieldNr]
                return header
            else:
                return str(section)
        else:
            return None
759627
def get_proteins_from_psm(line):
    """"""
    proteins = line[mzidtsvdata.HEADER_PROTEIN].split(';')
    outproteins = []
    for protein in proteins:
        prepost_protein = re.sub('\(pre=.*post=.*\)', '', protein).strip()
        outproteins.append(prepost_protein)
    return outproteins
630972
def add_protein_data(proteins, pgdb, headerfields, genecentric=False,
                     pool_to_output=False):
    """"""
    proteindata = create_featuredata_map(pgdb, genecentric=genecentric,
                                         psm_fill_fun=add_psms_to_proteindata,
                                         pgene_fill_fun=add_protgene_to_protdata,
                                         count_fun=count_peps_psms,
                                         pool_to_output=pool_to_output,
                                         get_uniques=True)
    dataget_fun = {True: get_protein_data_genecentric,
                   False: get_protein_data_pgrouped}[genecentric is not False]
    firstfield = prottabledata.ACCESSIONS[genecentric]
    for protein in proteins:
        outprotein = {k: v for k, v in protein.items()}
        outprotein[firstfield] = outprotein.pop(prottabledata.HEADER_PROTEIN)
        protein_acc = protein[prottabledata.HEADER_PROTEIN]
        outprotein.update(dataget_fun(proteindata, protein_acc, headerfields))
        outprotein = {k: str(v) for k, v in outprotein.items()}
        yield outprotein
372439
private List<String> getFieldListFromHeader(BufferedReader reader) {
        // Read the first line and watch out for BOM at the front of the header.
        String header = null;
        try {
            header = reader.readLine();
        } catch (IOException e) {
            // Leave header null
        }
        if (Utils.isEmpty(header)) {
            logErrorThrow("No header found in file");
        }
        if (header.charAt(0) == '\uFEFF') {
            header = header.substring(1);
        }
        
        // Split around commas, though this will include spaces.
        String[] tokens = header.split(",");
        List<String> result = new ArrayList<String>();
        for (String token : tokens) {
            // If this field matches the _ID field, add it with that name.
            String fieldName = token.trim();
            if (fieldName.equals(m_config.id)) {
                result.add(CommonDefs.ID_FIELD);
            } else {
                result.add(token.trim());
            }
        }
        return result;
    }