<commit_before>__version__ = "0.92"
import helpers

import os, shutil
module_dir = os.path.abspath(os.path.dirname(__file__))

default_params_str = """{
  'fasta': '',
  'csv': '',
  'out_dir': '',
  'protocol': 'gram_pos', # 'gram_neg'
  
#### Signal peptide and transmembrane helix prediction
  'signalp4_bin': '',
# 'signalp4_bin': 'signalp',
  'lipop1_bin': '',
# 'lipop1_bin': 'LipoP',
  'tmhmm_bin': '',
#  'tmhmm_bin': 'tmhmm',
  'memsat3_bin': 'runmemsat',
  'helix_programs': ['tmhmm'],
# 'helix_programs': ['tmhmm', 'memsat3'],
  'terminal_exposed_loop_min': 50, # unused in gram_neg protocol
  'internal_exposed_loop_min': 100, # try 30 for gram_neg
  
#### Sequence similarity and motif prediction
  'hmmsearch3_bin': 'hmmsearch',
  'hmm_profiles_dir': '%(hmm_profiles)s',
  'hmm_evalue_max': 0.1,
  'hmm_score_min': 10,
  
#### Outer membrane beta-barrel predictors
  'barrel_programs': ['bomp', 'tmbetadisc-rbf'],
# 'barrel_programs': ['bomp', 'tmbetadisc-rbf', 'tmbhunt', 'tmbeta'],
  'bomp_clearly_cutoff': 3, # >= to this, always classify as an OM(barrel)
  'bomp_maybe_cutoff': 1, # must also have a signal peptide to be OM(barrel)
  'tmbhunt_clearly_cutoff': 0.95,
  'tmbhunt_maybe_cutoff': 0.5,
  'tmbetadisc_rbf_method': 'aadp', # aa, dp, aadp or pssm
}
"""

def get_params():
  from helpers import log_stderr
  """
  Gets the params dictionary that hold all the configuration
  information of the program. This is loaded from 'inmembrane.config'
  which should be found in the same place as the main binary.

  If 'inmembrane.config' is not a found, a default 'inmembrane.config'
  is generated from 'default_params_str'. The config file should
  be edited if the binaries are not available on the path, or have
  different names.
  """
  config = os.path.join(os.getcwd(), 'inmembrane.config')
  if not os.path.isfile(config):
    log_stderr("# Couldn't find inmembrane.config file")
    log_stderr("# So, will generate a default config " + config)
    abs_hmm_profiles = os.path.join(module_dir, 'hmm_profiles')
    default_str = default_params_str % \
        { 'hmm_profiles': abs_hmm_profiles }
    open(config, 'w').write(default_str)
  else:
    log_stderr("# Loading existing inmembrane.config")<commit_msg>Removed hmm_profiles_dir from config file since this is now handled within each protocol.<commit_after>__version__ = "0.92"
import helpers

import os, shutil
module_dir = os.path.abspath(os.path.dirname(__file__))

default_params_str = """{
  'fasta': '',
  'csv': '',
  'out_dir': '',
  'protocol': 'gram_pos', # 'gram_neg'
  
#### Signal peptide and transmembrane helix prediction
  'signalp4_bin': '',
# 'signalp4_bin': 'signalp',
  'lipop1_bin': '',
# 'lipop1_bin': 'LipoP',
  'tmhmm_bin': '',
#  'tmhmm_bin': 'tmhmm',
  'memsat3_bin': 'runmemsat',
  'helix_programs': ['tmhmm'],
# 'helix_programs': ['tmhmm', 'memsat3'],
  'terminal_exposed_loop_min': 50, # unused in gram_neg protocol
  'internal_exposed_loop_min': 100, # try 30 for gram_neg
  
#### Sequence similarity and motif prediction
  'hmmsearch3_bin': 'hmmsearch',
  'hmm_evalue_max': 0.1,
  'hmm_score_min': 10,
  
#### Outer membrane beta-barrel predictors
  'barrel_programs': ['bomp', 'tmbetadisc-rbf'],
# 'barrel_programs': ['bomp', 'tmbetadisc-rbf', 'tmbhunt', 'tmbeta'],
  'bomp_clearly_cutoff': 3, # if >= than this, always classify as an OM(barrel)
  'bomp_maybe_cutoff': 1, # must also have a signal peptide to be OM(barrel)
  'tmbhunt_clearly_cutoff': 0.95,
  'tmbhunt_maybe_cutoff': 0.5,
  'tmbetadisc_rbf_method': 'aadp', # aa, dp, aadp or pssm
}
"""

def get_params():
  from helpers import log_stderr
  """
  Gets the params dictionary that hold all the configuration
  information of the program. This is loaded from 'inmembrane.config'
  which should be found in the same place as the main binary.

  If 'inmembrane.config' is not a found, a default 'inmembrane.config'
  is generated from 'default_params_str'. The config file should
  be edited if the binaries are not available on the path, or have
  different names.
  """
  config = os.path.join(os.getcwd(), 'inmembrane.config')
  if not os.path.isfile(config):
    log_stderr("# Couldn't find inmembrane.config file")
    log_stderr("# So, will generate a default config " + config)
    abs_hmm_profiles = os.path.join(module_dir, 'hmm_profiles')
    fh = open(config, 'w')
    fh.write(default_params_str)
    fh.close()
  else:
    log_stderr("# Loading existing inmembrane.config")
{'fraction_non_alphanumeric': 0.1407756108495853, 'fraction_numerical': 0.012553239184039453, 'mean_word_length': 4.73521850899743, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '623096', 'n_tokens_mistral': 1726, 'n_tokens_neox': 1583, 'n_words': 423}