# deconvR : Simulation and Deconvolution of Omic Profiles

# Introduction

Recent studies associated the differences of cell-type proportions may be correlated to certain phenotypes, such as cancer. Therefore, the demand for the development of computational methods to predict cell type proportions increased. Hereby, we developed `deconvR`, a collection of functions designed for analyzing deconvolution of the bulk sample(s) using an atlas of reference omic signature profiles and a user-selected model. We wanted to give users an option to extend their reference atlas. Users can create new reference atlases using `findSignatures` or extend their atlas by adding more cell types. Additionally, we included `BSMeth2Probe` to make mapping whole-genome bisulfite sequencing data to their probe IDs easier. So users can map WGBS methylation data (as in methylKit or GRanges object format) to probe IDs, and the results of this mapping can be used as the bulk samples in the deconvolution. We also included a comprehensive DNA methylation atlas of 25 different cell types to use in the main function `deconvolute`. `deconvolute` allows the user to specify their desired deconvolution model (non-negative least squares regression, support vector regression, quadratic programming, or robust linear regression), and returns a dataframe which contains predicted cell-type proportions of bulk methylation profiles, as well as partial R-squared values for each sample.

As an another option, users can generate a simulated table of a desired number of samples, with either user-specified or random origin proportions using `simulateCellMix`. `simulateCellMix` returns a second data frame called `proportions`, which contains the actual cell-type proportions of the simulated sample. It can be used for testing the accuracy of the deconvolution by comparing these actual proportions to the proportions predicted by `deconvolute`.

`deconvolute` returns partial R-squares, to check if deconvolution brings advantages on top of the basic bimodal profiles. The reference matrix usually follows a bimodal distribution in the case of methylation, and taking the average of the rows of methylation matrix might give a pretty similar profile to the bulk methylation profile you are trying to deconvolute. If the deconvolution is advantageous, partial R-squared is expect to be high.

# Installation

The deconvR package can be installed from Bioconductor with:

    if (!requireNamespace("BiocManager", quietly = TRUE))
        install.packages("BiocManager")

    BiocManager::install("deconvR")

# Data

## Comprehensive Human Methylome Reference Atlas

The comprehensive human methylome reference atlas created by Moss et al. 1 can be used as the reference atlas parameter for several functions in this package. This atlas was modified to remove duplicate CpG loci before being included in the package as the dataframe. The dataframe is composed of 25 human cell types and roughly 6000 CpG loci, identified by their Illumina Probe ID. For each cell type and CpG locus, a methylation value between 0 and 1 is provided. This value represents the fraction of methylated bases of the CpG locus. The atlas therefore provides a unique methylation pattern for each cell type and can be directly used as `reference` in `deconvolute` and `simulateCellMix`, and `atlas` in `findSignatures`. Below is an example dataframe to illustrate the `atlas` format.

    library(deconvR)

    data("HumanCellTypeMethAtlas")
    head(HumanCellTypeMethAtlas[,1:5])

    ##          IDs Monocytes_EPIC B.cells_EPIC CD4T.cells_EPIC NK.cells_EPIC
    ## 1 cg08169020         0.8866       0.2615          0.0149        0.0777
    ## 2 cg25913761         0.8363       0.2210          0.2816        0.4705
    ## 3 cg26955540         0.7658       0.0222          0.1492        0.4005
    ## 4 cg25170017         0.8861       0.5116          0.1021        0.4363
    ## 5 cg12827637         0.5212       0.3614          0.0227        0.2120
    ## 6 cg19442545         0.2013       0.1137          0.0608        0.0410

## Illumina Infinium MethylationEPIC v1.0 B5 Manifest Probes (hg38)

