msc.richness: Minicircle Sequence Cluster richness

Description Usage Arguments Value Examples

View source: R/msc.richness.R

Description

The msc.richness function counts how many Minicircle Sequence Clusters (MSC) are present per sample across different percent identities.

Usage

1
msc.richness(clustmatrices, samples, groups)

Arguments

clustmatrices

a list of cluster matrices.

samples

a vector containing the names of the samples. This can include all samples or it can be a subset.

groups

a vector, of equal length as samples, specifying to which group (e.g. species) the samples belong to.

Value

table

a table containing the number of MSC per sample across different percent identities.

plot

a boxplot visualizing previous results.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require(ggplot2)
data(matrices)
data(exData)

#### run function
richness <- msc.richness(matrices, samples = exData$samples, groups = exData$species)

apply(richness$table[which(richness$table$group=="L. peruviana"),-(1:2)], 2, mean)
apply(richness$table[which(richness$table$group=="L. braziliensis"),-(1:2)], 2, mean)
apply(richness$table[which(richness$table$group=="hybrid"),-(1:2)], 2, mean)  

#### visualize results
barplot(richness$table[,"id93"], names.arg = richness$table[,1],
        las=2, cex.names=0.4, main="N of MSC at id 93")

#### adjust plot
richness$plot + ggtitle("MSC richness across % id") + 
                theme(axis.text.x = element_text(angle=45, hjust=1))

### show results of subset 
table(exData$species)
hybrid <- which(exData$species=="hybrid")
# richness.subset <- msc.richness(matrices, samples = exData$samples[hybrid], 
#                                 groups = exData$species[hybrid])

rKOMICS documentation built on July 21, 2021, 5:07 p.m.