In: Statistics and Probability
Use R programming to resolve this; can you please provide details on the code?
A) Create a dataframe – comparativeGenomeSize with the following
vectors:
> organism<-c("Human","Mouse","Fruit Fly", "Roundworm","Yeast")
> genomeSizeBP<-c(3000000000,3000000000,135600000,97000000,12100000)
> estGeneCount<-c(30000,30000,13061,19099,6034)
B) Print the organism and estGeneCount for Human and
fruitfly.(1)
C) Add a column to this data frame calculating base pairs per
gene. To do this, write a function “genedensity” that takes as
arguments the genomesizeBP and estimatedGeneCount information, and
calculates from this the estimated bp per gene. (3)
Let X be normally distributed with mean 24 and variance 16 b)
Calculate the following probabilities: (2)
– P(X ≤ 20)
– P(X > 29.5)
Write a while loop that prints out standard random normal
numbers (use rnorm()) (1)
Using next adapt the loop from the last exercise so that it doesn’t
print negative numbers. (2)
(A) & (B)
> organism<-c("Human","Mouse","Fruit Fly", "Roundworm","Yeast")
> genomeSizeBP<-c(3000000000,3000000000,135600000,97000000,12100000)
> estGeneCount<-c(30000,30000,13061,19099,6034)
>comparativeGenomeSize<-data.frame(organism=organism,genomeSizeBP=genomeSizeBP, estGeneCount=estGeneCount)
>comparativeGenomeSize
(C)
> #function geneDensity simply calculates bp per gene
> geneDensity<-function(bp,genes){ + bp/genes}
> #pass data frame columns to function geneDensity
> #storing results in variable bpPerGene
> bpPerGene<-geneDensity(comparativeGenomeSize$genomeSizeBP, + comparativeGenomeSize$estGeneCount)
> #result of function computation
> bpPerGene
(2)