The GRanges object `IlluminaMethEpicB5ProbeIDs` contains the Illumina probe IDs of 400000 genomic loci (identified using the “seqnames”, “ranges”, and “strand” values). This object is based off of the Infinium MethylationEPIC v1.0 B5 Manifest data. Unnecessary columns were removed and rows were truncated to reduce file size before converting the file to a GRanges object. It can be used directly as `probe_id_locations` in `BSmeth2Probe`.

    data("IlluminaMethEpicB5ProbeIDs")
    head(IlluminaMethEpicB5ProbeIDs)

    ## GRanges object with 6 ranges and 1 metadata column:
    ##       seqnames              ranges strand |          ID
    ##          <Rle>           <IRanges>  <Rle> | <character>
    ##   [1]    chr19     5236005-5236006      + |  cg07881041
    ##   [2]    chr20   63216298-63216299      + |  cg18478105
    ##   [3]     chr1     6781065-6781066      + |  cg23229610
    ##   [4]     chr2 197438742-197438743      - |  cg03513874
    ##   [5]     chrX   24054523-24054524      + |  cg09835024
    ##   [6]    chr14   93114794-93114795      - |  cg05451842
    ##   -------
    ##   seqinfo: 25 sequences from an unspecified genome; no seqlengths

# Example Workflow For Whole Genome Bisulfate Sequencing Data

## Expanding Reference Atlas

As mentioned in the introduction section, users can extend their reference atlas to incorporate new data. Or may combine different reference atlases to construct a more comprehensive one. This can be done using the `findSignatures` function. In this example, since we don’t have any additional reference atlas, we will add simulated data as a new cell type to reference atlas for example purposes. First, ensure that `atlas` (the signature matrix to be extended) and `samples` (the new data to be added to the signature matrix) are compliant with the function requirements. Below illustrates the `samples` format.

    samples <- simulateCellMix(3,reference = HumanCellTypeMethAtlas)$simulated
    head(samples)

    ##          IDs   Sample 1   Sample 2   Sample 3
    ## 1 cg08169020 0.15067235 0.26175560 0.03512054
    ## 2 cg25913761 0.31167133 0.33916779 0.29441233
    ## 3 cg26955540 0.21061421 0.23811489 0.22559617
    ## 4 cg25170017 0.20330249 0.28198576 0.06521822
    ## 5 cg12827637 0.13910495 0.16475273 0.04661052
    ## 6 cg19442545 0.05711873 0.07690465 0.04370010

`sampleMeta` should include all sample names in `samples`, and specify the origins they should be mapped to when added to `atlas`.

    sampleMeta <- data.table("Experiment_accession" = colnames(samples)[-1],
                             "Biosample_term_name" = "new cell type")
    head(sampleMeta)

    ##    Experiment_accession Biosample_term_name
    ##                  <char>              <char>
    ## 1:             Sample 1       new cell type
    ## 2:             Sample 2       new cell type
    ## 3:             Sample 3       new cell type

