Skip to contents

rRMSAnalyzer has a set of functions dedicated to modify a previously loaded RiboClass, both for samples and RNAs.

In this article, you will find common ways to use them.

Functions to modify RNAs

Remove RNA

A RNA subset can be easily analyzed by indicating the RNA to remove. The user can thus create a new RiboClass object containing the data of the RNAs of interest, without affecting the samples’ metadata.

Here is an example where the RNA 5S is removed:

ribo_adjusted <- remove_rna(ribo_toy, rna_to_remove = "NR_023363.1_5S")
print(ribo_adjusted)
#> a RiboClass with 14 samples and 3 RNA(s) :
#> Name : NR_046235.3_5.8S, length : 157
#>  Name : NR_046235.3_18S, length : 1869
#>  Name : NR_046235.3_28S, length : 5070

Rename RNA

It is always better to have readable RNA names on plots. This section is very important for annotation of rRNA 2’Ome sites using an annotation dataframe. You RiboClass must shares the same RNA names with the latter.

Here is an example to check whether the RNA names provided by the user in the RiboClass match the ones used by this package :

data("human_methylated")
cat("human_methylated's rna names: ", unique(human_methylated$rRNA),"\n")
#> human_methylated's rna names:  5.8S 18S 28S
cat("ribo_toy's rna names: ", as.character(ribo_adjusted$rna_names$current_name))
#> ribo_toy's rna names:  NR_046235.3_5.8S NR_046235.3_18S NR_046235.3_28S

In this example, the names are different and need to be updated before annotation.

The function rename_rna updates automatically the rRNA names that are given by rRNA size order:

ribo_adjusted <- rename_rna(ribo_adjusted,
                            new_names = c("5.8S", "18S", "28S")) 
                            # from the shortest RNA in our RiboClass to the longest.

Functions to modify samples

Keep only a set samples

A sample subset can be easily analyzed by indicating the samples to keep. The user can thus create a new RiboClass object containing the data and metadata of the samples of interest. Only the remaining samples’ metadata are kept in the RiboClass object, so no manual updating is required.

Here is an example to generate a new RiboClass by keeping two samples of interest (“S1” and “S2”):

ribo_2samples <- keep_ribo_samples(ribo_adjusted,c("S1","S2"))
print(ribo_2samples)
#> a RiboClass with 2 samples and 3 RNA(s) :
#> Name : 5.8S, length : 157
#>  Name : 18S, length : 1869
#>  Name : 28S, length : 5070

Remove samples

Unlike the previous section, samples indicated here will be removed from the RiboClass. The metadata will be updated accordingly.

Here is an example to generate a new RiboClass by removing two samples (“S1” and “S2”):

ribo_removed_samples <- remove_ribo_samples(ribo_toy,c("S1","S1"))
print(ribo_removed_samples)
#> a RiboClass with 13 samples and 4 RNA(s) :
#> Name : NR_023363.1_5S, length : 121
#>  Name : NR_046235.3_5.8S, length : 157
#>  Name : NR_046235.3_18S, length : 1869
#>  Name : NR_046235.3_28S, length : 5070