this function renumbers the res ids in order to avoid strange behaviour of Rosetta
174292
def fix_residue_numbering(self):
        """"""

        resid_list = self.aa_resids()
        resid_set  = set(resid_list)
        resid_lst1 = list(resid_set)
        resid_lst1.sort()
        map_res_id = {}

        x = 1
        old_chain = resid_lst1[0][0]
        for resid in resid_lst1:
            map_res_id[resid] = resid[0] + '%4.i' % x
            if resid[0] == old_chain:
                x+=1
            else:
                x = 1
                old_chain = resid[0]

        atomlines = []
        for line in self.lines:
            if line[0:4] == "ATOM" and line[21:26] in resid_set and line[26] == ' ':
                lst = [char for char in line]
                #lst.remove('\n')
                lst[21:26] = map_res_id[line[21:26]]
                atomlines.append( string.join(lst,'') )
                #print string.join(lst,'')
            else:
                atomlines.append(line)

        self.lines = atomlines
        return map_res_id
1239564
def generate_id(*s):
    
    with translation.override("en"):
        generated_id = slugify("-".join([str(i) for i in s]))
    return generated_id
973190
def renumber_system(self, offset):
        

        self.universe.protein = self.universe.select_atoms("protein")
        self.universe.protein.residues.resids = self.universe.protein.residues.resids+int(offset)
519681
public void renumberRowIndex(List<Integer> indices) {
    this.rowNr = this.rowNr != null ? Long.valueOf(indices.get(toIntExact(this.rowNr - 1))) : null;
  }
671060
def clean_meta(rst_content):
    """"""

    rst = rst_content.split('\n')
    for i, line in enumerate(rst):
        if line.startswith('#'):
            continue
        break
    return '\n'.join(rst[i:])
332162
def last_restapi_key_transformer(key, attr_desc, value):
    
    key, value = full_restapi_key_transformer(key, attr_desc, value)
    return (key[-1], value)
730744
def process_ids ids
      case ids
      when Range
        return id_range_to_s(ids)
      when Array
        return id_a_to_s(ids)
      when String
        return ids.delete(" ")
      when Fixnum
        return ids
      end
    end
748640
def _init_idxs_strpat(self, usr_hdrs):
        """"""
        strpat = self.strpat_hdrs.keys()
        self.idxs_strpat = [
            Idx for Hdr, Idx in self.hdr2idx.items() if Hdr in usr_hdrs and Hdr in strpat]
1240523
def renamenodes(idf, fieldtype):
    """"""
    renameds = []
    for key in idf.model.dtls:
        for idfobject in idf.idfobjects[key]:
            for fieldvalue in idfobject.obj:
                if type(fieldvalue) is list:
                    if fieldvalue not in renameds:
                        cpvalue = copy.copy(fieldvalue)
                        renameds.append(cpvalue)

    # do the renaming
    for key in idf.model.dtls:
        for idfobject in idf.idfobjects[key]:
            for i, fieldvalue in enumerate(idfobject.obj):
                itsidd = idfobject.objidd[i]
                if 'type' in itsidd:
                    if itsidd['type'][0] == fieldtype:
                        tempdct = dict(renameds)
                        if type(fieldvalue) is list:
                            fieldvalue = fieldvalue[-1]
                            idfobject.obj[i] = fieldvalue
                        else:
                            if fieldvalue in tempdct:
                                fieldvalue = tempdct[fieldvalue]
                                idfobject.obj[i] = fieldvalue
338484
function normalizeId(idFromRoot, root) {
  var id = idFromRoot.substring().trim();
  if (root && id.length > 0 && id[0] === '/') {
    id = id.substring(1);
  }
  id = root + id;
  return id;
}
765816
def getAtomLinesForResidueInRosettaStructure(self, resid):
        ''''''
        lines = [line for line in self.lines if line[0:4] == "ATOM" and resid == int(line[22:27])]
        if not lines:
            #print('Failed searching for residue %d.' % resid)
            #print("".join([line for line in self.lines if line[0:4] == "ATOM"]))
            raise Exception("Could not find the ATOM/HETATM line corresponding to residue '%(resid)s'." % vars())
        return lines
805731
function replaceReferencedId(value, idFrom, idTo) {
  var re = new RegExp('url\\([\'"]?#' + idFrom + '[\'"]?\\)', 'g');
  return value.replace(re, "url(#" + idTo + ")");

}
59782
def get_id2upper(objs):
    """"""
    id2upper = {}
    for obj in objs:
        _get_id2upper(id2upper, obj.item_id, obj)
    return id2upper
239908
function reformatFormIdAndName(submission) {
  var formName = "Unknown";
  if (submission && submission.formId && submission.formId.name) {
    formName = submission.formId.name;
  }

  if (submission && submission.formSubmittedAgainst) {
    formName = submission.formSubmittedAgainst.name;
  }

  submission.formName = formName;
  submission.formId = submission.formId.toString();
  return submission;
}
841547
def res(arg):
    '''
    
    '''
    def _res(ctx):
        _arg = arg(ctx) if callable(arg) else arg
        return I(arg)
    return _res
719605
def normalize_ids(ids)
      ids.collect(&:to_s).map do |what|
        if what =~ /^[0-9]+$/
          next what.to_i
        else
          next expand_named_query(what)
        end
      end.flatten
    end
1364246
def decode(self, ids, strip_extraneous=False):
    
    if strip_extraneous:
      ids = strip_ids(ids, list(range(self._num_reserved_ids or 0)))
    return unicode_to_native(
        tokenizer.decode(self._subtoken_ids_to_tokens(ids)))