<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to n_integration</title><link>https://sourceforge.net/p/gemma-omics-integrate/wiki/n_integration/</link><description>Recent changes to n_integration</description><atom:link href="https://sourceforge.net/p/gemma-omics-integrate/wiki/n_integration/feed" rel="self"/><language>en</language><lastBuildDate>Tue, 21 Feb 2023 07:33:16 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/gemma-omics-integrate/wiki/n_integration/feed" rel="self" type="application/rss+xml"/><item><title>n_integration modified by Karoliina Salenius</title><link>https://sourceforge.net/p/gemma-omics-integrate/wiki/n_integration/</link><description>&lt;div class="markdown_content"&gt;&lt;h1 id="multi-omics-data-integration-for-multiple-measurements"&gt;Multi-omics data integration for multiple measurements&lt;/h1&gt;
&lt;h1 id="from-the-same-individuals-in-data-matrices-samples-are"&gt;from the same individuals. In data matrices, samples are&lt;/h1&gt;
&lt;h1 id="in-columns-and-features-in-rows"&gt;in columns and features in rows.&lt;/h1&gt;
&lt;h1 id="_1"&gt;&lt;/h1&gt;
&lt;h1 id="datasets-used-in-the-study-from-ssc-available-in-geo"&gt;Datasets used in the study from SSC available in GEO&lt;/h1&gt;
&lt;h1 id="under-accessions-gse23682-copynumber"&gt;under accessions: GSE23682 (copynumber),&lt;/h1&gt;
&lt;h1 id="gse37772-expression-and-gse27044-methylation"&gt;GSE37772 (expression) and GSE27044 (methylation)&lt;/h1&gt;
&lt;h1 id="_2"&gt;&lt;/h1&gt;
&lt;h1 id="samplenames-with-xxxxxxp-or-xxxxxxs-to-indicate"&gt;Samplenames with xxxxxx.p or xxxxxx.s to indicate&lt;/h1&gt;
&lt;h1 id="autist-proband-and-their-unaffected-sibling"&gt;autist proband and their unaffected sibling.&lt;/h1&gt;
&lt;h1 id="_3"&gt;&lt;/h1&gt;
&lt;h1 id="datasets-preprocessed-and-normalized-accordngly"&gt;Datasets preprocessed and normalized accordngly&lt;/h1&gt;
&lt;h1 id="for-each-datatype-prior-to-this-point"&gt;for each datatype prior to this point.&lt;/h1&gt;
&lt;h1 id="_4"&gt;&lt;/h1&gt;
&lt;h6 id="_5"&gt;&lt;/h6&gt;
&lt;h1 id="install-packages"&gt;Install packages&lt;/h1&gt;
&lt;p&gt;x=c("mixOmics","org.Hs.eg.db","GenomicRanges","annotatr","AnnotationDbi","ReactomePA","clusterProfiler","enrichplot")&lt;br/&gt;
lapply(x,BiocManager::install(x),character.only=T)&lt;br/&gt;
lapply(x,library,character.only=T) &lt;/p&gt;
&lt;h1 id="prepare-the-data-for-expression-and-methylation-select-2000-most"&gt;Prepare the data, for expression and methylation select 2000 most&lt;/h1&gt;
&lt;h1 id="variable-genes-probes-one-option-is-to-run-differential-analysis"&gt;variable genes / probes. One option is to run differential analysis&lt;/h1&gt;
&lt;h1 id="for-each-datatype-and-select-n-most-differentially-expressed-genes-probes"&gt;for each datatype and select N most differentially expressed genes / probes.&lt;/h1&gt;
&lt;p&gt;var=rowVars(exp)&lt;br/&gt;
ord=order(var, decreasing=T)&lt;br/&gt;
exp=exp&lt;span&gt;[ord[1:2000]&lt;/span&gt;,]&lt;br/&gt;
var=rowVars(meth)&lt;br/&gt;
ord=order(var, decreasing=T)&lt;br/&gt;
meth=meth&lt;span&gt;[ord[1:2000]&lt;/span&gt;,]&lt;/p&gt;
&lt;p&gt;X = list("Expression"=exp, "Methtylation"=meth, "Copynumber"=cn)&lt;br/&gt;
Y = as.factor(substr(colnames(exp), 7,7))&lt;br/&gt;
levels(Y)=c("ctrl","asd")&lt;br/&gt;
names(Y)=colnames(exp)&lt;/p&gt;
&lt;h1 id="prepare-pairs-of-datatypes-for-initial-analysis-to-detect-correlation"&gt;Prepare pairs of datatypes for initial analysis to detect correlation&lt;/h1&gt;
&lt;h1 id="levels-between-datatypes"&gt;levels between datatypes&lt;/h1&gt;
&lt;p&gt;x1=list(t(X$Expression),t(X$Copynumber))&lt;br/&gt;
names(x1)=c("Expression", "Copynumber")&lt;br/&gt;
list.keepx1 &amp;lt;- list(Expression = c(20,20), Copynumber=c(5,5))&lt;br/&gt;
x2=list(t(X$Expression),t(X$Methylation))&lt;br/&gt;
names(x2)=c("Expression","Methylation")&lt;br/&gt;
list.keepx2 &amp;lt;- list(Expression = c(20,20), Methylation=c(20,20))&lt;br/&gt;
x2=list(t(X$Methylation),t(X$Copynumber))&lt;br/&gt;
names(x3)=c("Methylation","Copynumber")&lt;br/&gt;
list.keepx3 &amp;lt;- list(Methylation = c(20,20), Copynumber=c(5,5))&lt;/p&gt;
&lt;h1 id="perform-blockplsda-for-each-pair-of-data-to-see-the-level-of-correlation"&gt;Perform block.plsda for each pair of data to see the level of correlation&lt;/h1&gt;
&lt;p&gt;blockpls1=block.plsda(x1, Y, ncomp=2)&lt;br/&gt;
plotDiablo(blockpls1)&lt;br/&gt;
perf1=perf(blockpls1, validation = 'Mfold', folds=3, nrepeat = 10)&lt;br/&gt;
plot(perf1,legend.position="horizontal")&lt;/p&gt;
&lt;p&gt;blockpls2=block.plsda(x2, Y, ncomp=2)&lt;br/&gt;
plotDiablo(blockpls2)&lt;br/&gt;
perf2=perf(blockpls2, validation = 'Mfold', folds=3, nrepeat = 10)&lt;br/&gt;
plot(perf2, legend.position="horizontal", col=color.mixo(5:7))&lt;/p&gt;
&lt;p&gt;blockpls3=block.plsda(x3, Y, ncomp=2)&lt;br/&gt;
plotDiablo(blockpls3)&lt;br/&gt;
perf3=perf(blockpls3, validation = 'Mfold', folds=3, nrepeat = 10)&lt;br/&gt;
plot(perf3, legend.position="horizontal", col=color.mixo(5:7))&lt;/p&gt;
&lt;h1 id="select-optimal-number-of-features-and-components-generally-components-nresponse-1"&gt;Select optimal number of features and components (generally components = N(response)-1)&lt;/h1&gt;
&lt;p&gt;keep_exp=tune(method="splsda", X=t(exp),Y=Y, ncomp=2, test.keepX=c(5,50,100), nrepeat=5)&lt;br/&gt;
plot(keep_exp)&lt;br/&gt;
keep_m=tune(method="splsda", X=t(meth),Y=Y, ncomp=2, test.keepX=c(5,50,100), nrepeat=5)&lt;br/&gt;
plot(keep_m)&lt;br/&gt;
keep_cn=tune(method="splsda", X=t(cn),Y=Y, ncomp=2, test.keepX=c(5,50,100), nrepeat=5)&lt;br/&gt;
plot(keep_cn)&lt;/p&gt;
&lt;h1 id="list-the-optimal-number-of-features-to-keep-from-each-component"&gt;List the optimal number of features to keep from each component&lt;/h1&gt;
&lt;p&gt;list.keepx &amp;lt;- list(Expression=keep_exp$choice.keepX,Methylation = keep_m$choice.keepX, keep_cn$choice.keepX)&lt;/p&gt;
&lt;h1 id="design-matrices-for-blocksplsda-select-correlation-based-on-the-blockplsda-results"&gt;Design matrices for block.splsda, select correlation based on the block.plsda results&lt;/h1&gt;
&lt;p&gt;design_x1=matrix(c(0,0.3,0.5,0.3,0,0.5,0.5,0.5,0), nrow=3, ncol=3, dimnames=list(c(names(x1),"Y"), c(names(x1),"Y")))&lt;/p&gt;
&lt;p&gt;splsda1=block.splsda(X, Y, keepX=list.keepx, ncomp=2, design = design_x1)&lt;/p&gt;
&lt;h1 id="plot-results"&gt;Plot results&lt;/h1&gt;
&lt;p&gt;plotDiablo(splsda1)&lt;br/&gt;
circosPlot(splsda1, cutoff=0.5, size.variables = 0.4)&lt;br/&gt;
cimDiablo(splsda1)&lt;/p&gt;
&lt;h1 id="selected-variables"&gt;Selected variables&lt;/h1&gt;
&lt;p&gt;variables_x1=selectVar(splsda1, comp=1)&lt;br/&gt;
variables_x2=selectVar(splsda1, comp=2)&lt;/p&gt;
&lt;h1 id="make-a-granges-object-of-the-selected-copynumber-segments"&gt;Make a granges object of the selected copynumber segments&lt;/h1&gt;
&lt;p&gt;sel_cn=c(variables_x1$Copynumber$name,variables_x2$Copynumber$name)&lt;br/&gt;
chrom=unlist(lapply(strsplit(sel_cn, ":"),&lt;code&gt;[&lt;/code&gt;,1))&lt;br/&gt;
pos=unlist(lapply(strsplit(sel_cn, ":"),&lt;code&gt;[&lt;/code&gt;,2))&lt;br/&gt;
start=unlist(lapply(strsplit(pos, "-"),&lt;code&gt;[&lt;/code&gt;,1))&lt;br/&gt;
end=unlist(lapply(strsplit(pos, "-"),&lt;code&gt;[&lt;/code&gt;,2))&lt;br/&gt;
selected_gr=GRanges(seqnames=chrom, ranges=IRanges(start=as.numeric(start), end=as.numeric(end)), strand=rep("*",length(chrom)))&lt;/p&gt;
&lt;h1 id="annotate-segments"&gt;Annotate segments&lt;/h1&gt;
&lt;p&gt;annots=c("hg38_cpgs", "hg38_basicgenes")&lt;br/&gt;
annotations = build_annotations(genome = 'hg38', annotations = annots)&lt;br/&gt;
cn_ann=annotate_regions(regions=selected_gr, annotations=annotations, ignore.strand=T, quiet=FALSE, minoverlap=1)&lt;br/&gt;
summarize_annotations(cn_ann)&lt;br/&gt;
annot_df=as.data.frame(cn_ann$annot)&lt;br/&gt;
genes_cn=unique(annot_df$symbol)&lt;br/&gt;
genes_cn=genes_cn&lt;span&gt;[!is.na(genes_cn)]&lt;/span&gt;&lt;/p&gt;
&lt;h1 id="list-of-all-selected-features-as-genes"&gt;List of all selected features as genes&lt;/h1&gt;
&lt;p&gt;genelist=c(variables_x1$Expression$name, variables_x2$Expression$name, &lt;br/&gt;
           variables_x1$Methylation$name, variables_x2$Methylation$name,&lt;br/&gt;
           genes_cn)&lt;/p&gt;
&lt;h1 id="pathway-analysis-using-reactomepa"&gt;Pathway analysis using ReactomePA&lt;/h1&gt;
&lt;p&gt;data(egSymb)&lt;br/&gt;
entrez_genes=sym2eg(genelist)&lt;br/&gt;
res=enrichPathway(gene=entrez_ids, organism="human", pvalueCutoff=0.1, qvalueCutoff=0.1,readable=T)&lt;/p&gt;
&lt;h1 id="plot-results_1"&gt;Plot results&lt;/h1&gt;
&lt;p&gt;dotplot(res)&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Karoliina Salenius</dc:creator><pubDate>Tue, 21 Feb 2023 07:33:16 -0000</pubDate><guid>https://sourceforge.netf1cf25ec62e321cbf111b87f24f9c67fe4ac716f</guid></item></channel></rss>