Skip to content

Instantly share code, notes, and snippets.

View victorsanchezarevalo's full-sized avatar

vjsanchez victorsanchezarevalo

View GitHub Profile
from collections import defaultdict
from pathlib import Path
def find_motifs_from_file(file_path, kmer_length=6):
"""
Reads a text file with DNA sequences, one per line, using pathlib and finds the most frequent k-mers.
Parameters:
- file_path (str): The path to the text file containing the DNA sequences.
- kmer_length (int): The length of the k-mers to consider in the motif search.