Skip to content

Commit

Permalink
rename sate to pasta
Browse files Browse the repository at this point in the history
  • Loading branch information
Siavash Mirarab committed Mar 13, 2014
1 parent 908e1a6 commit a661a91
Show file tree
Hide file tree
Showing 99 changed files with 583 additions and 583 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG
@@ -1,3 +1,11 @@
Version 1.5 (Backward compatibility implications):
pasta local home is now under ~/.pasta instead of ~/.sate
file path config file is called ~/.pasta/pasta_tool_paths.cfg instead of ~/.sate/sate_tool_paths.cfg
If no job name is given, it will be set by default to pastajob instead of satejob
PASTA output (and logs) will say "PASTA INFO" instead of "SATe INFO". More generally, the logs will say PASTA instead of SATe.
To turn on the debugging, now you need to use PASTA_DEBUG and PASTA_LOGGING_LEVEL=DEBUG instead of SATE_DEBUG and SATE_LOGGING_LEVEL
PASTA code changed such that in most places it uses "pasta" instead of "sate"
Note: the config file still has a section named [sate]. This was not renamed to maintain compatibility.
Version 1.4.1:
Bug fix: GUI was broken in 1.4.0
Disable multi-locus checkbox. Multi-locus is not supported in PASTA.
Expand Down
66 changes: 33 additions & 33 deletions sate/__init__.py → pasta/__init__.py
@@ -1,21 +1,21 @@
#!/usr/bin/env python

#############################################################################
## this file is part of sate.
## this file is part of PASTA.
## see "license.txt" for terms and conditions of usage.
#############################################################################

"""
Functions for configuring a runtime logger for the sate module.
Functions for configuring a runtime logger for the pasta module.
"""

PROGRAM_NAME = "PASTA"
PROGRAM_AUTHOR = ["Siavash Mirarab","Jiaye Yu", "Mark T. Holder", "Jeet Sukumaran", "Jamie Oaks"]
PROGRAM_LICENSE = "GNU General Public License, version 3"
PROGRAM_VERSION = "1.4.1"
PROGRAM_VERSION = "1.5"
PROGRAM_YEAR = "2013-2014"
PROGRAM_DESCRIPTION = "Practical Alignment using SATe and TrAnsitivity"
PROGRAM_WEBSITE = "http://phylo.bio.ku.edu/software/sate/sate.html"
PROGRAM_WEBSITE = "http://www.cs.utexas.edu/~phylo/software/pasta/"
PROGRAM_INSTITUTE = "Department of Computer Science, Univesity of Texas at Austin"
PROGRAM_LONG_DESCRIPTION = """
PASTA performs iterative realignment and tree inference, similar to SATe, but uses a very different merge algorithm which improves running time and accuracy.
Expand Down Expand Up @@ -51,13 +51,13 @@
import platform
import logging

_LOGGING_LEVEL_ENVAR = "SATE_LOGGING_LEVEL"
_LOGGING_FORMAT_ENVAR = "SATE_LOGGING_FORMAT"
_LOGGING_LEVEL_ENVAR = "PASTA_LOGGING_LEVEL"
_LOGGING_FORMAT_ENVAR = "PASTA_LOGGING_FORMAT"

# global debugging flag
if "SATE_DEBUG" in os.environ:
if os.environ["SATE_DEBUG"]:
if os.environ["SATE_DEBUG"].lower()[0] in ["1", "t", "y", "d"]:
if "PASTA_DEBUG" in os.environ:
if os.environ["PASTA_DEBUG"]:
if os.environ["PASTA_DEBUG"].lower()[0] in ["1", "t", "y", "d"]:
GLOBAL_DEBUG = True
else:
GLOBAL_DEBUG = False
Expand All @@ -67,7 +67,7 @@
GLOBAL_DEBUG = False

def get_logging_level():
"""Checks environment for SATE_LOGGING_LEVEL and returns a logging level
"""Checks environment for PASTA_LOGGING_LEVEL and returns a logging level
integer.
"""
import logging
Expand Down Expand Up @@ -157,7 +157,7 @@ def __init__(self):
self.run_log_streams = [sys.stdout]