Use `findSignatures` to extend the matrix.

    extended_matrix <- findSignatures(samples = samples,
                                     sampleMeta = sampleMeta,
                                     atlas = HumanCellTypeMethAtlas,
                                     IDs = "IDs")

    ## CELL TYPES IN EXTENDED ATLAS:
    ## new cell type
    ## Monocytes_EPIC
    ## B.cells_EPIC
    ## CD4T.cells_EPIC
    ## NK.cells_EPIC
    ## CD8T.cells_EPIC
    ## Neutrophils_EPIC
    ## Erythrocyte_progenitors
    ## Adipocytes
    ## Cortical_neurons
    ## Hepatocytes
    ## Lung_cells
    ## Pancreatic_beta_cells
    ## Pancreatic_acinar_cells
    ## Pancreatic_duct_cells
    ## Vascular_endothelial_cells
    ## Colon_epithelial_cells
    ## Left_atrium
    ## Bladder
    ## Breast
    ## Head_and_neck_larynx
    ## Kidney
    ## Prostate
    ## Thyroid
    ## Upper_GI
    ## Uterus_cervix

    head(extended_matrix)

    ##          IDs new_cell_type Monocytes_EPIC B.cells_EPIC CD4T.cells_EPIC
    ## 1 cg08169020    0.14918283         0.8866       0.2615          0.0149
    ## 2 cg25913761    0.31508382         0.8363       0.2210          0.2816
    ## 3 cg26955540    0.22477509         0.7658       0.0222          0.1492
    ## 4 cg25170017    0.18350216         0.8861       0.5116          0.1021
    ## 5 cg12827637    0.11682273         0.5212       0.3614          0.0227
    ## 6 cg19442545    0.05924116         0.2013       0.1137          0.0608
    ##   NK.cells_EPIC CD8T.cells_EPIC Neutrophils_EPIC Erythrocyte_progenitors
    ## 1        0.0777          0.0164           0.8680                  0.9509
    ## 2        0.4705          0.3961           0.8293                  0.2385
    ## 3        0.4005          0.3474           0.7915                  0.1374
    ## 4        0.4363          0.0875           0.7042                  0.9447
    ## 5        0.2120          0.0225           0.5368                  0.4667
    ## 6        0.0410          0.0668           0.1952                  0.1601
    ##   Adipocytes Cortical_neurons Hepatocytes Lung_cells Pancreatic_beta_cells
    ## 1     0.0336           0.0168      0.0340     0.0416              0.038875
    ## 2     0.3578           0.3104      0.2389     0.2250              0.132000
    ## 3     0.1965           0.0978      0.0338     0.0768              0.041725
    ## 4     0.0842           0.2832      0.2259     0.0544              0.111750
    ## 5     0.0287           0.1368      0.0307     0.1607              0.065975
    ## 6     0.0364           0.0222      0.1574     0.0122              0.003825
    ##   Pancreatic_acinar_cells Pancreatic_duct_cells Vascular_endothelial_cells
    ## 1                  0.0209                0.0130                     0.0323
    ## 2                  0.2249                0.1996                     0.3654
    ## 3                  0.0314                0.0139                     0.2382
    ## 4                  0.0309                0.0217                     0.0972
    ## 5                  0.0370                0.0230                     0.0798
    ## 6                  0.0378                0.0347                     0.0470
    ##   Colon_epithelial_cells Left_atrium Bladder Breast Head_and_neck_larynx Kidney
    ## 1                 0.0163      0.0386  0.0462 0.0264               0.0470 0.0269
    ## 2                 0.2037      0.2446  0.2054 0.1922               0.2045 0.1596
    ## 3                 0.0193      0.1134  0.1269 0.1651               0.1523 0.1034
    ## 4                 0.0187      0.0674  0.0769 0.0691               0.0704 0.0604
    ## 5                 0.0193      0.0432  0.0459 0.0228               0.0687 0.0234
    ## 6                 0.0193      0.0287  0.0246 0.0081               0.0098 0.0309
    ##   Prostate Thyroid Upper_GI Uterus_cervix
    ## 1   0.0353  0.0553   0.0701        0.0344
    ## 2   0.1557  0.1848   0.1680        0.2026
    ## 3   0.0686  0.0943   0.1298        0.1075
    ## 4   0.0369  0.0412   0.0924        0.0697
    ## 5   0.0508  0.0726   0.0759        0.0196
    ## 6   0.0055  0.0188   0.0090        0.0166

WGBS methylation data first needs to be mapped to probes using `BSmeth2Probe` before being deconvoluted. The methylation data `WGBS_data` in `BSmeth2Probe` may be either a GRanges object or a methylKit object.

Format of `WGBS_data` as GRanges object:

    load(system.file("extdata", "WGBS_GRanges.rda",
                                         package = "deconvR"))
    head(WGBS_GRanges)

    ## GRanges object with 6 ranges and 1 metadata column:
    ##       seqnames    ranges strand |   sample1
    ##          <Rle> <IRanges>  <Rle> | <numeric>
    ##   [1]     chr1     47176      + |  0.833333
    ##   [2]     chr1     47177      - |  0.818182
    ##   [3]     chr1     47205      + |  0.681818
    ##   [4]     chr1     47206      - |  0.583333
    ##   [5]     chr1     47362      + |  0.416667
    ##   [6]     chr1     49271      + |  0.733333
    ##   -------
    ##   seqinfo: 1 sequence from an unspecified genome; no seqlengths

or as methylKit object:

    head(methylKit::methRead(system.file("extdata", "test1.myCpG.txt",
                                         package = "methylKit"),
                             sample.id="test", assembly="hg18",
                             treatment=1, context="CpG", mincov = 0))

    ##     chr   start     end strand coverage numCs numTs
    ## 1 chr21 9764513 9764513      -       12     0    12
    ## 2 chr21 9764539 9764539      -       12     3     9
    ## 3 chr21 9820622 9820622      +       13     0    13
    ## 4 chr21 9837545 9837545      +       11     0    11
    ## 5 chr21 9849022 9849022      +      124    90    34
    ## 6 chr21 9853296 9853296      +       17    10     7

