projetos:outros:lecydata:analises

Estrutura Filogenética usando Phylocom

Arquivo:Alexandre/R/Lecy/ReultFIlo/LecySTRU

Os subdiretórios nesta pasta incluem os resultados de análises para três escalas (10×10, 20×20 e 40×40). Cada subdiretório representa um dos modelos nulos possíveis (ver abaixo). A filogenia usada foi aquela mais conservativa (a mesma que estivemos usando).

  • MPD = mean phylogenetic distance
  • MPD.rnd = mean phylogenetic distance of all randomly generated null communities
  • MPD.sd = standard deviation of phylogenetic distance of all randomly generated null communities
  • NRI = -1 * (MPDsample – rndMPDsample) / (sd_rndMPDsample)
  • MPD.rankLow = number null communities with MPD less than or equal to observed
  • MPD.rankHi = number null communities with MPD greater than or equal to observed

Note: These ranks can be used to calculate P-values (e.g. for a one-tailed P-value, divide a rank by the number of runs + 1). Note that if the sum of rankLow and rankHi for MPD or MNND is not close to the number of runs, there must be a large number of ties between observed and null community values and results should be interpreted with caution. This situation may arise when using very small phylogenies or numbers of samples.

  • MNND = mean nearest phylogenetic neighbor distance for each sample
  • MNND.rnd = mean nearest phylogenetic neighbor of all randomly generated null communities
  • MNND.sd = standard deviation of nearest phylogenetic neighbor of all randomly generated null communities
  • NTI = -1 * (MNNDsample – rndMNNDsample) / (sd_rndMNNDsample)
  • MNND.rankLow = number null communities with MNND less than or equal to observed
  • MNND.rankHi = number null communities with MNND greater than or equal to observed

Note: Two measures of “standardized effect size” of community phylogenetic structure are calculated: the Net Relatedness Index (NRI) and Nearest Taxon Index (NTI) describe the difference between average phylogenetic distances in the observed and null communities, standardized by the standard deviation of phylogenetic distances in the null communities. NRI and NTI are calculated for each sample in a manner similar to that described in Webb et al. 2002.

Choosing an appropriate null model to measure community phylogenetic structure requires careful consideration. Every null model makes different assumptions, and using two null models to analyze the same data can give radically different results! See Gotelli (2000) or Gotelli and Graves (1996) for an evaluation of the assumptions and shortcomings of the different types of null models implemented in this software, and Kembel and Hubbell (2006) for an example of these null models applied to ecological data.

This null model shuffles species labels across the entire phylogeny. This randomizes phylogenetic relationships among species.

Arquivos de dados

Arquivo resultado escala 10 m Arquivo resultado escala 20 m Arquivo resultado escala 40 m

Resultados mostrando para cada subparcela de 20×20 o valor do efeito filogenetico:

Phylogenetic clustering

Phylogenetic overdispersion

Species in each sample become random draws from sample pool - This null model maintains the species richness of each sample, but the identities of the species occurring in each sample are randomized. For each sample, species are drawn without replacement from the list of all species actually occurring in at least one sample. Thus, species in the phylogeny that are not actually observed to occur in a sample will not be included in the null communities.

Resultados mostrando para cada subparcela de 20×20 o valor do efeito filogenetico:

Phylogenetic clustering

Phylogenetic overdispersion

Species in each sample become random draws from phylogeny pool. This null model maintains the species richness of each sample, but the identities of the species occurring in each sample are randomized. For each sample, species are drawn without replacement from the list of all species in the phylogeny pool. All species in the phylogeny will have equal probability of being included in the null communities.

Arquivo resultado escala 10 Arquivo resultado escala 20 Arquivo resultado escala 40

Resultados mostrando para cada subparcela de 20×20 o valor do efeito filogenetico:

Phylogenetic clustering

Phylogenetic overdispersion

The independent swap algorithm (Gotelli and Entsminger 2003; also known as “SIM9” (Gotelli 2000)) creates swapped versions of the sample/species matrix. It constrains the swapped matrices to have the same row and column totals as the original matrix (i.e. number of species per sample and frequency of occurrence of each species across samples are held constant as species co-occurrences in samples are randomized). The algorithm searches the presence/absence matrix for “checkerboard” cells (pairs of species/samples of the form (0..1),(1..0) or vice versa) and swaps these cell contents when it finds them.

Arquivo resultado escala 10 Arquivo resultado escala 20 Arquivo resultado escala 40

Resultados mostrando para cada subparcela de 20×20 o valor do efeito filogenetico:

Phylogenetic clustering

Phylogenetic overdispersion

  • Plotar distância phylogenética média e desvio padrão para os oito hábitats em 20×20 (ALEXANDRE). Testar se as

médias são diferentes.

Sample Pool

