<commit_before>"""
Classify / provide details for objects generated from an Illumina
sequencing run performed by the BRI Genomics Core.
"""

import logging
logger = logging.getLogger(__name__)

import os
import re
import bripipetools.model as docs
from bripipetools.util import files
from bripipetools.parsing import illumina

class FlowcellRunAnnotator(object):
    """
    Identifies, stores, and updates information about a flowcell run.
    """
    def __init__(self, run_id, genomics_root):
        logger.info("creating an instance of FlowcellRunAnnotator")
        self.run_id = run_id
        self.flowcellrun = self._init_flowcellrun(run_id)

        logger.debug("setting 'genomics' path")
        self.genomics_path = os.path.join(genomics_root, 'genomics')

    def _init_flowcellrun(self, run_id):
        """
        Try to retrieve data for the flowcell run from GenLIMS; if
        unsuccessful, create new ``FlowcellRun`` object.
        """
        logger.info("initializing FlowcellRun instance")
        try:
            logger.debug("getting FlowcellRun from GenLIMS")
            return genlims.get_run(_id=run_id)
        except:
            logger.debug("creating new FlowcellRun object")
            return docs.FlowcellRun(_id=run_id)

    # def _get_genomics_root(self):
    #     """
    #     Locate the root directory preceding 'genomics' in the system
    #     path.
    #     """
    #     return files.locate_root_folder('genomics')<commit_msg>remove lookup of genomics root in flowcell run annotation class<commit_after>"""
Classify / provide details for objects generated from an Illumina
sequencing run performed by the BRI Genomics Core.
"""

import logging
logger = logging.getLogger(__name__)

import os
import re
import bripipetools.model as docs
from bripipetools.util import files
from bripipetools.parsing import illumina

class FlowcellRunAnnotator(object):
    """
    Identifies, stores, and updates information about a flowcell run.
    """
    def __init__(self, run_id, genomics_root):
        logger.info("creating an instance of FlowcellRunAnnotator")
        self.run_id = run_id
        self.flowcellrun = self._init_flowcellrun(run_id)

        logger.debug("setting 'genomics' path")
        self.genomics_path = os.path.join(genomics_root, 'genomics')

    def _init_flowcellrun(self, run_id):
        """
        Try to retrieve data for the flowcell run from GenLIMS; if
        unsuccessful, create new ``FlowcellRun`` object.
        """
        logger.info("initializing FlowcellRun instance")
        try:
            logger.debug("getting FlowcellRun from GenLIMS")
            return genlims.get_run(_id=run_id)
        except:
            logger.debug("creating new FlowcellRun object")
            return docs.FlowcellRun(_id=run_id)
{'fraction_non_alphanumeric': 0.08321428571428571, 'fraction_numerical': 0.0, 'mean_word_length': 3.089051094890511, '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': '4317355', 'n_tokens_mistral': 836, 'n_tokens_neox': 805, 'n_words': 230}