RNAplotApp
#
- class biotite.application.viennarna.RNAplotApp(dot_bracket=None, base_pairs=None, length=None, layout_type=Layout.NAVIEW, bin_path='RNAplot')[source]#
Bases:
LocalApp
Get coordinates for a 2D representation of any unknotted RNA structure using ViennaRNA’s RNAplot.
The structure has to be provided either in dot bracket notation or as a
ndarray
of base pairs and the total sequence length.Internally this creates a
Popen
instance, which handles the execution.- Parameters:
- dot_bracketstr, optional (default: None)
The structure in dot bracket notation.
- base_pairsndarray, shape=(n,2), optional (default: None)
Each row corresponds to the positions of the bases in the strand. This parameter is mutually exclusive to
dot_bracket
.- lengthint, optional (default: None)
The number of bases in the strand. This parameter is required if
base_pairs
is given.- layout_typeRNAplotApp.Layout, optional (default: RNAplotApp.Layout.NAVIEW)
The layout type according to the RNAplot documentation.
- bin_pathstr, optional
Path of the RNAplot binary.
Examples
>>> app = RNAplotApp('((..))') >>> app.start() >>> app.join() >>> print(app.get_coordinates()) [[ -92.50 92.50] [ -92.50 77.50] [ -90.31 58.24] [-109.69 58.24] [-107.50 77.50] [-107.50 92.50]]
- class Layout(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
IntEnum
This enum type represents the layout type of the plot according to the official RNAplot orientation.
- RADIAL = 0#
- NAVIEW = 1#
- CIRCULAR = 2#
- RNATURTLE = 3#
- RNAPUZZLER = 4#
- add_additional_options(options)#
Add additional options for the command line program. These options are put before the arguments automatically determined by the respective
LocalApp
subclass.This method is focused on advanced users, who have knowledge on the available options of the command line program and the options already used by the
LocalApp
subclasses. Ignoring the already used options may result in conflicting CLI arguments and potential unexpected results. It is recommended to use this method only, when the respectiveLocalApp
subclass does not provide a method to set the desired option.- Parameters:
- optionslist of str
A list of strings representing the command line options.
Notes
In order to see which options the command line execution used, try the
get_command()
method.Examples
>>> seq1 = ProteinSequence("BIQTITE") >>> seq2 = ProteinSequence("TITANITE") >>> seq3 = ProteinSequence("BISMITE") >>> seq4 = ProteinSequence("IQLITE") >>> # Run application without additional arguments >>> app = ClustalOmegaApp([seq1, seq2, seq3, seq4]) >>> app.start() >>> app.join() >>> print(app.get_command()) clustalo --in ...fa --out ...fa --force --output-order=tree-order --seqtype Protein --guidetree-out ...tree >>> # Run application with additional argument >>> app = ClustalOmegaApp([seq1, seq2, seq3, seq4]) >>> app.add_additional_options(["--full"]) >>> app.start() >>> app.join() >>> print(app.get_command()) clustalo --full --in ...fa --out ...fa --force --output-order=tree-order --seqtype Protein --guidetree-out ...tree
- 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.
- static compute_coordinates(dot_bracket=None, base_pairs=None, length=None, layout_type=Layout.NAVIEW, bin_path='RNAplot')#
Get coordinates for a 2D representation of any unknotted RNA structure using ViennaRNA’s RNAplot.
The structure has to be provided either in dot bracket notation or as a
ndarray
of base pairs and the total sequence length.This is a convenience function, that wraps the
RNAplotApp
execution.- Parameters:
- dot_bracketstr, optional (default: None)
The structure in dot bracket notation.
- base_pairsndarray, shape=(n,2), optional (default: None)
Each row corresponds to the positions of the bases in the strand. This parameter is mutually exclusive to
dot_bracket
.- lengthint, optional (default: None)
The number of bases in the strand. This parameter is required if
base_pairs
is given.- bin_pathstr, optional
Path of the RNAplot binary.
- Returns:
- coordinatesndarray, shape=(n,2)
The 2D coordinates. Each row represents the x and y coordinates for a total sequence length of n.
- get_app_state()#
Get the current app state.
- Returns:
- app_stateAppState
The current app state.
- get_command()#
Get the executed command.
Cannot be called until the application has been started.
- Returns:
- commandstr
The executed command.
Examples
>>> seq1 = ProteinSequence("BIQTITE") >>> seq2 = ProteinSequence("TITANITE") >>> seq3 = ProteinSequence("BISMITE") >>> seq4 = ProteinSequence("IQLITE") >>> app = ClustalOmegaApp([seq1, seq2, seq3, seq4]) >>> app.start() >>> print(app.get_command()) clustalo --in ...fa --out ...fa --force --output-order=tree-order --seqtype Protein --guidetree-out ...tree
- get_coordinates()#
Get coordinates for a 2D representation of the input structure.
- Returns:
- coordinatesndarray, shape=(n,2)
The 2D coordinates. Each row represents the x and y coordinates for a total sequence length of n.
Examples
>>> app = RNAplotApp('((..))') >>> app.start() >>> app.join() >>> print(app.get_coordinates()) [[ -92.50 92.50] [ -92.50 77.50] [ -90.31 58.24] [-109.69 58.24] [-107.50 77.50] [-107.50 92.50]]
- get_exit_code()#
Get the exit code of the process.
PROTECTED: Do not call from outside.
- Returns:
- codeint
The exit code.
- get_process()#
Get the Popen instance.
PROTECTED: Do not call from outside.
- Returns:
- processPopen
The Popen instance
- get_stderr()#
Get the STDERR pipe content of the process.
PROTECTED: Do not call from outside.
- Returns:
- stdoutstr
The standard error.
- get_stdout()#
Get the STDOUT pipe content of the process.
PROTECTED: Do not call from outside.
- Returns:
- stdoutstr
The standard output.
- is_finished()#
Check if the application has finished.
PROTECTED: Override when inheriting.
- Returns:
- finishedbool
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:
- timeoutfloat, optional
If this parameter is specified, the
Application
only waits for finishing until this value (in seconds) runs out. After this time is exceeded aTimeoutError
is raised and the application is cancelled.
- Raises:
- TimeoutError
If the joining process exceeds the timeout value.
- set_arguments(arguments)#
Set command line arguments for the application run.
PROTECTED: Do not call from outside.
- Parameters:
- argumentslist of str
A list of strings representing the command line options.
- 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_dirstr
The execution directory.
- set_layout_type(layout_type)#
Adjust the layout type for the plot according to the RNAplot documentation.
- Parameters:
- typeRNAplotApp.Layout
The layout type.
- set_stdin(file)#
Set a file as standard input for the application run.
PROTECTED: Do not call from outside.
- Parameters:
- filefile object
The file for the standard input. Must have a valid file descriptor, e.g. file-like objects such as StringIO are invalid.
- 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:
- intervalfloat
Time (in seconds) between calls of
is_finished()
injoin()
Gallery#
Finding homologs of a gene in a genome