HabitatntaxaMPDMPD.rndMPD.sdNRIMPD.rankLowMPD.rankHiMNNDMNND.rndMNND.sdNTIMNND.rankLoMNND.rankHiruns
1241.39331.39330.0000-2.6365010000.65960.65960.0000nan100010001000
2241.39331.39330.0000-2.602139980.65960.65960.0000nan100010001000
3211.34371.39280.03081.5933921790.68480.71430.06450.45706603431000
4241.39331.39330.0000-2.701839970.65960.65960.0000nan100010001000
5241.39331.39330.0000-2.638339980.65960.65960.0000nan100010001000
6241.39331.39330.0000-2.666659970.65960.65960.0000nan100010001000
7241.39331.39330.0000-2.591659970.65960.65960.0000nan100010001000
8241.39331.39330.0000-2.641429980.65960.65960.0000nan100010001000

Phylogeny Shuffle

HabitatntaxaMPDMPD.rndMPD.sdNRIMPD.rankLowMPD.rankHiMNNDMNND.rndMNND.sdNTIMNND.rankLoMNND.rankHiruns
1241.39331.43930.01792.5698911890.65960.67430.03010.48658012881000
2241.39331.43930.01792.5698911890.65960.67430.03010.48658012881000
3211.34371.44100.03612.6951989110.68480.73340.06190.78557692321000
4241.39331.43930.01792.5698911890.65960.67430.03010.48658012881000
5241.39331.43930.01792.5698911890.65960.67430.03010.48658012881000
6241.39331.43930.01792.5698911890.65960.67430.03010.48658012881000
7241.39331.43930.01792.5698911890.65960.67430.03010.48658012881000
8241.39331.43930.01792.5698911890.65960.67430.03010.48658012881000

Phylogeny Pool

HabitatntaxaMPDMPD.rndMPD.sdNRIMPD.rankLowMPD.rankHiMNNDMNND.rndMNND.sdNTIMNND.rankLoMNND.rankHiruns
1241.39331.43960.01802.5690911890.65960.67310.02810.47738062831000
2241.39331.43960.01802.5690911890.65960.67310.02810.47738062831000
3211.34371.44080.03792.5579986140.68480.73390.06530.75197642371000
4241.39331.43960.01802.5690912880.65960.67310.02810.47738062831000
5241.39331.43960.01802.5690911890.65960.67310.02810.47738062831000
6241.39331.43960.01802.5690911890.65960.67310.02810.47738062831000
7241.39331.43960.01802.5690911890.65960.67310.02810.47738062831000
8241.39331.43960.01802.5690913880.65960.67310.02810.47738062831000
  • Estrutura phylogenética de comunidades: Phylogenetic clustering vs. Phylogenetic overdispersion
  • Checar se a abundância entra nos cálculos do Phylomat (BETO)
  Gráficos parcela em três cores: 
	Overdispersion:		
		PV<0.05 (red), 
		PV>=0.05  e <0.1 (laranja); 
		PV>=0.1 (yellow)
	Clustering
		PV<0.05 (azul escuro), 
		PV>=0.05  e <0.1 (azul claro); 
		PV>=0.1 (azul esverdeado)
	Nan = branco
  
  Para cada uma das escalas e cada um dos modelos nullos. 
  • Calcular o P e o valor para a parcela toda para cada um dos modelos (Tabela)
    Alexandre: Independent Swaps e Phylogeny pool
    Beto: Phylogeny shuffle e Sample pool
  • Beto: Usei as funções abaixo para ler os resultados do Phylocom e plotar os valores de P para MPD de cada subparcela. Para funcionar as duas funções abaixo precisam estar instaladas. Precisa também dos dados originais lecydata e lecydistmat
