Package 'rksfun'

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

Help Index


Negate the %in% operator

Description

This function negates the %in% operator. I really don't know why this is not a built-in operator in R rksfun

Usage

x %NOTIN% y

Arguments

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

Description

Calculate all-vs-all protein percent identities

Usage

allVSall_pid(protlist)

Arguments

protlist

List of protein sequences

Value

Dataframe with percent identities


Calculate pairwise percent identity between two sequences

Description

Calculate pairwise percent identity between two sequences

Usage

calculate_pid(
  seq1,
  seq2,
  substitutionMatrix = "BLOSUM62",
  gapOpening = 10,
  gapExtension = 0.5,
  type = "global",
  ...
)

Arguments

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

Value

Pairwise percent identity


ggsave with A4 size (landscape)

Description

This function saves the plot with A4 size in landscape mode

Usage

ggsave_landscape(filename, plot = last_plot(), ...)

Arguments

filename

character. The name of the file to save the plot to.

plot

ggplot object

...

Other arguments passed to ggsave()


ggsave with A4 size (portrait)

Description

This function saves the plot with A4 size in portrait mode. rksfun

Usage

ggsave_portrait(filename, plot = last_plot(), ...)

Arguments

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

Description

Function to get a logical vector if a text contains one of multiple sting patterns

Usage

hasOneOfMultiplePatterns(patterns, text)

Arguments

patterns

A vector of strings to detect in the text

text

A vector of strings to detect the patterns

Value

A logical vector of the same length as the text vector

Examples

# 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))

Read the result file from my annotation pipeline

Description

This function reads the result file from my annotation pipeline

Usage

read_annotation(file, threads = 12, ...)

Arguments

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

Description

rksfunPalettes for plotting

Usage

rksfun.pals(
  name,
  n,
  type = c("discrete", "continuous"),
  direction = c(1, -1),
  override.order = FALSE
)

Arguments

name

Name of Palette. Choices are: rktbns_post, and tf2

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.

Value

A vector of colors.


Complete list of palettes.

Description

Use names(rksfunPalettes) to return all possible palette names. Current choices are: rktbns_post, and tf2 Use rksfun.pals to construct palettes.

Usage

rksfunPalettes

Format

An object of class list of length 2.


rksfunPalettes for plotting with ggplot2

Description

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.

Usage

scale_color_rksfun_c(name, direction = 1, ...)

Arguments

name

Name of Palette. Choices are: rktbns_post, and tf2

direction

Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed

...

Other arguments passed on to scale_color_gradientn

Value

A function that returns a continuous color scale.


rksfunPalettes for plotting with ggplot2

Description

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.

Usage

scale_color_rksfun_d(name, direction = 1, override.order = FALSE, ...)

Arguments

name

Name of Palette. Choices are: rktbns_post, and tf2

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 discrete_scale

Value

A function that returns a discrete color scale.


rksfunPalettes for plotting with ggplot2

Description

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.

Usage

scale_colour_rksfun_c(name, direction = 1, ...)

Arguments

name

Name of Palette. Choices are: rktbns_post, and tf2

direction

Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed

...

Other arguments passed on to scale_color_gradientn

Value

A function that returns a continuous colour scale.


rksfunPalettes for plotting with ggplot2

Description

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.

Usage

scale_colour_rksfun_d(name, direction = 1, override.order = FALSE, ...)

Arguments

name

Name of Palette. Choices are: rktbns_post, and tf2

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 discrete_scale

Value

A function that returns a discrete colour scale.


rksfunPalettes for plotting with ggplot2

Description

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.

Usage

scale_fill_rksfun_c(name, direction = 1, ...)

Arguments

name

Name of Palette. Choices are: rktbns_post, and tf2

direction

Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed

...

Other arguments passed on to scale_color_gradientn

Value

A function that returns a continuous color scale.


rksfunPalettes for plotting with ggplot2

Description

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.

Usage

scale_fill_rksfun_d(name, direction = 1, override.order = FALSE, ...)

Arguments

name

Name of Palette. Choices are: rktbns_post, and tf2

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 discrete_scale

Value

A function that returns a discrete color scale.