`probe_id_locations` contains information needed to map cellular loci to probe IDs

    data("IlluminaMethEpicB5ProbeIDs")
    head(IlluminaMethEpicB5ProbeIDs)

    ## GRanges object with 6 ranges and 1 metadata column:
    ##       seqnames              ranges strand |          ID
    ##          <Rle>           <IRanges>  <Rle> | <character>
    ##   [1]    chr19     5236005-5236006      + |  cg07881041
    ##   [2]    chr20   63216298-63216299      + |  cg18478105
    ##   [3]     chr1     6781065-6781066      + |  cg23229610
    ##   [4]     chr2 197438742-197438743      - |  cg03513874
    ##   [5]     chrX   24054523-24054524      + |  cg09835024
    ##   [6]    chr14   93114794-93114795      - |  cg05451842
    ##   -------
    ##   seqinfo: 25 sequences from an unspecified genome; no seqlengths

Use `BSmeth2Probe` to map WGBS data to probe IDs.

    mapped_WGBS_data <- BSmeth2Probe(probe_id_locations = IlluminaMethEpicB5ProbeIDs,
                                     WGBS_data = WGBS_GRanges,
                                     multipleMapping = TRUE,
                                     cutoff = 10)
    head(mapped_WGBS_data)

    ##          IDs   sample1
    ## 1 cg00305774 1.0000000
    ## 2 cg00546078 0.8181818
    ## 3 cg00546307 0.5454545
    ## 4 cg00546971 0.5000000
    ## 5 cg00774867 0.8461538
    ## 6 cg00830435 0.9166667

This mapped data can now be used in `deconvolute`. Here we will deconvolute it using the previously extended signature matrix as the reference atlas.

    deconvolution <- deconvolute(reference = HumanCellTypeMethAtlas,
                                 bulk = mapped_WGBS_data)

    ##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
    ##  0.9963  0.9963  0.9963  0.9963  0.9963  0.9963

    deconvolution$proportions

    ##         Monocytes_EPIC B.cells_EPIC CD4T.cells_EPIC NK.cells_EPIC
    ## sample1              0            0               0             0
    ##         CD8T.cells_EPIC Neutrophils_EPIC Erythrocyte_progenitors Adipocytes
    ## sample1               0                0                       0  0.5011789
    ##         Cortical_neurons Hepatocytes Lung_cells Pancreatic_beta_cells
    ## sample1        0.2917357           0          0                     0
    ##         Pancreatic_acinar_cells Pancreatic_duct_cells
    ## sample1                       0                     0
    ##         Vascular_endothelial_cells Colon_epithelial_cells Left_atrium Bladder
    ## sample1                          0            0.001012524           0       0
    ##         Breast Head_and_neck_larynx Kidney Prostate Thyroid Upper_GI
    ## sample1      0            0.2060729      0        0       0        0
    ##         Uterus_cervix
    ## sample1             0

## Constructing tissue specific CpG signature matrix

