INNER CODE UNIT · Python
prepare_exons_for_cesar
hillerlab/TOGA · CESAR_wrapper.py:506
def prepare_exons_for_cesar(exon_seqs):
"""Cesar requires some special formatting for exons."""
# CESAR requires a special king of reference exons formatting
# Split codons should be written in lowercase, as follows:
# ATGTTTa ctGTAAAGTGCc ttAGTTGA
verbose("prepare_exons_for_cesar")
left_pointer = 0 # init value
cesar_input_exons = {} # accumulate result here
for k, exon_seq in exon_seqs.items():
# define number of letters to lowercase at the right side
right_pointer = (len(exon_seq) - left_pointer) % 3
# apply left pointer
if left_pointer != 3: # it it were accumulated 3 bases it has no sense like 0
exon_seq_lfix = (
exon_seq[:left_pointer].lower() + exon_seq[left_pointer:].upper()
)
else: # don't touch if left_pointer == 0 or == 3