Convert a mapping to a fake PSL line

    :param ref: reference genome dictionary
    :type ref: dict()
    :return: psl line
    :rtype: string
492212
def transcript_to_fake_psl_line(self,ref):
    
    self._initialize()
    e = self
    mylen = 0
    matches = 0
    qstartslist = []
    for exon in self.exons:
      mylen = exon.rng.length()
      matches += mylen
      qstartslist.append(matches-mylen)
    qstarts = ','.join([str(x) for x in qstartslist])+','
    oline =  str(matches)+"\t" # 1
    oline += "0\t" # 2
    oline += "0\t" # 3
    oline += "0\t" # 4
    oline += "0\t" # 5
    oline += "0\t" # 6
    oline += "0\t" # 7
    oline += "0\t" # 8
    oline += e.get_strand()+"\t" # 9
    oline += e.get_transcript_name()+"\t" # 10
    oline += str(matches)+"\t" # 11
    oline += "0\t" # 12
    oline += str(matches)+"\t" # 13
    oline += e.get_chrom()+"\t" # 14
    oline += str(len(ref[e.get_chrom()]))+"\t" # 15
    oline += str(e.exons[0].rng.start-1)+"\t" # 16
    oline += str(e.exons[-1].rng.end)+"\t" # 17
    oline += str(len(e.exons))+"\t" # 18
    oline += ','.join([str(e.exons[x].rng.end-(e.exons[x].rng.start-1)) for x in range(0,len(e.exons))])+','+"\t" # 19
    oline += qstarts + "\t" # 20
    oline += ','.join([str(x.rng.start-1) for x in e.exons])+',' # 21
    return oline
174729
def ref_string_matches_dict_of_ref_sequences(self, ref_sequences):
        ''''''
        return self.CHROM in ref_sequences and self.ref_string_matches_ref_sequence(ref_sequences[self.CHROM])
382436
def refs_to(cls, sha1, repo):
        """"""
        matching = []
        for refname in repo.listall_references():
            symref = repo.lookup_reference(refname)
            dref = symref.resolve()
            oid = dref.target
            commit = repo.get(oid)
            if commit.hex == sha1:
                matching.append(symref.shorthand)

        return matching
807261
def convert_references_json(ref_content, soup=None):
    ""

    # Convert reference to unkonwn if still missing important values
    if (
        (ref_content.get("type") == "other")
        or
        (ref_content.get("type") == "book-chapter" and "editors" not in ref_content)
        or
        (ref_content.get("type") == "journal" and "articleTitle" not in ref_content)
        or
        (ref_content.get("type") in ["journal", "book-chapter"]
         and not "pages" in ref_content)
        or
        (ref_content.get("type") == "journal" and "journal" not in ref_content)
        or
        (ref_content.get("type") in ["book", "book-chapter", "report", "thesis", "software"]
         and "publisher" not in ref_content)
        or
        (ref_content.get("type") == "book" and "bookTitle" not in ref_content)
        or
        (ref_content.get("type") == "data" and "source" not in ref_content)
        or
        (ref_content.get("type") == "conference-proceeding" and "conference" not in ref_content)
       ):
        ref_content = references_json_to_unknown(ref_content, soup)

    return ref_content
597246
def parse_references(cls, filename):
        
        references = set()
        for line in open(filename):
            matched = cls.RE_REF.match(line)
            if matched:
                reference = matched.group('path')
                reference_base = os.path.splitext(reference)[0]
                references.add(reference_base)
        return references
130419
def remap_index_fn(ref_file):
    
    return os.path.join(os.path.dirname(os.path.dirname(ref_file)), "star")
992546
def remap_index_fn(ref_file):
    
    checks = [os.path.splitext(ref_file)[0].replace("/seq/", "/novoalign/"),
              os.path.splitext(ref_file)[0] + ".ndx",
              ref_file + ".bs.ndx",
              ref_file + ".ndx"]
    for check in checks:
        if os.path.exists(check):
            return check
    return checks[0]
650819
def parse_package_ref(self, ref):
        
        if not ref:
            return None
        parsed = re.match('(.*)\ (.*)\ (.*)\ (.*)', ref)
        return parsed.groups()