Alternatively, users can set tissueSpecCpGs as TRUE to construct tissue based methylation signature matrix by using the reference atlas. Here, we used simulated samples to construct tissue specific signature matrix since we don’t have tissue specific samples.

    data("HumanCellTypeMethAtlas")
    exampleSamples <- simulateCellMix(1,reference = HumanCellTypeMethAtlas)$simulated
    exampleMeta <- data.table("Experiment_accession" = "example_sample",
                              "Biosample_term_name" = "example_cell_type")
    colnames(exampleSamples) <- c("CpGs", "example_sample")
    colnames(HumanCellTypeMethAtlas)[1] <- c("CpGs")

    signatures <- findSignatures(
      samples = exampleSamples,
      sampleMeta = exampleMeta,
      atlas = HumanCellTypeMethAtlas,
      IDs = "CpGs", K = 100, tissueSpecCpGs = TRUE)

    ## CELL TYPES IN EXTENDED ATLAS:
    ## example_cell_type
    ## Monocytes_EPIC
    ## B.cells_EPIC
    ## CD4T.cells_EPIC
    ## NK.cells_EPIC
    ## CD8T.cells_EPIC
    ## Neutrophils_EPIC
    ## Erythrocyte_progenitors
    ## Adipocytes
    ## Cortical_neurons
    ## Hepatocytes
    ## Lung_cells
    ## Pancreatic_beta_cells
    ## Pancreatic_acinar_cells
    ## Pancreatic_duct_cells
    ## Vascular_endothelial_cells
    ## Colon_epithelial_cells
    ## Left_atrium
    ## Bladder
    ## Breast
    ## Head_and_neck_larynx
    ## Kidney
    ## Prostate
    ## Thyroid
    ## Upper_GI
    ## Uterus_cervix

    print(head(signatures[[2]]))

    ## $hyper
    ## cg08169020 cg25170017 cg26955540 cg12827637 cg15838173 cg04858631 cg19442545
    ## 0.23726018 0.16771546 0.16693729 0.16276793 0.14777070 0.14616434 0.14472577
    ## cg10560079 cg00982136 cg26460530 cg22017733 cg13677741 cg24082121 cg09642825
    ## 0.13945518 0.13540699 0.12875148 0.12842235 0.12556190 0.12438144 0.12346356
    ## cg01424562 cg15376996 cg14789659 cg11895835 cg06340704 cg14785464 cg19300307
    ## 0.12306881 0.11971758 0.11679322 0.11529742 0.11522626 0.11521698 0.11513777
    ## cg12474798 cg18856478 cg27189395 cg26033520 cg05507654 cg05056497 cg24275356
    ## 0.11495983 0.11445022 0.11438201 0.11398844 0.11397381 0.11281061 0.11223496
    ## cg20684110 cg23220823 cg00936790 cg06167719 cg08474651 cg05258935 cg25913761
    ## 0.11167776 0.11167704 0.11164571 0.11159945 0.11155732 0.11152542 0.11148144
    ## cg08857351 cg27395200 cg10509607 cg22879098 cg14855367 cg02962602 cg22897141
    ## 0.11146767 0.11080196 0.11071662 0.10968414 0.10931287 0.10891963 0.10889072
    ## cg03254916 cg08063160 cg04913246 cg23247274 cg08425810 cg26953232 cg08832851
    ## 0.10879461 0.10878803 0.10831949 0.10812424 0.10810115 0.10804325 0.10789315
    ## cg16416715 cg03711944 cg10361922 cg26047334 cg27388962 cg09267773 cg26757820
    ## 0.10779491 0.10770744 0.10762784 0.10756728 0.10730924 0.10727416 0.10720178
    ## cg25158622 cg14057303 cg08257293 cg16278496 cg11975790 cg08367326 cg14845962
    ## 0.10676216 0.10666509 0.10658289 0.10541697 0.10541495 0.10514232 0.10506108
    ## cg15014975 cg16127573 cg27312961 cg05043794 cg04055490 cg22138735 cg19331221
    ## 0.10473853 0.10463755 0.10408166 0.10376586 0.10346457 0.10316240 0.10312884
    ## cg08846870 cg18675610 cg09577804 cg07865091 cg02297709 cg03063309 cg17847861
    ## 0.10298181 0.10293588 0.10274822 0.10240663 0.10223104 0.10220845 0.10213624
    ## cg16402452 cg11532431 cg24591770 cg06398251 cg04462378 cg13638257 cg00769843
    ## 0.10210214 0.10183042 0.10152445 0.10135418 0.10125181 0.10115287 0.10114625
    ## cg10661769 cg07218880 cg21181453 cg11025609 cg01377358 cg16988611 cg06889535
    ## 0.10110971 0.10104398 0.10087474 0.10084871 0.10077148 0.10069437 0.10064442
    ## cg07438103 cg01726273 cg15185986 cg15575375 cg16306706 cg16829306 cg19692929
    ## 0.10058883 0.10021748 0.10010734 0.10002782 0.10000705 0.09992267 0.09981465
    ## cg08659179 cg20074395
    ## 0.09975714 0.09954286
    ##
    ## $hypo
    ## cg03663120 cg20942286 cg03963853 cg03126713 cg00828556 cg24788483 cg13931640
    ##  0.3740618  0.2971539  0.2740020  0.2719975  0.2694925  0.2687499  0.2647101
    ## cg11186858 cg05612654 cg22528270 cg15871206 cg13500029 cg15310871 cg10480329
    ##  0.2641055  0.2632087  0.2622377  0.2620870  0.2582271  0.2555930  0.2490037
    ## cg11231069 cg12655112 cg03549146 cg05923857 cg12458039 cg07737292 cg20610950
    ##  0.2457515  0.2402995  0.2391606  0.2368775  0.2361670  0.2334635  0.2334358
    ## cg10456459 cg03313271 cg06988336 cg16636767 cg06517984 cg23952578 cg27334271
    ##  0.2293419  0.2236060  0.2206739  0.2152269  0.2139125  0.2123850  0.2120309
    ## cg06297318 cg11327657 cg14976569 cg11597902 cg04851465 cg15633603 cg22259797
    ##  0.2116268  0.2112034  0.2106662  0.2093263  0.2090463  0.2081098  0.2073438
    ## cg18990407 cg08425796 cg13403369 cg06373940 cg04354689 cg09322573 cg20107506
    ##  0.2068640  0.2061489  0.2053711  0.2041543  0.2032782  0.2022914  0.2022402
    ## cg10718056 cg07033722 cg06125903 cg22185977 cg26538782 cg01879591 cg25517015
    ##  0.2012648  0.2007485  0.2006657  0.1999221  0.1996057  0.1992270  0.1990409
    ## cg27366072 cg12866960 cg03310874 cg02796279 cg13093111 cg08538581 cg06978145
    ##  0.1982973  0.1982690  0.1973440  0.1960519  0.1949267  0.1944736  0.1941218
    ## cg19502671 cg23403750 cg26783127 cg20429104 cg06721411 cg10967114 cg11153071
    ##  0.1940322  0.1927382  0.1926434  0.1921438  0.1920554  0.1915217  0.1914976
    ## cg26923863 cg26305504 cg20966357 cg19380303 cg01024962 cg06585734 cg07918933
    ##  0.1914175  0.1913554  0.1909307  0.1908284  0.1900096  0.1899645  0.1899223
    ## cg12555086 cg11802666 cg04664897 cg05445326 cg23755933 cg04217515 cg27340480
    ##  0.1898235  0.1898137  0.1897214  0.1896837  0.1894863  0.1890402  0.1888952
    ## cg25596405 cg04836151 cg24250902 cg18835472 cg23334433 cg26298914 cg02244028
    ##  0.1887861  0.1887831  0.1885044  0.1881863  0.1879031  0.1875873  0.1875447
    ## cg00009088 cg13980609 cg17086773 cg26889953 cg08428868 cg08400494 cg15288326
    ##  0.1873094  0.1860703  0.1858984  0.1858179  0.1857829  0.1857775  0.1857530
    ## cg04586126 cg17117981 cg14189391 cg22875823 cg22662844 cg07417146 cg22666015
    ##  0.1853201  0.1852408  0.1845334  0.1843249  0.1842332  0.1835142  0.1832964
    ## cg00235484 cg01622606
    ##  0.1829021  0.1815308