my.read.phylocom <- function(
			phylocom.output="lecy20results.txt",
			gridsize=20,
			plotdim=c(1000,1000),
			phylo.test = "clustering",
			title="Phylogenetic Shuffle"
			) 
		{

	temp.f = read.table(phylocom.output,header=T,sep="\t")	
	if (phylo.test=="overdispersion") {
		temp.f[is.na(temp.f$MPD),"MPD.rankHi"] <- NA
		temp.f$PV <- temp.f$MPD.rankHi/temp.f$runs
	}
	if (phylo.test=="clustering") {
		temp.f[is.na(temp.f$MPD),"MPD.rankLow"] <- NA
		temp.f$PV <- temp.f$MPD.rankLow/temp.f$runs
	}
	rownames(temp.f) <- temp.f$plot

	#REFAZ PRODUCAO DE DADOS PARA PHYLOCOM PARA TER A PARCELA
	abund(lecydata,gridsize=gridsize) -> fl
	
	#get species with phylogenetic information
	sppmatch1=rownames(fl)%in%rownames(lecydistmat)
	fl = fl[sppmatch1,]

	#sample file as required by phylocom
	fl = as.data.frame(t(fl))

	#nome da parcela em phylocom e da parcela original
	plotname = as.data.frame(cbind(rownames(fl),1:dim(fl)[1],rownames(fl)))
	
	colnames(plotname) <- c("PLOT","PHYLOCOM.PLOT","PLOT.NAME")
	plotname[,1] <- as.numeric(gsub("X","",as.vector(plotname[,1])))
	plotname$X <- ceiling(plotname[,1]/(plotdim[2]/gridsize))
	plotname$Y <- (plotname[,1]-((plotdim[2]/gridsize)*plotname$X))+(plotdim[1]/gridsize)
	plotname$PV <- temp.f[rownames(plotname),"PV"] 
	     
	temp.res = matrix(NA,nrow=plotdim[2]/gridsize,ncol=plotdim[1]/gridsize)
	
		pv = plotname[!is.na(plotname$PV),"PV"]
		pv1 = length(pv[pv<0.05])
		pv2 = length(pv[pv>=0.05 & pv<0.1])
		pv3 = length(pv[pv>=0.1])
	
		cat("Test for phylogenetic ",phylo.test,"\n")
		cat("\tNumber subplots with P<0.05",pv1,"\n")
		cat("\tNumber subplots with P>=0.05 & P<0.1",pv2,"\n")
		cat("\tNumber subplots with P>=0.1",pv3,"\n\n")
	
	for (i in 1:dim(plotname)[1]) {		
		x = plotname[i,"X"]
		y = plotname[i,"Y"]
		pv = plotname[i,"PV"]
		if (is.na(pv)) {p=4} else {
			if (pv<0.05) {p=1}
			if (pv>=0.05 & pv<0.1) {p=2}		
			if (pv>0.1) {p=3}
		}
		temp.res[x,y] <- p
	}
	title = paste(title," (",phylo.test,") ",sep="")
	my.img(temp.res,title=title)
}
 my.img <- function(x,title="") {
	di = dim(x)
    nr <- di[1]
    nc <- di[2]
	rowInd <- 1L:nr
	colInd <- 1L:nc
    op <- par(no.readonly = TRUE)
    on.exit(par(op))
    plot(1L:nc, 1L:nr, xlim = 0.5 + c(0, nc+10), ylim = 0.5 +
        c(0, nr), axes = F, xlab = "", ylab = "",type="n",asp=1)
	temp.x = as.data.frame(x)		
	for (b in 1:dim(temp.x)[1]) {
		for (c in 1:dim(temp.x)[2]) {
			temp.v = as.vector(temp.x[b,c])
			if (!is.na(temp.v)) {
				temp.v = as.numeric(round(temp.v,2))
				xx = c(c-0.5,c-0.5,c+0.5,c+0.5)
				yy = c(b-0.5,b+0.5,b+0.5,b-0.5)
				if (temp.v==1) {bg.col="darkred"}
				if (temp.v==2) {bg.col="red"}
				if (temp.v==3) {bg.col="orange"}
				if (temp.v==4) {bg.col="yellow"}
				polygon(xx,yy,density=-1,col=bg.col,border=NA)
			}
		}
	}
	par(mgp=c(1.5,0.2,0),tcl=-0.1)
	axis(1, 1L:nc, las = 2, line=-1*(par("mar")[1]-2.7), cex.axis = 0.4,lwd=0.1)
	axis(2, 1L:nr, line=-1, las=2,cex.axis = 0.4,lwd=0.1)
	mtext(title,side=3,adj=0.35,cex=1,font=2,line=-1*(par("mar")[3]-2))
	temp.leg = c("P<0.05","P>=0.05 & P<0.1","P>0.1","Nan")
	temp.col =c("darkred","red","orange","yellow","white")
	cc = nc+2
	bb = (nr/2)
	text(cc+1,bb+2,labels="P value",adj=0)
	for (k in 1:length(temp.leg)) {
				xx = c(cc-0.5,cc-0.5,cc+0.5,cc+0.5)
				yy = c(bb-0.5,bb+0.5,bb+0.5,bb-0.5)
				polygon(xx,yy,density=-1,col=temp.col[k],lwd=0.1)
				text(cc+1.2,bb,as.character(temp.leg[k]),cex=0.7,adj=0)
				bb = bb-1.5	
	}
}

Beto - 23Jun08 - : De fato algumas parcelas que estão incluídas no arquivo de input do Phylocom não aparecem no arquivo de output. Acredito que é um bug do programa e irei escrever aos autores para saber o que está ocorrendo, mas preciso primeiro rodar uma nova análise para ter certeza de que é isso mesmo. Dos 2337 subparcelas do 20×20 só aparecem 2190 nos resultados.

Beto - 28Jun08 - : Chequei a história das parcelas que pareciam estar sumindo. Na verdade não estão não. Está tudo certo. Das 2337 parcelas tem 147 onde não há nenhum indivíduo de Lecy, por isso a discrepância…. Então os resultados estão corretos.

Resultados mostrando para cada subparcela de 20×20 o valor do efeito filogenetico:

Resultados de todos os modelos

  • /home/adalardo/farm/labtrop/data/pages/projetos/outros/lecydata/analises.txt
  • Última modificação: 2026/03/27 13:51
  • por 127.0.0.1