| Title: | rksfun - a collection of usefull (to me) code |
|---|---|
| Description: | rksfun - a collection of usefull (to me) code |
| Authors: | Richard Stöckl [aut, cre] (ORCID: <https://orcid.org/0000-0002-0451-0652>) |
| Maintainer: | Richard Stöckl <[email protected]> |
| License: | Boost Software License 1.0 |
| Version: | 0.0.0.9000 |
| Built: | 2026-05-26 06:42:18 UTC |
| Source: | https://github.com/richardstoeckl/rksfun |
This function negates the %in% operator. I really don't know why this is not a built-in operator in R rksfun
x %NOTIN% yx %NOTIN% y
x |
A vector of values to check if they exist in y |
y |
A vector of values to check if x values exist in |
Calculate all-vs-all protein percent identities
allVSall_pid(protlist)allVSall_pid(protlist)
protlist |
List of protein sequences |
Dataframe with percent identities
Calculate pairwise percent identity between two sequences
calculate_pid( seq1, seq2, substitutionMatrix = "BLOSUM62", gapOpening = 10, gapExtension = 0.5, type = "global", ... )calculate_pid( seq1, seq2, substitutionMatrix = "BLOSUM62", gapOpening = 10, gapExtension = 0.5, type = "global", ... )
seq1 |
First sequence |
seq2 |
Second sequence |
substitutionMatrix |
Substitution matrix to use for alignment |
gapOpening |
Gap opening penalty |
gapExtension |
Gap extension penalty |
type |
Type of alignment. One of "global", "local", "overlap" |
... |
Additional arguments passed to pwalign::pairwiseAlignment |
Pairwise percent identity
This function saves the plot with A4 size in landscape mode
ggsave_landscape(filename, plot = last_plot(), ...)ggsave_landscape(filename, plot = last_plot(), ...)
filename |
character. The name of the file to save the plot to. |
plot |
ggplot object |
... |
Other arguments passed to ggsave() |
This function saves the plot with A4 size in portrait mode. rksfun
ggsave_portrait(filename, plot = last_plot(), ...)ggsave_portrait(filename, plot = last_plot(), ...)
filename |
character. The name of the file to save the plot to. |
plot |
ggplot object |
... |
Other arguments passed to ggsave() |
Function to get a logical vector if a text contains one of multiple sting patterns
hasOneOfMultiplePatterns(patterns, text)hasOneOfMultiplePatterns(patterns, text)
patterns |
A vector of strings to detect in the text |
text |
A vector of strings to detect the patterns |
A logical vector of the same length as the text vector
# define a vector of patterns patterns <- c("Merc", "Hornet") # create a DF df <- datasets::mtcars df$car <- rownames(df) # filter the DF to keep only the rows that do not contain one of the patterns df_with_pattern <- df %>% dplyr::filter(hasOneOfMultiplePatterns(patterns, df$car)) # filter the DF to keep only the rows that do not contain one of the patterns df_without_pattern <- df %>% dplyr::filter(!hasOneOfMultiplePatterns(patterns, df$car))# define a vector of patterns patterns <- c("Merc", "Hornet") # create a DF df <- datasets::mtcars df$car <- rownames(df) # filter the DF to keep only the rows that do not contain one of the patterns df_with_pattern <- df %>% dplyr::filter(hasOneOfMultiplePatterns(patterns, df$car)) # filter the DF to keep only the rows that do not contain one of the patterns df_without_pattern <- df %>% dplyr::filter(!hasOneOfMultiplePatterns(patterns, df$car))
This function reads the result file from my annotation pipeline
read_annotation(file, threads = 12, ...)read_annotation(file, threads = 12, ...)
file |
character. The name of the file to read |
threads |
integer. Number of threads to use |
... |
Other arguments passed to read_tsv |
rksfunPalettes for plotting
rksfun.pals( name, n, type = c("discrete", "continuous"), direction = c(1, -1), override.order = FALSE )rksfun.pals( name, n, type = c("discrete", "continuous"), direction = c(1, -1), override.order = FALSE )
name |
Name of Palette. Choices are:
|
n |
Number of desired colors. If number of requested colors is beyond the scope of the palette, colors are automatically interpolated. If n is not provided, the length of the palette is used. |
type |
Either "continuous" or "discrete". Use continuous if you want to automatically interpolate between colors. |
direction |
Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed |
override.order |
Colors are picked from palette to maximize readability and aesthetics. This means that colors are not always selected in sequential order from the full palette. If override.order is set to TRUE, colors are selected in sequential order from the full palette instead. Default is FALSE. |
A vector of colors.
Use names(rksfunPalettes) to return all possible palette names. Current choices are:
rktbns_post, and tf2
Use rksfun.pals to construct palettes.
rksfunPalettesrksfunPalettes
An object of class list of length 2.
Function for using rksfunPalettes colors schemes in ggplot2. Use scale_color_rksfun_d and scale_fill_rksfun_d
for discrete scales and scale_color_rksfun_c and scale_fill_rksfun_c for continuous scales.
scale_color_rksfun_c(name, direction = 1, ...)scale_color_rksfun_c(name, direction = 1, ...)
name |
Name of Palette. Choices are:
|
direction |
Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed |
... |
Other arguments passed on to |
A function that returns a continuous color scale.
Function for using rksfunPalettes colors schemes in ggplot2. Use scale_color_rksfun_d and scale_fill_rksfun_d
for discrete scales and scale_color_rksfun_c and scale_fill_rksfun_c for continuous scales.
scale_color_rksfun_d(name, direction = 1, override.order = FALSE, ...)scale_color_rksfun_d(name, direction = 1, override.order = FALSE, ...)
name |
Name of Palette. Choices are:
|
direction |
Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed |
override.order |
Colors are picked from palette to maximize readability and aesthetics. This means that colors are not always selected in sequential order from the full palette. If override.order is set to TRUE, colors are selected in sequential order from the full palette instead. Default is FALSE. |
... |
Other arguments passed on to |
A function that returns a discrete color scale.
Function for using rksfunPalettes colors schemes in ggplot2. Use scale_color_rksfun_d and scale_fill_rksfun_d
for discrete scales and scale_color_rksfun_c and scale_fill_rksfun_c for continuous scales.
scale_colour_rksfun_c(name, direction = 1, ...)scale_colour_rksfun_c(name, direction = 1, ...)
name |
Name of Palette. Choices are:
|
direction |
Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed |
... |
Other arguments passed on to |
A function that returns a continuous colour scale.
Function for using rksfunPalettes colors schemes in ggplot2. Use scale_color_rksfun_d and scale_fill_rksfun_d
for discrete scales and scale_color_rksfun_c and scale_fill_rksfun_c for continuous scales.
scale_colour_rksfun_d(name, direction = 1, override.order = FALSE, ...)scale_colour_rksfun_d(name, direction = 1, override.order = FALSE, ...)
name |
Name of Palette. Choices are:
|
direction |
Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed |
override.order |
Colors are picked from palette to maximize readability and aesthetics. This means that colors are not always selected in sequential order from the full palette. If override.order is set to TRUE, colors are selected in sequential order from the full palette instead. Default is FALSE. |
... |
Other arguments passed on to |
A function that returns a discrete colour scale.
Function for using rksfunPalettes colors schemes in ggplot2. Use scale_color_rksfun_d and scale_fill_rksfun_d
for discrete scales and scale_color_rksfun_c and scale_fill_rksfun_c for continuous scales.
scale_fill_rksfun_c(name, direction = 1, ...)scale_fill_rksfun_c(name, direction = 1, ...)
name |
Name of Palette. Choices are:
|
direction |
Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed |
... |
Other arguments passed on to |
A function that returns a continuous color scale.
Function for using rksfunPalettes colors schemes in ggplot2. Use scale_color_rksfun_d and scale_fill_rksfun_d
for discrete scales and scale_color_rksfun_c and scale_fill_rksfun_c for continuous scales.
scale_fill_rksfun_d(name, direction = 1, override.order = FALSE, ...)scale_fill_rksfun_d(name, direction = 1, override.order = FALSE, ...)
name |
Name of Palette. Choices are:
|
direction |
Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed |
override.order |
Colors are picked from palette to maximize readability and aesthetics. This means that colors are not always selected in sequential order from the full palette. If override.order is set to TRUE, colors are selected in sequential order from the full palette instead. Default is FALSE. |
... |
Other arguments passed on to |
A function that returns a discrete color scale.