<commit_before>from Bio.Phylo.PAML import codeml
import os
from pathlib import Path
from shutil import copy

class CodemlRun(object):

    def __init__(self, P2N_alignment, iqtree_newick, control_file, home=os.getcwd()):
        self.home = Path(home)
        self.paml_path = self.home / Path('PAML')
        self.paml_path.mkdir(exist_ok=True)
        self.gene = str(iqtree_newick).replace('_iqtree.nwk', '')
        copy(P2N_alignment, str(self.paml_path))
        copy(iqtree_newick, str(self.paml_path))

        self.cml = codeml.Codeml(P2N_alignment, iqtree_newick, working_dir=self.paml_path, out_file=self.gene +'_codeml.out')
        self.control_setup(control_file)

    def control_setup(self, control_file):
        self.cml.read_ctl_file(control_file)
        self.cml.print_options()
        self.cml.ctl_file = str(self.paml_path / Path(self.gene + '.ctl'))<commit_msg>Updated pathlib object to string.<commit_after>from Bio.Phylo.PAML import codeml
import os
from pathlib import Path
from shutil import copy


class CodemlRun(object):

    def __init__(self, P2N_alignment, iqtree_newick, control_file, home=os.getcwd()):
        self.home = Path(home)
        self.paml_path = self.home / Path('PAML')
        self.paml_path.mkdir(exist_ok=True)
        self.gene = str(iqtree_newick).replace('_iqtree.nwk', '')
        self.control_file = self.paml_path / Path(self.gene + '.ctl')
        copy(P2N_alignment, str(self.paml_path))
        copy(iqtree_newick, str(self.paml_path))

        self.cml = codeml.Codeml(P2N_alignment, iqtree_newick, working_dir=str(self.paml_path), out_file=self.gene +'_codeml.out')
        self.control_setup(control_file)

    def control_setup(self, control_file):
        self.cml.read_ctl_file(control_file)
        self.cml.print_options()
        self.cml.ctl_file = str(self.control_file)
{'fraction_non_alphanumeric': 0.11822125813449023, 'fraction_numerical': 0.0032537960954446853, 'mean_word_length': 3.659090909090909, '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': '4885325', 'n_tokens_mistral': 699, 'n_tokens_neox': 667, 'n_words': 105}