# Sample dataframe
df <- data.frame(sample = c("m1", "m2", "m1", "m2", "m1"),
CHROM = c("PB1", "PB1", "PB2", "PB2", "NP"),
POS = c(234, 234, 240, 240, 254),
minorfreq = c(0.010, 0.022, 0.043, 0.055, 0.011),
majorfreq = c(0.990, 0.978, 0.957, 0.945, 0.989),
SegmentSize = c(2280, 2280, 2274, 2274, 1809)
)
df
genome_size = 13133
# Modify the dataframe to add 5 new columns of shannon entropy data:
# 1. shannon_ntpos
# 2. chrom_shannon
# 3. genome_shannon
# 4. shannon_chrom_perkb
# 5. genome_shannon_perkb
shannon_df = shannon_entropy(df, genome_size)
# Plot
plot_shannon(shannon_df)
Run the code above in your browser using DataLab