## Constructing tissue specific DMPs

Alternatively, users can set tissueSpecDMPs as TRUE to obtain tissue based DMPs by using the reference atlas. Here, we used simulated samples since we don’t have tissue specific samples. Note that both tissueSpecCpGs and tissueSpecDMPs can’t be TRUE at the same time.

    data("HumanCellTypeMethAtlas")
    exampleSamples <- simulateCellMix(1,reference = HumanCellTypeMethAtlas)$simulated
    exampleMeta <- data.table("Experiment_accession" = "example_sample",
                              "Biosample_term_name" = "example_cell_type")
    colnames(exampleSamples) <- c("CpGs", "example_sample")
    colnames(HumanCellTypeMethAtlas)[1] <- c("CpGs")

    signatures <- findSignatures(
      samples = exampleSamples,
      sampleMeta = exampleMeta,
      atlas = HumanCellTypeMethAtlas,
      IDs = "CpGs", tissueSpecDMPs = TRUE)

    ## CELL TYPES IN EXTENDED ATLAS:
    ## example_cell_type
    ## Monocytes_EPIC
    ## B.cells_EPIC
    ## CD4T.cells_EPIC
    ## NK.cells_EPIC
    ## CD8T.cells_EPIC
    ## Neutrophils_EPIC
    ## Erythrocyte_progenitors
    ## Adipocytes
    ## Cortical_neurons
    ## Hepatocytes
    ## Lung_cells
    ## Pancreatic_beta_cells
    ## Pancreatic_acinar_cells
    ## Pancreatic_duct_cells
    ## Vascular_endothelial_cells
    ## Colon_epithelial_cells
    ## Left_atrium
    ## Bladder
    ## Breast
    ## Head_and_neck_larynx
    ## Kidney
    ## Prostate
    ## Thyroid
    ## Upper_GI
    ## Uterus_cervix

    print(head(signatures[[2]]))

    ##            intercept        f         pval         qval
    ## cg10480329 -3.287511 180.6178 1.157238e-12 6.975832e-09
    ## cg06297318 -3.496336 165.6006 2.902469e-12 8.748043e-09
    ## cg18835472 -3.350244 142.7577 1.367073e-11 2.746905e-08
    ## cg27366072 -2.858145 131.5341 3.171985e-11 3.866506e-08
    ## cg05923857 -3.515739 131.3924 3.207122e-11 3.866506e-08
    ## cg08428868 -4.139304 126.7632 4.622141e-11 4.643711e-08