def _format_msg(self, msg, msg_type):
return "SATe %s: %s\n" % (msg_type, msg)
return "PASTA %s: %s\n" % (msg_type, msg)

def _write_to_streams(self, streams, msg, flush=True):
for s in streams:
Expand Down Expand Up @@ -192,9 +192,9 @@ def send_info(self, msg):

##############################################
## Other globals
SATE_SYSTEM_PATHS_CFGFILE = os.path.abspath(os.path.join(os.path.expanduser('~'), '.sate', 'sate_tool_paths.cfg'))
SATE_GUI_RESOURCES = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, "resources", "images"))
SATE_SCRIPT_RESOURCES = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, "resources", "scripts"))
PASTA_SYSTEM_PATHS_CFGFILE = os.path.abspath(os.path.join(os.path.expanduser('~'), '.pasta', 'pasta_tool_paths.cfg'))
PASTA_GUI_RESOURCES = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, "resources", "images"))
PASTA_SCRIPT_RESOURCES = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, "resources", "scripts"))
DEFAULT_MAX_MB = os.environ.get("SATE_MAX_MB", 1024)

##############################################
Expand All @@ -212,8 +212,8 @@ def __str__(self):
", ".join("'" + s + "'" for s in self.paths_tried),
self.env_var_name)

def sate_is_frozen():
"""Will return True if SATe is frozen.
def pasta_is_frozen():
"""Will return True if PASTA is frozen.
"""
import imp
return (
Expand All @@ -222,10 +222,10 @@ def sate_is_frozen():
or imp.is_frozen("__main__") # tools/freeze
)

def sate_home_dir():
def pasta_home_dir():
"""Attempts to return the directory that is the parent of the binary directories.
"""
if sate_is_frozen():
if pasta_is_frozen():
if platform.system() == "Darwin":
retpath = os.path.join( os.path.dirname(os.path.dirname(os.path.abspath(sys.executable))), 'Resources')
else:
Expand All @@ -236,39 +236,39 @@ def sate_home_dir():
else:
return os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

def sate_tools_deploy_subpath():
def pasta_tools_deploy_subpath():
return "bin"

def sate_tools_deploy_dir(default_to_dev_dir=False):
def pasta_tools_deploy_dir(default_to_dev_dir=False):
"""
If the environmental variable $SATE_TOOLS_RUNDIR is set, then this is returned.
If the environmental variable $PASTA_TOOLS_RUNDIR is set, then this is returned.
If not, and a '../bin' directory exists (relative to *this* file, i.e.
__file__) *or* `default_to_dev_dir` is False, then that is returned.
If not, then the return value of `sate_tools_dev_dir` is returned
If not, then the return value of `pasta_tools_dev_dir` is returned
"""
if "SATE_TOOLS_RUNDIR" in os.environ:
bin_path = os.path.expanduser(os.path.expandvars(os.environ["SATE_TOOLS_RUNDIR"]))
if "PASTA_TOOLS_RUNDIR" in os.environ:
bin_path = os.path.expanduser(os.path.expandvars(os.environ["PASTA_TOOLS_RUNDIR"]))
else:
home_path = sate_home_dir()
bin_path = os.path.join(home_path, sate_tools_deploy_subpath())
home_path = pasta_home_dir()
bin_path = os.path.join(home_path, pasta_tools_deploy_subpath())
if os.path.exists(bin_path) or not default_to_dev_dir:
return bin_path
try:
return sate_tools_dev_dir()
return pasta_tools_dev_dir()
except ToolsDirNotFoundError:
#it is possible that correct paths to the tools will be
#provided for in system configuration file
#let client code deal with that ...
return bin_path

def sate_tools_dev_dir(platform_name=None):
def pasta_tools_dev_dir(platform_name=None):
"""
If the environmental variable $SATE_TOOLS_DEVDIR is set, then this is used.
If the environmental variable $PASTA_TOOLS_DEVDIR is set, then this is used.
Otherwise, '../../sate-tools-linux', '../../sate-tools-mac', or
'../../sate-tools-win' is used (path relative to this __file__).
"""
if "SATE_TOOLS_DEVDIR" in os.environ and platform_name is None:
bin_path = os.path.expanduser(os.path.expandvars(os.environ["SATE_TOOLS_DEVDIR"]))
if "PASTA_TOOLS_DEVDIR" in os.environ and platform_name is None:
bin_path = os.path.expanduser(os.path.expandvars(os.environ["PASTA_TOOLS_DEVDIR"]))
else:
if platform_name is None:
platform_name = platform.system()
Expand All @@ -280,10 +280,10 @@ def sate_tools_dev_dir(platform_name=None):
elif platform_name == 'Linux':
sub_path = "sate-tools-linux"
else:
raise OSError("SATe does not bundle tools for '%s' at this time!" % platform_name)
raise OSError("PASTA does not bundle tools for '%s' at this time!" % platform_name)
bin_path = os.path.join(root_path, sub_path)
if not os.path.exists(bin_path):
raise ToolsDirNotFoundError(paths_tried=[bin_path],
env_var_name="SATE_TOOLS_DEVDIR")
env_var_name="PASTA_TOOLS_DEVDIR")
return bin_path

20 changes: 10 additions & 10 deletions sate/alignment.py → pasta/alignment.py
Expand Up @@ -3,7 +3,7 @@
import sys
from dendropy.dataobject.taxon import Taxon
#############################################################################
## this file is part of sate.
## this file is part of pasta.
## see "license.txt" for terms and conditions of usage.
#############################################################################

Expand All @@ -12,8 +12,8 @@
"""

