# 4. Visualization using xQTLbiolinks

#### 2023-05-01

Some visual examples are provided in this vignette, including example data, code, and figures.

Visualilzation of eQTL, sQTL, gene expression across tissues.

    xQTLvisual_eqtl("KIF15")

     genes <- c("FNDC8", "S100Z", "AQP6", "AMOT", "C3orf38", "FOXL1", "COX11", "FCN3", "DDX58", "CFI", "MS4A18", "NUDT13", "HOXA4", "VSX1")
     xQTLvisual_genesExp(genes, tissueSiteDetail="Lung")

    geneExpTissues <- xQTLvisual_geneExpTissues("TP53", tissues=c("Lung", "Brain","Ovary"))

    geneExpTissues <- xQTLvisual_geneExpTissues("TP53")

    expEqtl <- xQTLvisual_eqtlExp(variantName="rs78378222", gene ="TP53",
                                  tissueSiteDetail="Lung")
    expEqtl

    expSqtl <- xQTLvisual_sqtlExp(variantName="chr11_66561248_T_C_b38",variantType="variantId",
                                  phenotypeId ="chr11:66348070:66353455:clu_8500:ENSG00000255468.6",
                                  tissueSiteDetail="Skin - Sun Exposed (Lower leg)")
    expSqtl

> LocusZoom plot for GWAS dataset:

    library(data.table)
    gwasDF <- fread("https://gitee.com/stronghoney/exampleData/raw/master/gwasChr6Sub4.txt")
    p_all <- xQTLvisual_locusZoom(gwasDF)
    p_sub <- xQTLvisual_locusZoom(gwasDF, posRange="chr6:4.7e7-4.8e7", population ="EUR")
    cowplot::plot_grid(p_all, p_sub, align = "h", ncol = 2)

> LocusZoom plot for eQTL signals of a gene of interest:

    eqtlAsso <- xQTLdownload_eqtlAllAsso("RP11-385F7.1",
                                         tissueLabel = "Brain - Cortex")
    p_all <- xQTLvisual_locusZoom(eqtlAsso[,c("snpId", "chrom", "pos", "pValue")], highlightSnp="rs4711878" )
    p_sub <- xQTLvisual_locusZoom(eqtlAsso[,c("snpId", "chrom", "pos", "pValue")], highlightSnp="rs4711878",
                                  posRange="chr6:47.3e6-47.9e6")
    cowplot::plot_grid(p_all, p_sub, align = "h", ncol = 2)

    eqtlAssos <- xQTLdownload_eqtlAllAssoPos(chrom = "chr6", pos_lower=47.4e6, pos_upper = 47.7e6,
                                             tissueLabel = "Brain - Cortex", p_upper=0.1)
    p1 <- xQTLvisual_locusZoom(eqtlAssos[,c("snpId", "chrom", "pos", "pValue")], highlightSnp = "rs34744382")
    eqtlAssos_gene <- xQTLdownload_eqtlAllAssoPos(chrom = "chr6", pos_lower=47.4e6, pos_upper = 47.7e6,
                                                  gene="RP11-385F7.1",tissueLabel = "Brain - Cortex", p_upper=0.1)
    p2 <- xQTLvisual_locusZoom(eqtlAssos_gene[,c("snpId", "chrom", "pos", "pValue")], highlightSnp = "rs34744382")
    cowplot::plot_grid(p1, p2, align = "h", ncol = 2)

    library(data.table)
    eqtlDF <-fread("https://gitee.com/stronghoney/exampleData/raw/master/eqtl/eqtlAsso1.txt")
    gwasDF <-fread("https://gitee.com/stronghoney/exampleData/raw/master/gwas/AD/gwasChr6Sub3.txt")
    xQTLvisual_locusCompare( eqtlDF, gwasDF, legend_position="topleft")

    gwasEqtldata <- data.table::fread("http://bioinfo.szbl.ac.cn/xQTL_biolinks/xqtl_data/gwas/AD/gwasEqtldata.txt")
    xQTLvisual_locusCombine(gwasEqtldata, highlightSnp="rs13120565")

    xQTLvisual_coloc( gene="MMP7", variantName="rs11568818", study="TwinsUK")