(original) (raw)
## ----<knitr, echo="FALSE," message="FALSE," results="hide" ,="" class.output="scroll-300" ----="" library("knitr")="" opts_chunk$set(="" tidy="TRUE," cache="FALSE," fig.align="center" dpi="200," fig.height="8," )="" options(bitmaptype="cairo" ##="" ----loadlibaries2,="" warning="FALSE," library(readr)="" library(granie)="" ----importdata,="" include="TRUE," -----------="" #="" we="" load="" the="" example="" data="" directly="" from="" web:="" file_peaks="https://www.embl.de/download/zaugg/GRaNIE/countsATAC.filtered.tsv.gz" file_rna="https://www.embl.de/download/zaugg/GRaNIE/countsRNA.filtered.tsv.gz" file_samplemetadata="https://www.embl.de/download/zaugg/GRaNIE/sampleMetadata.tsv.gz" countsrna.df="read_tsv(file_RNA," col_types="cols())" countspeaks.df="read_tsv(file_peaks," samplemetadata.df="read_tsv(file_sampleMetadata," let's="" check="" how="" looks="" like="" save="" name="" of="" respective="" id="" columns="" idcolumn_peaks="peakID" idcolumn_rna="ENSEMBL" ----initializeobject,="" -----="" genomeassembly="hg38" #either="" hg19,="" hg38="" or="" mm10.="" both="" enhancers="" and="" rna="" must="" have="" same="" genome="" assembly="" optional="" arbitrary="" list="" with="" information="" metadata="" that="" is="" stored="" within="" granie="" object="" objectmetadata.l="list(name" =="" paste0("macrophages_infected_primed"),="" dir_output="." grn="initializeGRN(objectMetadata" objectmetadata.l,="" outputfolder="dir_output," ----adddata,="" eval="FALSE," counts_peaks="countsPeaks.df," normalization_peaks="DESeq2_sizeFactors" counts_rna="countsRNA.df," normalization_rna="limma_quantile" samplemetadata="sampleMetadata.df," forcererun="TRUE)" ----loadobject,="" ----runpca,="" collapse="FALSE," topn="500," type="normalized" plotaspdf="FALSE," pages="c(2,3,14)," ----addtfbs,="" folder_tfbs_6tfs="https://www.embl.de/download/zaugg/GRaNIE/TFBS\_selected.zip" download="" zip="" all="" tfbs="" files.="" takes="" too="" long="" here,="" not="" executed="" therefore="" download.file(folder_tfbs_6tfs,="" file.path("tfbs_selected.zip"),="" quiet="FALSE)" unzip(file.path("tfbs_selected.zip"),="" overwrite="TRUE)" motiffolder="tools::file_path_as_absolute("TFBS_selected")" tfs="all" filestfbspattern="_TFBS" fileending=".bed.gz" ncores="1," ----filterdata,="" chromosomes="" to="" keep="" for="" peaks.="" this="" should="" be="" a="" vector="" chromosome="" names="" chrtokeep_peaks="c(paste0("chr"," 1:22),="" "chrx")="" minnormalizedmean_peaks="5," minnormalizedmeanrna="1," maxsize_peaks="10000," ----addtfpeakconnections,="" plotdiagnosticplots="FALSE," connectiontypes="c("expression")," cormethod="pearson" ----echo="TRUE," fig.cap="_TF-enhancer diagnostic plots connection overview.A_" datatype="c("real")," ----runarclassification,="" significancethreshold_wilcoxon="0.05," plot_minnotfbs_heatmap="100," ----saveobject2,="" grn_file_outputrds="paste0(dir_output," "="" grn.rds")="" saverds(grn,="" grn_file_outputrds)="" ----addpeakgeneconnections,="" promoterrange="10000," tads="NULL," plotgenetypes="list(c("all"))," gene.types="list(c("protein_coding"," "lincrna")),="" ----combineandfilter,="" tf_peak.fdr.threshold="0.2," peak_gene.fdr.threshold="0.2," peak_gene.fdr.method="BH" "lincrna"),="" allowmissingtfs="FALSE," allowmissinggenes="FALSE," ----include="TRUE," ---------------------="" ----saveobject,="" grn_connections.all="getGRNConnections(GRN," include_tf_gene_correlations="TRUE," include_genemetadata="TRUE)" ----connectionsummary,="" out.width="50%" tf_peak.fdr="c(0.05," 0.1,="" 0.2),="" tf_peak.connectiontypes="all" peak_gene.fdr="c(0.1," peak_gene.r_range="c(0,1)," true),="" ----buildgraph,="" ----visualizegrn,="" maxedgestoplot="1000)" ----filterandvisualizegrn,="" plotall="FALSE," tf.id="=" "e2f7.0.b"="" |="" stringr::str_starts(tf.id,="" "etv"))="" ----allnetworkanalyses,="" ontology="c("GO_BP")," ----plotgraphstats,="" fig.width="12," ----generalenrichment,="" ----plotgeneralenrichment,="" ----communityenrichment,="" ---------------="" ----plotcommunitystats,="" ----plotcommunityenrichment,="" ----plotcommunityenrichment2,="">Summary of the community enrichment", class.output="scroll-300"---- GRN = plotCommunitiesEnrichment(GRN, plotAsPDF = FALSE, pages = c(5)) ## ----TFEnrichmentCal, echo=FALSE, eval = FALSE, class.output="scroll-300"----- # GRN = calculateTFEnrichment(GRN, ontology = "GO_BP") ## ----TFEnrichment, echo=TRUE, fig.cap="Enrichment summary for EGR1.0.A", fig.height=7, fig.width = 12, class.output="scroll-300"---- GRN = plotTFEnrichment(GRN, plotAsPDF = FALSE, n = 3, pages = c(1)) ## ----TFEnrichment2, echo=TRUE, fig.cap="Enrichment summary for selected TFs and the whole eGRN network", fig.height=7, fig.width = 15, class.output="scroll-300"---- GRN = plotTFEnrichment(GRN, plotAsPDF = FALSE, n = 3, pages = c(5)) ## ----saveObject3, echo=TRUE, include=TRUE, eval=FALSE, class.output="scroll-300"---- # GRN = deleteIntermediateData(GRN) # saveRDS(GRN, GRN_file_outputRDS) ## ----class.output="scroll-300"------------------------------------------------ sessionInfo() </knitr,>