ultraplex/__main__.py
def remove_mate_adapter(read, to_remove, bcd, trimmed):
    """
    This function looks for the barcoded adapter (UMI-specific, not just Ns) in the mate read. It then checks
    that not too much was removed
    The idea is that if the forward read is B1B2B3B4B5AAAGGG..., where B is the barcode, then:
    to_remove = B1B2B3B4B5
    reverse read = CCCTTTb5b4b3b2b1iiiiii where i is the illumina adapter for the reverse read
    the reverse read then gets trimmed to CCCTTTb5b4b3b2b1
    So now we just look for bbbbb, which is the reverse complement of what was removed
    """

    if trimmed:  # then remove the barcode which should, by definition, be there
        read = read[0:len(read.sequence) - len(bcd)]
    else:
        if len(to_remove) > 0:
            remove_rc = rev_c(to_remove)  # this is now "b5b4b3b2b1"
            adapter = [BackAdapter(remove_rc, max_error_rate=0.1, min_overlap=2)]
            cutter = AdapterCutter(adapter, times=1)
            read = cutter(read, ModificationInfo(read))

    return read

    This function looks for the barcoded adapter (UMI-specific, not just Ns) in the mate read. It then checks
    that not too much was removed
    The idea is that if the forward read is B1B2B3B4B5AAAGGG..., where B is the barcode, then:
    to_remove = B1B2B3B4B5
    reverse read = CCCTTTb5b4b3b2b1iiiiii where i is the illumina adapter for the reverse read
    the reverse read then gets trimmed to CCCTTTb5b4b3b2b1
    So now we just look for bbbbb, which is the reverse complement of what was removed
    
This function looks for the barcoded adapter (UMI-specific, not just Ns) in the mate read. It then checks
that not too much was removed
The idea is that if the forward read is B1B2B3B4B5AAAGGG..., where B is the barcode, then:
to_remove = B1B2B3B4B5
reverse read = CCCTTTb5b4b3b2b1iiiiii where i is the illumina adapter for the reverse read
the reverse read then gets trimmed to CCCTTTb5b4b3b2b1
So now we just look for bbbbb, which is the reverse complement of what was removed
This function looks for the barcoded adapter ( UMI - specific not just Ns ) in the mate read . It then checks that not too much was removed The idea is that if the forward read is B1B2B3B4B5AAAGGG ... where B is the barcode then : to_remove = B1B2B3B4B5 reverse read = CCCTTTb5b4b3b2b1iiiiii where i is the illumina adapter for the reverse read the reverse read then gets trimmed to CCCTTTb5b4b3b2b1 So now we just look for bbbbb which is the reverse complement of what was removed
def remove_mate_adapter(read, to_remove, bcd, trimmed):
    if trimmed:  
        read = read[0:len(read.sequence) - len(bcd)]
    else:
        if len(to_remove) > 0:
            remove_rc = rev_c(to_remove)  
            adapter = [BackAdapter(remove_rc, max_error_rate=0.1, min_overlap=2)]
            cutter = AdapterCutter(adapter, times=1)
            read = cutter(read, ModificationInfo(read))
    return read
def remove_mate_adapter ( read , to_remove , bcd , trimmed ) : if trimmed : read = read [ 0 : len ( read . sequence ) - len ( bcd ) ] else : if len ( to_remove ) > 0 : remove_rc = rev_c ( to_remove ) adapter = [ BackAdapter ( remove_rc , max_error_rate = 0.1 , min_overlap = 2 ) ] cutter = AdapterCutter ( adapter , times = 1 ) read = cutter ( read , ModificationInfo ( read ) ) return read
This function looks for the barcoded adapter (UMI-specific, not just Ns) in the mate read.
This function looks for the barcoded adapter ( UMI - specific not just Ns ) in the mate read .
"""
    This function looks for the barcoded adapter (UMI-specific, not just Ns) in the mate read. It then checks
    that not too much was removed
    The idea is that if the forward read is B1B2B3B4B5AAAGGG..., where B is the barcode, then:
    to_remove = B1B2B3B4B5
    reverse read = CCCTTTb5b4b3b2b1iiiiii where i is the illumina adapter for the reverse read
    the reverse read then gets trimmed to CCCTTTb5b4b3b2b1
    So now we just look for bbbbb, which is the reverse complement of what was removed
    """ # then remove the barcode which should, by definition, be there
 # this is now "b5b4b3b2b1"

read
to_remove
bcd
trimmed