コード例 #1
0
    def _guess_scheduler(self):

        from easydev import cmd_exists
        if cmd_exists("sbatch") and cmd_exists("srun"):
            return 'slurm'
        else:
            return 'local'
コード例 #2
0
def guess_scheduler():
    """Guesses whether we are on a SLURM cluster or not.

    If not, we assume a local run is expected.
    """
    from easydev import cmd_exists
    if cmd_exists("sbatch") and cmd_exists("srun"):
        return 'slurm'
    else:
        return 'local'
コード例 #3
0
ファイル: session.py プロジェクト: WMGoBuffs/biokit
    def __init__(self, RExecutable='R', max_len=1000,
            use_dict=None, host='localhost', user=None, ssh='ssh',
            verbose=False, return_err=True):
        """

        :param str RCMD: the name of the R executable
        :param max_len: define the upper limitation for the length of command string. A
           command string will be passed to R by a temporary file if it is longer
           than this value.
        :param host: The computer name (or IP) on which the R interpreter is
           installed. The value "localhost" means that the R locates on the
           the localhost computer. On POSIX systems (including Cygwin
           environment on Windows), it is possible to use R on a remote
           computer if the command "ssh" works. To do that, the user need set
           this value, and perhaps the parameter "user".
        :param user: The user name on the remote computer. This value need to be set
           only if the user name is different on the remote computer. In
           interactive environment, the password can be input by the user if
           prompted. If running in a program, the user need to be able to
           login without typing password! (i.e., you need to set your SSH keys)
        :param ssh: The program to login to remote computer.
        :param kargs: must be empty. Error raised otherwise
        """
        from easydev import cmd_exists
        if host == 'localhost' and cmd_exists(RExecutable) is False:
            raise Exception('Could not find the R executable %s in your path' % RExecutable)

        super(RSession, self).__init__(RCMD=RExecutable, max_len=max_len,
            use_dict=use_dict, host=host, user=user, ssh=ssh, return_err=return_err,
            dump_stdout=verbose)
コード例 #4
0
    def __init__(
        self,
        RExecutable="R",
        max_len=1000,
        use_dict=None,
        host="localhost",
        user=None,
        ssh="ssh",
        verbose=False,
        return_err=True,
    ):
        """

        :param str RCMD: the name of the R executable
        :param max_len: define the upper limitation for the length of command string. A
           command string will be passed to R by a temporary file if it is longer
           than this value.
        :param host: The computer name (or IP) on which the R interpreter is
           installed. The value "localhost" means that the R locates on the
           the localhost computer. On POSIX systems (including Cygwin
           environment on Windows), it is possible to use R on a remote
           computer if the command "ssh" works. To do that, the user need set
           this value, and perhaps the parameter "user".
        :param user: The user name on the remote computer. This value need to be set
           only if the user name is different on the remote computer. In
           interactive environment, the password can be input by the user if
           prompted. If running in a program, the user need to be able to
           login without typing password! (i.e., you need to set your SSH keys)
        :param ssh: The program to login to remote computer.
        :param kargs: must be empty. Error raised otherwise
        """
        from easydev import cmd_exists

        if host == "localhost" and cmd_exists(RExecutable) is False:
            raise Exception(
                "Could not find the R executable %s in your path" % RExecutable
            )

        super(RSession, self).__init__(
            RCMD=RExecutable,
            max_len=max_len,
            use_dict=use_dict,
            host=host,
            user=user,
            ssh=ssh,
            return_err=return_err,
            dump_stdout=verbose,
        )

        self.run("options(warn=-1)")
コード例 #5
0
# the :class:`sequana.kraken.KrakenResults`. See following example.

##############################################
# Example
# --------
#
# In the following example, we use the results of a kraken analysis. The
# original toy data files contains 1500 reads mostly related to Measles virus
#
from sequana import KrakenResults, sequana_data
test_file = sequana_data("test_kraken.out", "testing")
k = KrakenResults(test_file)
df = k.plot(kind='pie')
print(df)

####################################################
# Note that only a subset of taxons are shown in the pie chart
# that is those that cover at least 1% of the total reads. Others
# are put together and labelled "others"
#
# A more interactive plot can be obtained using Krona if installed:
from sequana import KrakenResults, sequana_data
test_file = sequana_data("test_kraken.out", "testing")
import easydev
if easydev.cmd_exists("ktImportText"):
    k = KrakenResults(test_file)
    k.to_js(onweb=False)  # The output filame is krona.html by default

#######################################################################
# An example is available in  `Krona example <../_static/krona.html>`_