biotite.application.muscle.MuscleApp

class biotite.application.muscle.MuscleApp(sequences, bin_path=None)[source]

Bases: biotite.application.msaapp.MSAApp

Perform a multiple sequence alignment using MUSCLE.

Parameters:
sequences : iterable object of ProteinSequence

The sequences to be aligned.

bin_path : str, optional

Path of the MUSCLE binary.

set_matrix(matrix)[source]

Set the substitution matrix for the alignment.

Parameters:
matix : SubstitutionMatrix

The substitution matrix to be used.

set_gap_penalty(gap_penalty)[source]

Set the gap penalty for the alignment.

Parameters:
gap_penalty : float or (tuple, dtype=int), optional

If a float is provided, the value will be interpreted as general gap penalty. If a tuple is provided, an affine gap penalty is used. The first value in the tuple is the gap opening penalty, the second value is the gap extension penalty. The values need to be negative.

static get_default_bin_path()[source]

Get the default path for the MSA software executable.

PROTECTED: Override when inheriting.

Returns:
bin_path : str

Absolute path to executable.

get_cli_arguments()[source]

Get the arguments for the MSA execution on the command line (the executable path is exclusive).

PROTECTED: Override when inheriting.

Returns:
arguments : list of str

Command line arguments.

run()[source]

Commence the application run. Called in start().

PROTECTED: Override when inheriting.

classmethod align(sequences, bin_path=None, matrix=None, gap_penalty=None)[source]

Perform a multiple sequence alignment.

This is a convenience function, that wraps the MSAApp execution.

Parameters:
sequences : iterable object of Sequence

The sequences to be aligned

bin_path : str, optional

Path of the MSA software binary. By default, the default path will be used.

Returns:
alignment : Alignment

The global multiple sequence alignment.

cancel()

Cancel the application when in RUNNING or FINISHED state.

clean_up()

Do clean up work after the application terminates.

PROTECTED: Optionally override when inheriting.

evaluate()

Evaluate application results. Called in join().

PROTECTED: Override when inheriting.

get_alignment()

Get the resulting multiple sequence alignment.

Returns:
alignment : Alignment

The global multiple sequence alignment.

get_alignment_order()

Get the order of the resulting multiple sequence alignment.

Usually the order of sequences in the output file is different from the input file, e.g. the sequences are sorted by distances. When using align() this order is rearranged so that its is the same as the input order. This method returns the original order of the sequences that can be used to restore the MSA software intended order

Returns:
order : ndarray, dtype=int

The sequence order intended by the MSA software.

Examples

Align sequences and restore the original order:

app = ClustalOmegaApp(sequences) app.start() app.join() alignment = app.get_alignment() order = app.get_alignment_order() alignment = alignment[:, order]

get_app_state()

Get the current app state.

Returns:
app_state : AppState

The current app state.

get_exit_code()

Get the exit code of the process.

PROTECTED: Do not call from outside.

Returns:
code : int

The exit code.

get_input_file_path()

Get input file path (FASTA format).

PROTECTED: Do not call from outside.

Returns:
path : str

Path of input file.

get_output_file_path()

Get output file path (FASTA format).

PROTECTED: Do not call from outside.

Returns:
path : str

Path of output file.

get_process()

Get the Popen instance.

PROTECTED: Do not call from outside.

Returns:
process : Popen

The Popen instance

get_stderr()
get_stdout()
is_finished()

Check if the application has finished.

PROTECTED: Override when inheriting.

Returns:
finished : bool

True of the application has finished, false otherwise

join(timeout=None)

Conclude the application run and set its state to JOINED. This can only be done from the RUNNING or FINISHED state.

If the application is FINISHED the joining process happens immediately, if otherwise the application is RUNNING, this method waits until the application is FINISHED.

Parameters:
timeout : float, optional

If this parameter is specified, the Application only waits for finishing until this value (in seconds) runs out. After this time is exceeded a TimeoutError is raised and the application is cancelled.

Raises:
TimeoutError

If the joining process exceeds the timeout value.

set_exec_dir(exec_dir)

Set the directory where the application should be executed. If not set, it will be executed in the working directory at the time the application was created.

PROTECTED: Do not call from outside.

Parameters:
exec_dir : str

The execution directory.

set_options(options)

Set command line options for the application run.

PROTECTED: Do not call from outside.

Parameters:
options : list

A list of strings representing the command line options.

start()

Start the application run and set its state to RUNNING. This can only be done from the CREATED state.

wait_interval()

The time interval of is_finished() calls in the joining process.

PROTECTED: Override when inheriting.

Returns:
interval : float

Time (in seconds) between calls of is_finished() in join()