#Data loading
data("Two_group")
# Network analysis
network_Two_group <- network_analysis(
taxobj = Two_group,
taxlevel = "Genus",
reads = TRUE,
n = 8,
threshold = 0.7
)
# Show all taxa
module_results <- Module_composition(
network_obj = network_Two_group,
No.module = c(2, 5),
taxlevel = "Phylum"
)
print(module_results$Module5$Pie)
print(module_results$Module2$Pie) # View pie chart
head(module_results$Module2$source_data_Module2) # View source data for pie chart
print(module_results$aes_color) # Check aesthetic color
# Show taxa with top five frequency
module_results <- Module_composition(
network_obj = network_Two_group,
No.module = c(2, 5),
taxlevel = "Phylum",
mode = "most",
top_n = 5
)
print(module_results$Module2$Pie_plot_Module2)
# Show specific taxa
community <- community_plot(
taxobj = Two_group,
taxlevel = "Phylum",
n = 5,
palette = "Paired"
) # Get top 5 dominant phyla
top5_phyla <- names(community$filled_color)
module_results <- Module_composition(
network_obj = network_Two_group,
No.module = c(2, 5),
taxlevel = "Phylum",
mode = "select",
palette = community$filled_color,
select_tax = top5_phyla
)
print(module_results$Module2$Pie_plot_Module2)
# Specific taxa with no prefix 'p__'
module_results <- Module_composition(
network_obj = network_Two_group,
No.module = 2,
taxlevel = "Phylum",
mode = "select",
select_tax = c("Proteobacteria", "Actinobacteria")
)
print(module_results$Module2$Pie_plot_Module2)
# Remove 'p__' prefix
module_results <- Module_composition(
network_obj = network_Two_group,
No.module = 2,
taxlevel = "Phylum",
mode = "most",
top_n = 5,
palette = "Set2",
rmprefix = "p__"
)
print(module_results$Module2$Pie_plot_Module2)
Run the code above in your browser using DataLab