# Example Workflow For RNA Sequencing Data

It is possible to use RNA-seq data for deconvolution via deconvR package. Beware that you have to set `IDs` column that contains `Gene names` to run deconvR functions. Therefore you can simulate bulk RNA-seq data via `simulateCellMix` and, extend RNA-seq reference atlas via `findSignatures`.

# sessionInfo

    sessionInfo()

    ## R version 4.6.0 (2026-04-24)
    ## Platform: x86_64-pc-linux-gnu
    ## Running under: Ubuntu 24.04.4 LTS
    ##
    ## Matrix products: default
    ## BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
    ## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0
    ##
    ## locale:
    ##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
    ##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
    ##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
    ##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
    ##  [9] LC_ADDRESS=C               LC_TELEPHONE=C
    ## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
    ##
    ## time zone: Etc/UTC
    ## tzcode source: system (glibc)
    ##
    ## attached base packages:
    ## [1] parallel  stats     graphics  grDevices utils     datasets  methods
    ## [8] base
    ##
    ## other attached packages:
    ## [1] dplyr_1.2.1         doParallel_1.0.17   iterators_1.0.14
    ## [4] foreach_1.5.2       deconvR_1.18.0      data.table_1.18.2.1
    ## [7] knitr_1.51          BiocStyle_2.40.0
    ##
    ## loaded via a namespace (and not attached):
    ##   [1] splines_4.6.0               BiocIO_1.22.0
    ##   [3] bitops_1.0-9                tibble_3.3.1
    ##   [5] R.oo_1.27.1                 preprocessCore_1.74.0
    ##   [7] XML_3.99-0.23               lifecycle_1.0.5
    ##   [9] Rdpack_2.6.6                lattice_0.22-9
    ##  [11] MASS_7.3-65                 base64_2.0.2
    ##  [13] scrime_1.3.7                magrittr_2.0.5
    ##  [15] minfi_1.58.0                limma_3.68.0
    ##  [17] sass_0.4.10                 rmarkdown_2.31
    ##  [19] jquerylib_0.1.4             yaml_2.3.12
    ##  [21] otel_0.2.0                  robslopes_1.1.4
    ##  [23] doRNG_1.8.6.3               askpass_1.2.1
    ##  [25] minqa_1.2.8                 DBI_1.3.0
    ##  [27] buildtools_1.0.0            RColorBrewer_1.1-3
    ##  [29] abind_1.4-8                 quadprog_1.5-8
    ##  [31] GenomicRanges_1.64.0        purrr_1.2.2
    ##  [33] R.utils_2.13.0              BiocGenerics_0.58.0
    ##  [35] RCurl_1.98-1.18             IRanges_2.46.0
    ##  [37] S4Vectors_0.50.0            maketools_1.3.2
    ##  [39] rentrez_1.2.4               genefilter_1.94.0
    ##  [41] annotate_1.90.0             DelayedMatrixStats_1.34.0
    ##  [43] codetools_0.2-20            DelayedArray_0.38.0
    ##  [45] xml2_1.5.2                  tidyselect_1.2.1
    ##  [47] farver_2.1.2                lme4_2.0-1
    ##  [49] beanplot_1.3.1              matrixStats_1.5.0
    ##  [51] stats4_4.6.0                illuminaio_0.54.0
    ##  [53] Seqinfo_1.2.0               GenomicAlignments_1.48.0
    ##  [55] jsonlite_2.0.0              multtest_2.68.0
    ##  [57] e1071_1.7-17                survival_3.8-6
    ##  [59] bbmle_1.0.25.1              tools_4.6.0
    ##  [61] rsq_2.7                     Rcpp_1.1.1-1.1
    ##  [63] glue_1.8.1                  SparseArray_1.12.0
    ##  [65] xfun_0.57                   qvalue_2.44.0
    ##  [67] MatrixGenerics_1.24.0       HDF5Array_1.40.0
    ##  [69] numDeriv_2016.8-1.1         BiocManager_1.30.27
    ##  [71] fastmap_1.2.0               boot_1.3-32
    ##  [73] rhdf5filters_1.22.0         openssl_2.4.0
    ##  [75] digest_0.6.39               R6_2.6.1
    ##  [77] gtools_3.9.5                RSQLite_2.4.6
    ##  [79] cigarillo_1.2.0             R.methodsS3_1.8.2
    ##  [81] h5mread_1.4.0               tidyr_1.3.2
    ##  [83] generics_0.1.4              rtracklayer_1.72.0
    ##  [85] class_7.3-23                httr_1.4.8
    ##  [87] S4Arrays_1.12.0             pkgconfig_2.0.3
    ##  [89] gtable_0.3.6                blob_1.3.0
    ##  [91] S7_0.2.2                    siggenes_1.86.0
    ##  [93] XVector_0.52.0              sys_3.4.3
    ##  [95] htmltools_0.5.9             scales_1.4.0
    ##  [97] Biobase_2.72.0              png_0.1-9
    ##  [99] reformulas_0.4.4            deming_1.4-1
    ## [101] tzdb_0.5.0                  reshape2_1.4.5
    ## [103] rjson_0.2.23                nloptr_2.2.1
    ## [105] coda_0.19-4.1               nlme_3.1-169
    ## [107] curl_7.1.0                  bdsmatrix_1.3-7
    ## [109] bumphunter_1.54.0           proxy_0.4-29
    ## [111] cachem_1.1.0                rhdf5_2.56.0
    ## [113] stringr_1.6.0               AnnotationDbi_1.74.0
    ## [115] restfulr_0.0.16             GEOquery_2.80.0
    ## [117] pillar_1.11.1               grid_4.6.0
    ## [119] reshape_0.8.10              vctrs_0.7.3
    ## [121] Deriv_4.2.0                 xtable_1.8-8
    ## [123] evaluate_1.0.5              readr_2.2.0
    ## [125] GenomicFeatures_1.64.0      mvtnorm_1.3-7
    ## [127] cli_3.6.6                   locfit_1.5-9.12
    ## [129] compiler_4.6.0              Rsamtools_2.28.0
    ## [131] rlang_1.2.0                 crayon_1.5.3
    ## [133] rngtools_1.5.2              nor1mix_1.3-3
    ## [135] mclust_6.1.2                emdbook_1.3.14
    ## [137] plyr_1.8.9                  stringi_1.8.7
    ## [139] mcr_1.3.3.1                 BiocParallel_1.46.0
    ## [141] nnls_1.6                    assertthat_0.2.1
    ## [143] Biostrings_2.80.0           Matrix_1.7-5
    ## [145] hms_1.1.4                   sparseMatrixStats_1.24.0
    ## [147] bit64_4.8.0                 ggplot2_4.0.3
    ## [149] Rhdf5lib_2.0.0              KEGGREST_1.52.0
    ## [151] methylKit_1.38.0            statmod_1.5.1
    ## [153] SummarizedExperiment_1.42.0 fastseg_1.56.0
    ## [155] rbibutils_2.4.1             memoise_2.0.1
    ## [157] bslib_0.10.0                bit_4.6.0

    stopCluster(cl)

1. Moss, J. et al. (2018). Comprehensive human cell-type methylation atlas reveals origins of circulating cell-free DNA in health and disease. Nature communications, 9(1), 1-12. https://doi.org/10.1038/s41467-018-07466-6↩︎