def __init__(self, block_assignments, **kwargs): """Initialise CustomAssingmentQueryNameFlagger Args: block_assignments(list) : list of two letter codes to assign blocks to """ self.block_assignments = block_assignments self.origin_colons = 7 # amount of ':' in original read name # Verify if all of the assignments are 2 letters: if not all((len(b) == 2 for b in block_assignments)): for b in block_assignments: if len(b) != 2: raise ValueError(f'Tag {b} is not two letters long') DigestFlagger.__init__(self, **kwargs)
def __init__(self, reference, **kwargs): DigestFlagger.__init__(self, **kwargs) self.overlap_tag = 'XM' self.reference = reference if self.reference is None: raise ValueError('A reference fasta file is required!') """ z unmethylated C in CpG context (CG) Z methylated C in CpG context (CG) x unmethylated C in CHG context ( C[ACT]G ) X methylated C in CHG context ( C[ACT]G ) h unmethylated C in CHH context ( C[ACT][ACT] ) H methylated C in CHH context ( C[ACT][ACT] ) """ self.context_mapping = {} self.context_mapping[False] = { 'CGA': 'z', 'CGT': 'z', 'CGC': 'z', 'CGG': 'z', # CHG: 'CAG': 'x', 'CCG': 'x', 'CTG': 'x', } self.context_mapping[True] = { context: letter.upper() for context, letter in self.context_mapping[False].items() } # CHH: # h unmethylated C in CHH context ( C[ACT][ACT] ) for x in list(itertools.product('ACT', repeat=2)): self.context_mapping[True][''.join(['C'] + list(x))] = 'H' self.context_mapping[False][''.join(['C'] + list(x))] = 'h'
def __init__(self, **kwargs): DigestFlagger.__init__(self, **kwargs)
def __init__(self, **kwargs): self.assignedReadGroups = set() DigestFlagger.__init__(self, **kwargs)
def __init__(self, **kwargs): DigestFlagger.__init__(self, **kwargs) if self.reference is None: raise ValueError( 'The MSPJI digest flagger requires a reference genome file (FASTA)' )
def __init__(self, tag=None, **kwargs): DigestFlagger.__init__(self, **kwargs) if tag is None or (tag != 'chrom' and len(tag) != 2): raise ValueError(f'Invalid tag:{tag}') self.tag = tag