1359309
def p_type_ref(self, p):
        ''
        p[0] = AstTypeRef(
            path=self.path,
            lineno=p.lineno(1),
            lexpos=p.lexpos(1),
            name=p[1],
            args=p[2],
            nullable=p[3],
            ns=None,
        )
1148338
def transform(self, ref, strict=False):
        
        scheme, authority, path, query, fragment = self.RE.match(ref).groups()

        # RFC 3986 5.2.2. Transform References
        if scheme is not None and (strict or scheme != self.scheme):
            path = self.__remove_dot_segments(path)
        elif authority is not None:
            scheme = self.scheme
            path = self.__remove_dot_segments(path)
        elif not path:
            scheme = self.scheme
            authority = self.authority
            path = self.path
            query = self.query if query is None else query
        elif path.startswith(self.SLASH):
            scheme = self.scheme
            authority = self.authority
            path = self.__remove_dot_segments(path)
        else:
            scheme = self.scheme
            authority = self.authority
            path = self.__remove_dot_segments(self.__merge(path))
        return type(self)(scheme, authority, path, query, fragment)
791990
def _get_absolute_reference(self, ref_key):
        """"""

        key_str = u", ".join(map(str, ref_key))
        return u"S[" + key_str + u"]"
329204
def convert_ref3d(token, _class)
    # Split the ref at the ! symbol
    ext_ref, cell = token.split('!')

    # Convert the external reference part
    ext_ref = pack_ext_ref(ext_ref)

    # Convert the cell reference part
    row, col = cell_to_packed_rowcol(cell)

    # The ptg value depends on the class of the ptg.
    if    (_class == 0)
      ptgref = [@ptg['ptgRef3d']].pack("C")
    elsif (_class == 1)
      ptgref = [@ptg['ptgRef3dV']].pack("C")
    elsif (_class == 2)
      ptgref = [@ptg['ptgRef3dA']].pack("C")
    else
      exit "Unknown function class in formula\n"
    end

    ptgref + ext_ref + row + col
  end
848454
def get_reference_genome_file(refseqdir, build):
    
    if not os.path.exists(refseqdir) or not os.path.isdir(refseqdir):
        raise ValueError("No directory at {}".format(refseqdir))
    twobit_name = ''
    if build in ['b37', 'build 37', 'build37', '37', 'hg19']:
        twobit_name = 'hg19.2bit'
        build = 'build37'
    if not twobit_name:
        raise ValueError('Genome bulid "{}" not supported.'.format(build))
    twobit_path = os.path.join(refseqdir, twobit_name)
    if not os.path.exists(twobit_path):
        twobitdownload.save_genome('hg19', destdir=refseqdir)
    return twobit_path, twobit_name
1055290
def _bse_cli_get_refs(args):
    ''''''
    return api.get_references(
        basis_name=args.basis, elements=args.elements, version=args.version, fmt=args.reffmt, data_dir=args.data_dir)
387518
def _print_refs(self, fobj, refs, total, level=1, minsize=0, minpct=0.1):
        
        lrefs = list(refs)
        lrefs.sort(key=lambda x: x.size)
        lrefs.reverse()
        if level == 1:
            fobj.write('<table>\n')
        for ref in lrefs:
            if ref.size > minsize and (ref.size*100.0/total) > minpct:
                data = dict(level=level,
                            name=trunc(str(ref.name), 128),
                            size=pp(ref.size),
                            pct=ref.size*100.0/total)
                fobj.write(self.refrow % data)
                self._print_refs(fobj, ref.refs, total, level=level+1)
        if level == 1:
            fobj.write("</table>\n")
496476
def convert(data, _first)
      data
        .reject { |o| o['refseq_protein_ids'].empty? }
        .map do |o|
          "#{o['peptide']}\tref|#{o['refseq_protein_ids']}|\t100\t10\t0\t0\t0\t10\t0\t10\t1e-100\t100\n"
        end
        .join
    end
204661
def ref(self):
        

        sds_ref = _C.SDidtoref(self._id)
        _checkErr('idtoref', sds_ref, 'illegal SDS identifier')
        return sds_ref