INNER CODE UNIT · Python

a2b

timoast/sinto · sinto/addbarcodes.py:5

def a2b(s, inverse=False):
    # just a silly function to convert ascii <-> binary
    if inverse:
        return s.decode('ascii')
    return bytes(s, encoding='ascii')


def correct_barcodes(barcodes, whitelist):
    """
    Use a whitelist computed with some external tool (such as UMI-tools)
    to correct the barcodes. This could be useful whenever the fastq file with 
    cell barcodes does not contain corrected barcodes.
    """
    if type(whitelist) == dict:
        # whitelist is derived from UMI-tools
        # create a dict where everything is corrected to itself
        u_barcodes = set(barcodes)
        corrected = dict(zip(u_barcodes, u_barcodes))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…