Asa’s R packages 📦

for bioinformatics and data analysis

Chen Peng

ZJU LSI Jianglab

2024-04-19

My R packges

R Badge RStudio Badge

My favorite programming language is R, I have developed some R packages:

pcutils

It contains many useful functions for statistics and visualization.

Go down 👇

pctax

  • It contains a basic pipeline for omics analysis.
  • See the pctax Tutorial

pctax features

Built-in steps in the micro_sbatch():

  • fastp
  • rm_human
  • kraken2
  • megahit
  • prodigal
  • cluster
  • salmon-quant
  • eggnog
  • cazy
  • rgi
  • vfdb

Taxonkit is a Practical and Efficient NCBI Taxonomy Toolkit.

You can use Taxonkit in R by pctax interface as followed:

?taxonkit_lineage

# taxonkit_list
# taxonkit_reformat
# taxonkit_name2taxid
# taxonkit_filter
# taxonkit_lca


name_or_id2df(c("562","9606"),mode = "id")
  taxid      Kingdom            Phylum                  Class
1   562  k__Bacteria p__Pseudomonadota c__Gammaproteobacteria
2  9606 k__Eukaryota       p__Chordata            c__Mammalia
                Order                Family          Genus             Species
1 o__Enterobacterales f__Enterobacteriaceae g__Escherichia s__Escherichia coli
2         o__Primates          f__Hominidae        g__Homo     s__Homo sapiens
ann_tree(taxonomy, otutab) -> tree
easy_tree(tree, add_tiplab = FALSE) -> p
some_tax <- c("p__Proteobacteria","p__Actinobacteria","p__Firmicutes",
              "p__Bacteroidetes","p__Acidobacteria")
add_strip(p, some_tax)

Unified input and output format of one type of analysis for convenient downstream

  • α-diversity
    • Richness, Shannon, Simpson, Chao1, ACE, PD, Pielou, …
  • β-diversity
    • Distance: Bray-Curtis, Jaccard, Unifrac, Beta MPD, Phylosor, …
    • Ordination: PCA, PCoA, NMDS, PLS-DA, t-SNE, UMAP, LDA, RDA, CCA, db-RDA, …
    • PERMANOVA: adonis, anosim, mrpp, mantel, envfit, …
  • ζ-diversity

pctax features

  • t.test
  • wilcox.test
  • DESeq2
  • edgeR
  • limma
  • randomForest
  • LEfSe

  • Solan NCM
  • Stegen (βNTI & RCbray-based)
  • ST, NST, MST (stochasticity ratio)

The pctax package includes some built-in cycling pathways, which enables users to conveniently visualize all genes or KO (KEGG Orthology) involved in these pathways.

MetaNet

  • It is a comprehensive network analysis package for omics data.
  • See the MetaNet Tutorial

MetaNet features

library(MetaNet)
multi_net_build(list(
  Microbiome = micro,
  Metabolome = metab,
  Transcriptome = transc
)) -> multi1
# set vertex_class
multi1_with_anno <- c_net_set(multi1, micro_g, metab_g, transc_g, 
                              vertex_class = c("Phylum", "kingdom", "type"))
# set vertex_size
multi1_with_anno <- c_net_set(multi1_with_anno,
  data.frame("Abundance1" = colSums(micro)),
  data.frame("Abundance2" = colSums(metab)),
  data.frame("Abundance3" = colSums(transc)),
  vertex_size = paste0("Abundance", 1:3)
)
plot(multi1_with_anno)

MetaNet features

MetaNet features

Layout methods for c_net_layout()

data("otutab")
pie_value=hebing(otutab,metadata$Group)
c_net_plot(multi1_with_anno,vertex.shape=c("Microbiome"="pie"),
           pie_value = pie_value,vertex.label=NA,pie_legend = T,color_legend = F)

Plot a network with pie node
as.ggig(multi1_with_anno) -> ggig
plot(ggig)

Plot a network in ggplot2 style
netD3plot(multi1_with_anno)

Plot a network in NetworkD3 style

MetaNet features

test_module_net <- module_net(module_number = 3, n_node_in_modu = 30)
plot(test_module_net, mark_module = T)

The topological role of individual node
Zi Zi>2.5
Pi peripherals module hubs
Pi>0.62 connectors network hubs

  • Robust test
  • Robustness
  • Vulnerability
  • Cohesion

ReporterScore

iCRISPR

CRISPR/Cas9 system analysis in genomics and metagenomics.

plot4fun

It provides some interesting functions for plotting.

How to bend your text? How to draw a DNA? How to handle the relationship between layers? How to make a LED display?

clock(rotate_text = T)

DNA_plot()

chunlian(words = 1)

Olympic_rings()

make_LED("一起来画图!")

More Resources

R tips for advanced use


Official account

Thanks for your attention! 🙏