<commit_before>from os.path import join
from tempfile import mkdtemp
from gzip import open as gzopen

from .processing_pipeline import StudyPreprocessor
from qiita_core.qiita_settings import qiita_config
from qiita_ware.commands import submit_EBI_from_files
from qiita_ware.demux import to_per_sample_ascii
from qiita_ware.util import open_file
from qiita_db.study import Study
from qiita_db.metadata_template import SampleTemplate, PrepTemplate
from qiita_db.data import PreprocessedData, RawData
from qiita_db.parameters import PreprocessedIlluminaParams


def split_libraries(study_id, raw_data_id, param_id):
    study = Study(study_id)
    raw_data = RawData(raw_data_id)
    params = PreprocessedIlluminaParams(param_id)

    sp = StudyPreprocessor()
    return sp(study, raw_data, params)


def submit_to_ebi(study_id):
    """Submit a study to EBI"""
    study = Study(study_id)
    st = SampleTemplate(study.sample_template)
    raw_data_id = study.preprocessed_data()[0]
    pt = PrepTemplate(raw_data_id)
    preprocessed_data = PreprocessedData(raw_data_id)
    investigation_type = RawData(raw_data_id).investigation_type<commit_msg>MAINT: renamed, takes construtor<commit_after>from os.path import join
from tempfile import mkdtemp
from gzip import open as gzopen

from .processing_pipeline import StudyPreprocessor
from qiita_core.qiita_settings import qiita_config
from qiita_ware.commands import submit_EBI_from_files
from qiita_ware.demux import to_per_sample_ascii
from qiita_ware.util import open_file
from qiita_db.study import Study
from qiita_db.metadata_template import SampleTemplate, PrepTemplate
from qiita_db.data import PreprocessedData, RawData


def preprocessor(study_id, raw_data_id, param_id, param_constructor):
    """Dispatch for preprocessor work"""
    study = Study(study_id)
    raw_data = RawData(raw_data_id)
    params = param_constructor(param_id)

    sp = StudyPreprocessor()
    return sp(study, raw_data, params)


def submit_to_ebi(study_id):
    """Submit a study to EBI"""
    study = Study(study_id)
    st = SampleTemplate(study.sample_template)
    raw_data_id = study.preprocessed_data()[0]
    pt = PrepTemplate(raw_data_id)
    preprocessed_data = PreprocessedData(raw_data_id)
    investigation_type = RawData(raw_data_id).investigation_type
{'fraction_non_alphanumeric': 0.06260869565217392, 'fraction_numerical': 0.0008695652173913044, 'mean_word_length': 5.889221556886228, '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': '3681453', 'n_tokens_mistral': 773, 'n_tokens_neox': 734, 'n_words': 177}