Giter Club home page Giter Club logo

methyl_farnesoate_reproduction's Introduction

Effect of Methyl Farnesoate on Male Production in European Daphnia pulex Clones

Background

Daphnia pulex are freshwater crustaceans that are able to control their reproductive strategies in response to environmental cues. Under certain conditions, such as changes in population density or availability of resources, D. pulex can switch from asexual to sexual reproduction. The presence of methyl farnesoate, a hormone analog of juvenile growth hormone, has been observed to influence this reproductive switch, potentially increasing the production of male offspring. Understanding the effect of methyl farnesoate on male production can provide insights into the reproductive ecology and environmental adaptability of D. pulex.

  • Experiment completed by Caroline Roda ([email protected]) and Connor S. Murray ([email protected]) in Fall 2022.

  • This repository contains the R code and data for analyzing the effect of methyl farnesoate on male production in Daphnia pulex clones.

R Code to Plot Male Production in Daphnia pulex Clones

```r
# Calcualte the effect size and analyze methyl farnesoate exposure experiment
# Connor Murray
# 6.3.2024

# Libraries
library(data.table)
library(tidyverse)
library(patchwork)

# Working directory
setwd("C:/Users/Conno/Desktop/UndergradProjects_2022/Methyl_farn/Data/")

# Load data file
dt <- data.table(fread("Daphnia_Research_Aim1.csv") %>% 
        mutate(sc=case_when(Clone=="D8179" ~ "A",
                            Clone=="D8222" ~ "C",
                            Clone %like% "H" ~ "Hybrids")))

# Pooled Standard deviation
pooled_sd <- dt %>% 
  summarize(sd=sd(Prop_Male, na.rm = T))

# Cohen's D: effect Sizes
coh <- dt %>% 
  group_by(Treatment, Clone) %>% 
  summarize(mean=sum(Male_neonates, na.rm=T)/sum(Total_neonates, na.rm=T)) %>% 
  pivot_wider(names_from = c(Treatment), values_from=c(mean)) %>% 
  group_by(Clone) %>% 
  summarize(eff=((MF-C)/pooled_sd$sd))

# Average Effect size across all clones
mean(coh$eff, na.rm=T)

lower_ci <- function(mean, se, n, conf_level = 0.95){
  lower_ci <- mean - qt(1 - ((1 - conf_level) / 2), n - 1) * se
}
upper_ci <- function(mean, se, n, conf_level = 0.95){
  upper_ci <- mean + qt(1 - ((1 - conf_level) / 2), n - 1) * se
}

# Plot results - avg diff bet trmts
out1 <- {dt[Total_neonates>0] %>%
    mutate(male=Male_neonates/Total_neonates) %>% 
    group_by(Treatment, Clone, sc) %>% 
    summarise(male_tot = mean(male, na.rm = TRUE),
              ssd = sd(male, na.rm = TRUE),
              n = n()) %>%
    mutate(se = ssd / sqrt(n),
           lci.male = lower_ci(male_tot, se, n),
           uci.male = upper_ci(male_tot, se, n)) %>% 
  ggplot(.,aes(x=as.factor(Treatment), 
             ymin=lci.male, 
             ymax=uci.male,
             y=male_tot,
             color=sc)) +
  geom_pointrange(position = position_jitterdodge(dodge.width = 0.2, jitter.width = 0.5),
                  size=2) +
  theme_bw() +
  labs(x = "Treatment", 
       color = "Clone",
       fill = "Clone",
       y = "Proportion of Males") +
  scale_color_manual(values = c("C"="Purple", "A"="Blue", "Hybrids"="orange")) +
  #scale_fill_manual(values = c("C"="Purple", "MF"="steelblue4")) +
  theme(strip.text = element_text(face="bold.italic", size=12),
        legend.text = element_text(size=16),
        legend.title = element_text(face="bold", size=18),
        axis.text.x = element_text(face="bold", size=18),
        axis.text.y = element_text(face="bold", size=18),
        axis.title.x = element_text(face="bold", size=18),
        axis.title.y = element_text(face="bold", size=18),
        axis.title = element_text(face="bold", size=20))}

png(filename = "../Data/mf_exposure_mean_CI.png")
out1
dev.off()
```

alt

```
# Plot - avg male prod over time
out2 <- {dt[Total_neonates>0] %>% 
    pivot_longer(cols = c(Prop_Male, Prop_Female, 
                          Male_neonates, Female_neonates)) %>% 
    ggplot(.,aes(x=value, 
                 fill=Treatment)) +
    facet_wrap(~name, nrow = 2, scales = "free_x") +
    geom_histogram(color="black", size=1) +
    theme_bw() +
    labs(x = "Number or Prop.",
         fill = "Treatment",
         y = "Number of Clutches") +
    scale_fill_manual(values = c("C"="lightgreen", "MF"="steelblue4")) +
    theme(strip.text = element_text(face="bold", size=20),
          legend.text = element_text(face="bold", size=20),
          legend.title = element_text(face="bold", size=20),
          axis.text.x = element_text(face="bold", size=18),
          axis.text.y = element_text(face="bold", size=18),
          axis.title.x = element_text(face="bold", size=18),
          axis.title.y = element_text(face="bold", size=18),
          axis.title = element_text(face="bold", size=20))}

pdf(file = "../Data/mf_exposure_tot.pdf")
out2
dev.off()
```

alt

methyl_farnesoate_reproduction's People

Contributors

connor122721 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.