INNER CODE UNIT · Python
scrub
MariaNattestad/assemblytics · assemblytics/dot_prep.py:14
def scrub(string):
return string.replace(",","_").replace("!","_").replace("~","_").replace("#", "_")
def natural_key(string_):
"""See http://www.codinghorror.com/blog/archives/001018.html"""
return [int(s) if s.isdigit() else s for s in re.split(r'(\d+)', string_)]
def index_for_dot(reference_lengths, fields_by_query, output_prefix, max_overview_alignments):
# Find the order of the reference chromosomes
reference_lengths.sort(key=lambda x: natural_key(x[0]))
# Find the cumulative sums
cumulative_sum = 0
ref_chrom_offsets = {}
queries_by_reference = {}