version
version
install.packages("geomorph")
library(geomorph)
install.packages("rgl")
library(geomorph)
install.packages("geomorph")
library(geomorph)
library(qtl)
install.packages("qtl")
library(qtl)
?fitqtl
install.packages("shapes")
library(shapes)
install.packages("rgl")
library(rgl)
version
library(rgl)
install.packages("~/Desktop/rgl/configure", repos = NULL)
install.packages("~/Downloads/rgl_0.94.1131.tar.gz", repos = NULL, type = "source")
install.packages("rgl")
library(rgl)
qcbs_r_registration <- function(workshop=NULL,location=NULL)
{
file<-postForm('http://qcbs.ca/qcbs-database/r-registration-csv.php',workshop=workshop,location=location,key='9HJS975LKM4FPST48SNMLE12l')
read.csv(textConnection(file))
}
library(RCurl)
class_list <- qcbs_r_registration(workshop=1,location="UdeM")
View(class_list)
qcbs_r_registration <- function(workshop=NULL,location=NULL)
{
file<-postForm('http://qcbs.ca/qcbs-database/r-registration-csv.php',workshop=workshop,location=location,key='9HJS975LKM4FPST48SNMLE12l')
read.csv(textConnection(file))
}
library(RCurl)
class_list <- qcbs_r_registration(workshop=1,location="UdeM")
View(class_list)
install.packages("phangorn")
library(phangorn)
citation()
citation(R)
setwd("~/Desktop/Nectar")
n<-read.table("nectar.csv",h=T,sep=";")
View(n)
anova<-aov(n$volume.ul.~n$individu)
summary(anova)
anova
model<-lm(n$volume.ul.~n$individu)
summary(model)
View(n)
rm(list=ls())
library(geomorph)
library(shapes)
library(ade4)
#1) extract landmark coordinates from each photo
setwd("~/QTL_gesneria/analyses morphologie/geometric_morphometric_complet_2014_08_08")
morpho_tot<-readland.nts("landmarks_complet_2014_08_08.NTS")
attributes(morpho_tot)
dimnames(morpho_tot)[[3]]<-tolower(dimnames(morpho_tot)[[3]])
# keep only photos with flowers having 5 petals
n5petals<-scan("inidividus_5petals_a_garder.txt",what="char",quote="",sep="\n",comment.char="\"")
morpho_tot<-morpho_tot[,,dimnames(morpho_tot)[[3]]%in%n5petals]
#2) create a file with individual names (just once)
#write.table(dimnames(morpho_tot)[[3]],file="specimen.txt",sep="\t")
# change individual manes in excel
#3) change dimnames of morpho_tot to get individual names
ind<- scan("individu5petals.txt",what="char",quote="",sep="\n",comment.char="\"")
dimnames(morpho_tot)[[3]]<-ind
donnees<-list(ind,morpho_tot)
names(donnees)<-c("individu","data")
#3) supress strange individuals h230,h134,h190,h1
data<-donnees$data[,,dimnames(donnees$data)[[3]]!="h230"]
data<-data[,,dimnames(data)[[3]]!="h134"]
data<-data[,,dimnames(data)[[3]]!="h190"]
data<-data[,,dimnames(data)[[3]]!="h1"]
individu<-ind
individu<-individu[individu!="h230"]
individu<-individu[individu!="h134"]
individu<-individu[individu!="h190"]
individu<-individu[individu!="h1"]
# extract only hybrids and parents
hyb<-data[,,1:679]
id<-individu[1:679]
# extract Simon data (genus)
load("landmark_data_Simon.R")
load("data_pollinisateur_Simon.R")
rawland
data$ordre<-seq(1,139)
sp_data<-rbind(data,data)
sp_data<-sp_data[ order(sp_data$ordre), ]
dimnames(rawland)[[3]]<-sp_data$FileName
# keep only individuals for species with known pollinators
good<-sp_data[sp_data[,5]=="hummingbird"|sp_data[,5]=="generalist",2]
sp<-rawland[,,dimnames(rawland)[[3]]%in%good]
#change orientation of Simon data
sp_t<-array(NA,dim=c(32,2,162))
for(ind in 1:162){
sp_t[c(1,3:17),1,ind]<-sp[c(1,3:17),1,ind]*(-1)
sp_t[c(2,18:32),1,ind]<-sp[c(2,18:32),1,ind]*(-1)
sp_t[,2,ind]<-sp[,2,ind]
}
dimnames(sp_t)<-dimnames(sp)
#append hyb and sp data
library(abind)
tot<-abind(sp_t,hyb)
setwd("~/Desktop/geometric_morphometric_complet_2014_08_08")
morpho_tot<-readland.nts("landmarks_complet_2014_08_08.NTS")
attributes(morpho_tot)
dimnames(morpho_tot)[[3]]<-tolower(dimnames(morpho_tot)[[3]])
# keep only photos with flowers having 5 petals
n5petals<-scan("inidividus_5petals_a_garder.txt",what="char",quote="",sep="\n",comment.char="\"")
morpho_tot<-morpho_tot[,,dimnames(morpho_tot)[[3]]%in%n5petals]
#2) create a file with individual names (just once)
#write.table(dimnames(morpho_tot)[[3]],file="specimen.txt",sep="\t")
# change individual manes in excel
#3) change dimnames of morpho_tot to get individual names
ind<- scan("individu5petals.txt",what="char",quote="",sep="\n",comment.char="\"")
dimnames(morpho_tot)[[3]]<-ind
donnees<-list(ind,morpho_tot)
names(donnees)<-c("individu","data")
#3) supress strange individuals h230,h134,h190,h1
data<-donnees$data[,,dimnames(donnees$data)[[3]]!="h230"]
data<-data[,,dimnames(data)[[3]]!="h134"]
data<-data[,,dimnames(data)[[3]]!="h190"]
data<-data[,,dimnames(data)[[3]]!="h1"]
individu<-ind
individu<-individu[individu!="h230"]
individu<-individu[individu!="h134"]
individu<-individu[individu!="h190"]
individu<-individu[individu!="h1"]
# extract only hybrids and parents
hyb<-data[,,1:679]
id<-individu[1:679]
# extract Simon data (genus)
load("landmark_data_Simon.R")
load("data_pollinisateur_Simon.R")
rawland
data$ordre<-seq(1,139)
sp_data<-rbind(data,data)
sp_data<-sp_data[ order(sp_data$ordre), ]
dimnames(rawland)[[3]]<-sp_data$FileName
# keep only individuals for species with known pollinators
good<-sp_data[sp_data[,5]=="hummingbird"|sp_data[,5]=="generalist",2]
sp<-rawland[,,dimnames(rawland)[[3]]%in%good]
#change orientation of Simon data
sp_t<-array(NA,dim=c(32,2,162))
for(ind in 1:162){
sp_t[c(1,3:17),1,ind]<-sp[c(1,3:17),1,ind]*(-1)
sp_t[c(2,18:32),1,ind]<-sp[c(2,18:32),1,ind]*(-1)
sp_t[,2,ind]<-sp[,2,ind]
}
dimnames(sp_t)<-dimnames(sp)
#append hyb and sp data
library(abind)
tot<-abind(sp_t,hyb)
attributes(tot)
getwd()
save(tot,file="morphometric_data.R")
rm(list=ls())
setwd("~/Desktop/donnees_papier_QTL_public")
library(geomorph)
library(shapes)
library(ade4)
load("morphometric_data.R")
morpho<-load("morphometric_data.R")
dimnames(morpho)
load("morphometric_data.R")
dimnames(tot)
hybrids<-tot[,,163:841]
names(hybrids)<-c("individu","data")
semi.landmarks<-as.matrix(read.table(file.choose(),h=T))# choose the file "semi_landmarks.txt"
PROC<-gpagen(hybrids$data,curves=semi.landmarks)
names(hybrids)
dimnames(hybrids)[[3]]
dimnames(hybrids)
dim(tot)
hybrids<-tot[,,163:841]
dim(hybrids)
PROC<-gpagen(hybrids,curves=semi.landmarks)
mean.shape.hybrids<-array(NA,dim=c(32,2,length(unique(dimnames(hybrids)[[3]]))))
for (point in (1:32)){
for (xy in (1:2)){
res<-tapply(PROC$coord[point,xy,],dimnames(hybrids)[[3]],mean)
mean.shape.hybrids[point,xy,]<-res
}
}
dimnames(mean.shape.hybrids)<-list(NULL,NULL,names(res))
PROC.t<-aperm(mean.shape.hybrids,c(3,1,2))
dim(PROC.t)
PROC.mat<-cbind(PROC.t[,,1],PROC.t[,,2])
rownames(PROC.mat)<-dimnames(mean.shape.hybrids)[[3]]
#make pca
pca<-dudi.pca(PROC.mat,scannf=T,scale=F)
#extract pc coordinates for each individual
coord_hybpca<-cbind(rownames(pca$li),pca$li)
pca<-dudi.pca(PROC.mat,scannf=T,scale=F)
pourcent<-(pca$eig/sum(pca$eig))*100
pourcent
View(PROC.mat)
semi.landmarks<-as.matrix(read.table(file.choose(),h=T))
PROC<-gpagen(tot,curves=semi.landmarks)
mean.shape.all<-array(NA,dim=c(32,2,length(unique(dimnames(PROC$coord)[[3]]))))
for (point in (1:32)){
for (xy in (1:2)){
res<-tapply(PROC$coord[point,xy,],dimnames(PROC$coord)[[3]],mean)
mean.shape.all[point,xy,]<-res
}
}
dimnames(mean.shape.all)<-list(NULL,NULL,names(res))
# perform PCA on the genus and project the F2 individuals on it
# create a matrix
PROC.mat<-two.d.array(mean.shape.all)
rownames(PROC.mat)<-dimnames(mean.shape.all)[[3]]
# extract data for wild specimen
wild.sp<-PROC.mat[c(5:45,181:220),]
# make PCA
pca_especes<-dudi.pca(wild.sp,scannf=T,scale=F)
pourcent<-(pca_especes$eig/sum(pca_especes$eig))*100
pourcent
hybrids[1,1,]