import re, os
from sate import get_logger, log_exception, MESSENGER, TIMING_LOG
from sate.filemgr import open_with_intermediates
from pasta import get_logger, log_exception, MESSENGER, TIMING_LOG
from pasta.filemgr import open_with_intermediates

_LOG = get_logger(__name__)
_INDEL = re.compile(r"[-]")
Expand Down Expand Up @@ -632,13 +632,13 @@ class SequenceDataset(object):
# Go to safe labels
############################################################################
md = MultiLocusDataset([sd])
md.relabel_for_sate()
md.relabel_for_pasta()
############################################################################
# use the dataset object
############################################################################
job = SateJob(multilocus_dataset=md,
sate_team=sate_team,
job = PastaJob(multilocus_dataset=md,
pasta_team=pasta_team,
name=options.jobname,
dataset=sd.dataset
)
Expand Down Expand Up @@ -838,7 +838,7 @@ def read_files(self,
assert(sd.alphabet)
map_missing_to = (m == "AMBIGUOUS" and sd.alphabet.any_residue.symbol or None)
if not sd.sequences_are_valid(remap_missing=True, map_missing_to=map_missing_to):
raise Exception("Input sequences could not be prepared for SATe. Please report this error\n")
raise Exception("Input sequences could not be prepared for PASTA. Please report this error\n")
except Exception, x:
raise Exception('Error in processing file "%s":\n%s\n' % (seq_fn, str(x)))
self.append(sd)
Expand Down Expand Up @@ -883,14 +883,14 @@ def create_dendropy_dataset(self):
taxon_set.lock()
_LOG.debug("dendropy dataset created and locked")

def relabel_for_sate(self):
_LOG.debug("start relabeling for SATe")
def relabel_for_pasta(self):
_LOG.debug("start relabeling for PASTA")
self.safe_to_real_names = {}
self.filename_list = []
alignment_list = []
for n, element in enumerate(self):
if not isinstance(element, SequenceDataset):
raise ValueError("Expecting all elements of MultiLocusDataset to be SequenceDataset objects when relabel_for_sate is called!")
raise ValueError("Expecting all elements of MultiLocusDataset to be SequenceDataset objects when relabel_for_pasta is called!")
try:
taxa_block = element.taxa
char_block = element.character_matrix
Expand Down
48 changes: 24 additions & 24 deletions sate/configure.py → pasta/configure.py
Expand Up @@ -5,9 +5,9 @@
In general one should be able to simply call get_configuration()
"""
# This file is part of SATe
# This file is part of PASTA and is forked from SATe

# SATe is free software: you can redistribute it and/or modify
# PASTA, like SATe, is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
Expand All @@ -27,39 +27,39 @@
import platform
import sys

from sate import get_logger, SATE_SYSTEM_PATHS_CFGFILE
from sate.settings import SateUserSettings
from sate.tools import get_external_tool_classes
import sate
from sate import filemgr
from pasta import get_logger, PASTA_SYSTEM_PATHS_CFGFILE
from pasta.settings import PastaUserSettings
from pasta.tools import get_external_tool_classes
import pasta
from pasta import filemgr

_LOG = get_logger(__name__)

def get_invoke_run_sate_command():
"""Used by GUI's this tries to return the python invocation for the run_sate
def get_invoke_run_pasta_command():
"""Used by GUI's this tries to return the python invocation for the run
program or script.
"""
if sate.sate_is_frozen():
if pasta.pasta_is_frozen():
if platform.system() == 'Windows':
return ['run_sate.exe']
return ['run_pasta.exe']
elif platform.system() == 'Darwin':
return [filemgr.quoted_file_path(sys.executable),
filemgr.quoted_file_path(os.path.join(sate.sate_home_dir(), 'run_pasta.py'))]
filemgr.quoted_file_path(os.path.join(pasta.pasta_home_dir(), 'run_pasta.py'))]
else:
raise OSError('SATe is not frozen for %s' % platform.system())
raise OSError('PASTA is not frozen for %s' % platform.system())
else:
return [filemgr.quoted_file_path(sys.executable),
filemgr.quoted_file_path(os.path.join(sate.sate_home_dir(),
filemgr.quoted_file_path(os.path.join(pasta.pasta_home_dir(),
'run_pasta.py'))]

_DEFAULT_TOOLS_PATH = None

def init_sate(sate_home=None):
def init_pasta(pasta_home=None):
"""
Sets the _DEFAULT_TOOLS_PATH.
"""
global _DEFAULT_TOOLS_PATH
bin_dir = sate.sate_tools_deploy_dir(default_to_dev_dir=True)
bin_dir = pasta.pasta_tools_deploy_dir(default_to_dev_dir=True)
if _DEFAULT_TOOLS_PATH is None:
_DEFAULT_TOOLS_PATH = {}
for i in get_external_tool_classes():
Expand All @@ -73,28 +73,28 @@ def set_configuration_from_defaults(cfg):
"Uses _DEFAULT_TOOLS_PATH to add paths to external tools to `cfg`"
global _DEFAULT_TOOLS_PATH
if _DEFAULT_TOOLS_PATH is None:
init_sate()
init_pasta()
for name, path in _DEFAULT_TOOLS_PATH.items():
x = getattr(cfg, name)
x.path = path

def get_configuration(configfile=None):
"""Returns an instance of SateUserSettings that reflects the current
"""Returns an instance of PastaUserSettings that reflects the current
defaults based on:
1. paths inferred from SATE_SYSTEM_PATHS_CFGFILE
1. paths inferred from PASTA_SYSTEM_PATHS_CFGFILE
2. any settings in `configfile` (these will overwrite the settings
based on the defaults from sate_home).
based on the defaults from pasta_home).
"""
cfg = SateUserSettings()
cfg = PastaUserSettings()
set_configuration_from_defaults(cfg)

if os.path.exists(SATE_SYSTEM_PATHS_CFGFILE):
if os.path.exists(PASTA_SYSTEM_PATHS_CFGFILE):
paths_parser = ConfigParser.RawConfigParser()
try:
paths_parser.read(SATE_SYSTEM_PATHS_CFGFILE)
paths_parser.read(PASTA_SYSTEM_PATHS_CFGFILE)
except:
### TODO: wrap up in messaging system
sys.stderr.write("The specified configuration file %s cannot be read, the default settings are used instead.\n" % SATE_SYSTEM_PATHS_CFGFILE)
sys.stderr.write("The specified configuration file %s cannot be read, the default settings are used instead.\n" % PASTA_SYSTEM_PATHS_CFGFILE)
else:
for tool_class in get_external_tool_classes():
try:
Expand Down
File renamed without changes.

0 comments on commit a661a91

Please sign in to comment.