<commit_before>from ..db import get_db
from ..sequence import get_chrominfo


def chromosomes(genome_id):
    """Fetch fasta file name for this genome
        open file with pyfaidx
        get list of chromosomes and fetch their 'chrom_id': len
        retun [{'chrom_id': lenght},]
    """
    db = get_db
    query = """SELECT filename
               FROM metadata
               WHERE genome=? AND datatype=sequence"""
    cursor = db.cursor()
    cursor.execute(query, (genome_id, ))
    filename = cursor.fetchone()['filename']
    chrominfo = get_chrominfo(filename)
    return chrominfo<commit_msg>Implement chromosomes function in genomes<commit_after>from ..db import get_db
from ..sequence import get_chrominfo


def chromosomes(genome_id):
    """Fetch fasta file name for this genome
        open file with pyfaidx
        get list of chromosomes and fetch their 'chrom_id': len
        retun [{'chrom_id': lenght},]
    """
    db = get_db()
    query = """SELECT filename
               FROM metadata
               WHERE genome=? AND datatype='sequence'"""
    cursor = db.cursor()
    cursor.execute(query, (genome_id, ))
    filename = cursor.fetchone()[0]
    chrominfo = get_chrominfo(filename)
    return chrominfo
{'fraction_non_alphanumeric': 0.09878542510121457, 'fraction_numerical': 0.0008097165991902834, 'mean_word_length': 2.8266253869969042, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4082444', 'n_tokens_mistral': 369, 'n_tokens_neox': 336, 'n_words': 111}