Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
51 lines (39 sloc) 2.1 KB
title output
Combined timeseries table
html_document

Combined timeseries table for the MyConnectome study

Code available at: https://github.com/poldrack/myconnectome/blob/master/myconnectome/timeseries/Make_combined_timeseries_table.Rmd

This table lists associations between variables in the Myconnectome data set that passed a stringent Bonferroni correction of p < 0.05. Associations were also excluded if they had an absolute Pearson r $<$ 0.3, which likely reflected degeneracy of the timeseries model. In addition, associations were excluded within variable sets for WGCNA, metabolomics, and between-network connectivity due to high numbers of associations within those variable sets, in order to focus more clearly on candidate relationships between variable sets.


library(knitr)

basedir=Sys.getenv('MYCONNECTOME_DIR')
if (basedir=='') {basedir='/Users/poldrack/data_unsynced/myconnectome'}
tsdir=sprintf('%s/timeseries',basedir)

resultfiles=c()
for (f in dir(tsdir)) {
  if (!is.na(pmatch('out.dat',f))) {resultfiles=c(resultfiles,f)}
}

data=c()
for (r in resultfiles) {
  if (!grepl('wgcna_wgcna',r) & !grepl('metab_metab',r) & !grepl('bwcorr_bwcorr',r)  & !grepl('pindex',r) & !grepl('netdat',r)) {
    df=read.table(sprintf('%s/%s',tsdir,r),header=TRUE)
    vars=strsplit(strsplit(r,'\\.')[[1]][3],'_')[[1]]
    df$xvartype=vars[1]
    df$yvartype=vars[2]
    data=rbind(data,df)
    }
}
cat(sprintf('Total number of variables:%d',dim(data)[1]))
data$arima.p[is.na(data$arima.p)]=1
data$pval_bh=p.adjust(data$arima.p,method='BH')
data$pval_bonf=p.adjust(data$arima.p,method='bonferroni')
data_full=data
data=data[data$cor.val>0.3,]

idx=order(data$xvartype) 

data=data[idx,]
print(kable(data[data$pval_bonf<0.05,c(12,1,13,2,3,4,10,11,14)],row.names=FALSE))

kl=kable(data[data$pval_bonf<0.05,c(12,1,13,2,3,4,10,14)],row.names=FALSE,
         digits=c(1,1,1,1,3,2,0,4),format='latex')
write(kl,file=sprintf('%s/timeseries/combined_timeseries_table.tex',basedir))