X BOL wishing you a very and Happy New year

Alternative content

Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




  • BioScripts
  • Neel
  • Python script to split a genome sequence into overlapping windows of 100 base pairs

Python script to split a genome sequence into overlapping windows of 100 base pairs

  • Public
By Neel 13 days ago
def split_genome(sequence, window_size=100, step=1): """ Splits a genome sequence into overlapping windows. Args: sequence (str): The genome sequence. window_size (int): Size of each window (default: 100). step (int): Step size for overlapping (default: 1). Returns: list: A list of genome windows. """ windows = [] for i in range(0, len(sequence) - window_size + 1, step): windows.append(sequence[i:i + window_size]) return windows # Example usage: if __name__ == "__main__": genome_sequence = "ATGCGTACGTTAGCTACGATCGTACGATCGTACGATCGATCGTAGCATCGATCGTACG" window_size = 100 step_size = 1 # Get overlapping windows genome_windows = split_genome(genome_sequence, window_size, step_size) # Print results for idx, window in enumerate(genome_windows): print(f"Window {idx + 1}: {window}")