neurogenomics / MAGMA_Celltyping

Find causal cell-types underlying complex trait genetics
https://neurogenomics.github.io/MAGMA_Celltyping
70 stars 31 forks source link

magma_tileplot does not overlap the dendrogram with the heatmap #126

Closed AMCalejandro closed 1 year ago

AMCalejandro commented 1 year ago

1. Bug description

So, I was expecting to find the dendrogram toegether with the heatmap. Instead, I get the dendrogram and instogram as separate elements of an object. Was this the expected behaviour? If so, it might be useful to add in the vignette some code example to overlap

Console output


Warning: Using size for a discrete variable is not advised.
Warning: Removed 71 rows containing missing values (geom_point).
Warning: Using size for a discrete variable is not advised.
Warning: Removed 71 rows containing missing values (geom_point).
TableGrob (1 x 2) "arrange": 2 grobs

> str(see)
List of 2
 $ heatmap:List of 9
  ..$ data       :'data.frame': 72 obs. of  17 variables:
  .. ..$ Celltype      : Factor w/ 24 levels "Hypothalamic_Dopaminergic_Neurons",..: 11 4 23 19 21 22 15 1 2 3 ...
  .. ..$ OBS_GENES     : chr [1:72] "1166" "1132" "980" "1059" ...
  .. ..$ BETA          : num [1:72] -0.00764 0.00903 0.01247 -0.00519 -0.00681 ...
  .. ..$ BETA_STD      : num [1:72] -0.00187 0.00218 0.00281 -0.00121 -0.00169 ...
  .. ..$ SE            : num [1:72] 0.0273 0.0284 0.0294 0.029 0.0272 ...
  .. ..$ P             : num [1:72] 0.61 0.375 0.336 0.571 0.599 ...
  .. ..$ level         : int [1:72] 1 1 1 1 1 1 1 1 1 1 ...
  .. ..$ Method        : chr [1:72] "MAGMA" "MAGMA" "MAGMA" "MAGMA" ...
  .. ..$ GCOV_FILE     : chr [1:72] "als_ldscQCed.tsv.35UP.10DOWN.level1.Karolinska_Top10.gsa.out" "als_ldscQCed.tsv.35UP.10DOWN.level1.Karolinska_Top10.gsa.out" "als_ldscQCed.tsv.35UP.10DOWN.level1.Karolinska_Top10.gsa.out" "als_ldscQCed.tsv.35UP.10DOWN.level1.Karolinska_Top10.gsa.out" ...
  .. ..$ CONTROL       : chr [1:72] "BASELINE" "BASELINE" "BASELINE" "BASELINE" ...
  .. ..$ CONTROL_label : chr [1:72] "BASELINE" "BASELINE" "BASELINE" "BASELINE" ...
  .. ..$ log10p        : num [1:72] -0.214 -0.425 -0.474 -0.243 -0.223 ...
  .. ..$ genesOutCOND  : chr [1:72] "NA" "NA" "NA" "NA" ...
  .. ..$ EnrichmentMode: chr [1:72] "Top 10%" "Top 10%" "Top 10%" "Top 10%" ...
  .. ..$ LABEL         : chr [1:72] "als_ldscQCed" "als_ldscQCed" "als_ldscQCed" "als_ldscQCed" ...
  .. ..$ q             : num [1:72] 1 1 1 1 1 1 1 1 1 1 ...
  .. ..$ dotsize       : Factor w/ 5 levels "4","3","2","1",..: 5 5 5 5 5 5 5 5 5 5 ...
  ..$ layers     :List of 2
  .. ..$ :Classes 'LayerInstance', 'Layer', 'ggproto', 'gg' <ggproto object: Class LayerInstance, Layer, gg>
    aes_params: list
    compute_aesthetics: function
    compute_geom_1: function
    compute_geom_2: function
    compute_position: function
    compute_statistic: function
    computed_geom_params: list
    computed_mapping: uneval
    computed_stat_params: list
    data: waiver
    draw_geom: function
    finish_statistics: function
    geom: <ggproto object: Class GeomTile, GeomRect, Geom, gg>
        aesthetics: function
        default_aes: uneval
        draw_group: function
        draw_key: function
        draw_layer: function
        draw_panel: function
        extra_params: na.rm
        handle_na: function
        non_missing_aes: 
        optional_aes: 
        parameters: function
        required_aes: x y
        setup_data: function
        setup_params: function
        use_defaults: function
        super:  <ggproto object: Class GeomRect, Geom, gg>
    geom_params: list
    inherit.aes: TRUE
    layer_data: function
    map_statistic: function
    mapping: uneval
    position: <ggproto object: Class PositionIdentity, Position, gg>
        compute_layer: function
        compute_panel: function
        required_aes: 
        setup_data: function
        setup_params: function
        super:  <ggproto object: Class Position, gg>
    print: function
    setup_layer: function
    show.legend: NA
    stat: <ggproto object: Class StatIdentity, Stat, gg>
        aesthetics: function
        compute_group: function
        compute_layer: function
        compute_panel: function
        default_aes: uneval
        extra_params: na.rm
        finish_layer: function
        non_missing_aes: 
        optional_aes: 
        parameters: function
        required_aes: 
        retransform: TRUE
        setup_data: function
        setup_params: function
        super:  <ggproto object: Class Stat, gg>
    stat_params: list
    super:  <ggproto object: Class Layer, gg> 
  .. ..$ :Classes 'LayerInstance', 'Layer', 'ggproto', 'gg' <ggproto object: Class LayerInstance, Layer, gg>
    aes_params: list
    compute_aesthetics: function
    compute_geom_1: function
    compute_geom_2: function
    compute_position: function
    compute_statistic: function
    computed_geom_params: list
    computed_mapping: uneval
    computed_stat_params: list
    data: waiver
    draw_geom: function
    finish_statistics: function
    geom: <ggproto object: Class GeomPoint, Geom, gg>
        aesthetics: function
        default_aes: uneval
        draw_group: function
        draw_key: function
        draw_layer: function
        draw_panel: function
        extra_params: na.rm
        handle_na: function
        non_missing_aes: size shape colour
        optional_aes: 
        parameters: function
        required_aes: x y
        setup_data: function
        setup_params: function
        use_defaults: function
        super:  <ggproto object: Class Geom, gg>
    geom_params: list
    inherit.aes: TRUE
    layer_data: function
    map_statistic: function
    mapping: uneval
    position: <ggproto object: Class PositionIdentity, Position, gg>
        compute_layer: function
        compute_panel: function
        required_aes: 
        setup_data: function
        setup_params: function
        super:  <ggproto object: Class Position, gg>
    print: function
    setup_layer: function
    show.legend: NA
    stat: <ggproto object: Class StatIdentity, Stat, gg>
        aesthetics: function
        compute_group: function
        compute_layer: function
        compute_panel: function
        default_aes: uneval
        extra_params: na.rm
        finish_layer: function
        non_missing_aes: 
        optional_aes: 
        parameters: function
        required_aes: 
        retransform: TRUE
        setup_data: function
        setup_params: function
        super:  <ggproto object: Class Stat, gg>
    stat_params: list
    super:  <ggproto object: Class Layer, gg> 
  ..$ scales     :Classes 'ScalesList', 'ggproto', 'gg' <ggproto object: Class ScalesList, gg>
    add: function
    clone: function
    find: function
    get_scales: function
    has_scale: function
    input: function
    n: function
    non_position_scales: function
    scales: list
    super:  <ggproto object: Class ScalesList, gg> 
  ..$ mapping    : Named list()
  .. ..- attr(*, "class")= chr "uneval"
  ..$ theme      :List of 2
  .. ..$ axis.text.x    :List of 11
  .. .. ..$ family       : NULL
  .. .. ..$ face         : NULL
  .. .. ..$ colour       : NULL
  .. .. ..$ size         : NULL
  .. .. ..$ hjust        : num 1
  .. .. ..$ vjust        : NULL
  .. .. ..$ angle        : num 90
  .. .. ..$ lineheight   : NULL
  .. .. ..$ margin       : NULL
  .. .. ..$ debug        : NULL
  .. .. ..$ inherit.blank: logi FALSE
  .. .. ..- attr(*, "class")= chr [1:2] "element_text" "element"
  .. ..$ legend.position: chr "none"
  .. ..- attr(*, "complete")= logi FALSE
  .. ..- attr(*, "validate")= logi TRUE
  ..$ coordinates:Classes 'CoordCartesian', 'Coord', 'ggproto', 'gg' <ggproto object: Class CoordCartesian, Coord, gg>
    aspect: function
    backtransform_range: function
    clip: on
    default: TRUE
    distance: function
    expand: TRUE
    is_free: function
    is_linear: function
    labels: function
    limits: list
    modify_scales: function
    range: function
    render_axis_h: function
    render_axis_v: function
    render_bg: function
    render_fg: function
    setup_data: function
    setup_layout: function
    setup_panel_guides: function
    setup_panel_params: function
    setup_params: function
    train_panel_guides: function
    transform: function
    super:  <ggproto object: Class CoordCartesian, Coord, gg> 
  ..$ facet      :Classes 'FacetNull', 'Facet', 'ggproto', 'gg' <ggproto object: Class FacetNull, Facet, gg>
    compute_layout: function
    draw_back: function
    draw_front: function
    draw_labels: function
    draw_panels: function
    finish_data: function
    init_scales: function
    map_data: function
    params: list
    setup_data: function
    setup_params: function
    shrink: TRUE
    train_scales: function
    vars: function
    super:  <ggproto object: Class FacetNull, Facet, gg> 
  ..$ plot_env   :<environment: 0x561183994f68> 
  ..$ labels     :List of 5
  .. ..$ title: chr "MAGMA"
  .. ..$ y    : chr ""
  .. ..$ x    : chr ""
  .. ..$ fill : chr "log10p"
  .. ..$ size : chr "dotsize"
  ..- attr(*, "class")= chr [1:2] "gg" "ggplot"
 $ dendro :List of 9
  ..$ data       :'data.frame': 92 obs. of  4 variables:
  .. ..$ x   : num [1:92] 10.9 5.38 5.38 3.12 3.12 ...
  .. ..$ y   : num [1:92] 2380 2380 2103 2103 1673 ...
  .. ..$ xend: num [1:92] 5.38 5.38 3.12 3.12 1.75 ...
  .. ..$ yend: num [1:92] 2380 2103 2103 1673 1673 ...
  ..$ layers     :List of 1
  .. ..$ :Classes 'LayerInstance', 'Layer', 'ggproto', 'gg' <ggproto object: Class LayerInstance, Layer, gg>
    aes_params: list
    compute_aesthetics: function
    compute_geom_1: function
    compute_geom_2: function
    compute_position: function
    compute_statistic: function
    computed_geom_params: list
    computed_mapping: uneval
    computed_stat_params: list
    data: waiver
    draw_geom: function
    finish_statistics: function
    geom: <ggproto object: Class GeomSegment, Geom, gg>
        aesthetics: function
        default_aes: uneval
        draw_group: function
        draw_key: function
        draw_layer: function
        draw_panel: function
        extra_params: na.rm
        handle_na: function
        non_missing_aes: linetype size shape
        optional_aes: 
        parameters: function
        required_aes: x y xend yend
        setup_data: function
        setup_params: function
        use_defaults: function
        super:  <ggproto object: Class Geom, gg>
    geom_params: list
    inherit.aes: TRUE
    layer_data: function
    map_statistic: function
    mapping: uneval
    position: <ggproto object: Class PositionIdentity, Position, gg>
        compute_layer: function
        compute_panel: function
        required_aes: 
        setup_data: function
        setup_params: function
        super:  <ggproto object: Class Position, gg>
    print: function
    setup_layer: function
    show.legend: NA
    stat: <ggproto object: Class StatIdentity, Stat, gg>
        aesthetics: function
        compute_group: function
        compute_layer: function
        compute_panel: function
        default_aes: uneval
        extra_params: na.rm
        finish_layer: function
        non_missing_aes: 
        optional_aes: 
        parameters: function
        required_aes: 
        retransform: TRUE
        setup_data: function
        setup_params: function
        super:  <ggproto object: Class Stat, gg>
    stat_params: list
    super:  <ggproto object: Class Layer, gg> 
  ..$ scales     :Classes 'ScalesList', 'ggproto', 'gg' <ggproto object: Class ScalesList, gg>
    add: function
    clone: function
    find: function
    get_scales: function
    has_scale: function
    input: function
    n: function
    non_position_scales: function
    scales: list
    super:  <ggproto object: Class ScalesList, gg> 
  ..$ mapping    : Named list()
  .. ..- attr(*, "class")= chr "uneval"
  ..$ theme      :List of 9
  .. ..$ axis.title.x    :List of 11
  .. .. ..$ family       : NULL
  .. .. ..$ face         : NULL
  .. .. ..$ colour       : logi NA
  .. .. ..$ size         : NULL
  .. .. ..$ hjust        : NULL
  .. .. ..$ vjust        : NULL
  .. .. ..$ angle        : NULL
  .. .. ..$ lineheight   : NULL
  .. .. ..$ margin       : NULL
  .. .. ..$ debug        : NULL
  .. .. ..$ inherit.blank: logi FALSE
  .. .. ..- attr(*, "class")= chr [1:2] "element_text" "element"
  .. ..$ axis.title.y    : list()
  .. .. ..- attr(*, "class")= chr [1:2] "element_blank" "element"
  .. ..$ axis.text.x     : list()
  .. .. ..- attr(*, "class")= chr [1:2] "element_blank" "element"
  .. ..$ axis.text.y     : list()
  .. .. ..- attr(*, "class")= chr [1:2] "element_blank" "element"
  .. ..$ axis.ticks      : list()
  .. .. ..- attr(*, "class")= chr [1:2] "element_blank" "element"
  .. ..$ axis.line       : list()
  .. .. ..- attr(*, "class")= chr [1:2] "element_blank" "element"
  .. ..$ panel.background: list()
  .. .. ..- attr(*, "class")= chr [1:2] "element_blank" "element"
  .. ..$ panel.grid.major: list()
  .. .. ..- attr(*, "class")= chr [1:2] "element_blank" "element"
  .. ..$ panel.grid.minor: list()
  .. .. ..- attr(*, "class")= chr [1:2] "element_blank" "element"
  .. ..- attr(*, "complete")= logi FALSE
  .. ..- attr(*, "validate")= logi TRUE
  ..$ coordinates:Classes 'CoordFlip', 'CoordCartesian', 'Coord', 'ggproto', 'gg' <ggproto object: Class CoordFlip, CoordCartesian, Coord, gg>
    aspect: function
    backtransform_range: function
    clip: on
    default: FALSE
    distance: function
    expand: TRUE
    is_free: function
    is_linear: function
    labels: function
    limits: list
    modify_scales: function
    range: function
    render_axis_h: function
    render_axis_v: function
    render_bg: function
    render_fg: function
    setup_data: function
    setup_layout: function
    setup_panel_guides: function
    setup_panel_params: function
    setup_params: function
    train_panel_guides: function
    transform: function
    super:  <ggproto object: Class CoordFlip, CoordCartesian, Coord, gg> 
  ..$ facet      :Classes 'FacetNull', 'Facet', 'ggproto', 'gg' <ggproto object: Class FacetNull, Facet, gg>
    compute_layout: function
    draw_back: function
    draw_front: function
    draw_labels: function
    draw_panels: function
    finish_data: function
    init_scales: function
    map_data: function
    params: list
    setup_data: function
    setup_params: function
    shrink: TRUE
    train_scales: function
    vars: function
    super:  <ggproto object: Class FacetNull, Facet, gg> 
  ..$ plot_env   :<environment: 0x561183994f68> 
  ..$ labels     :List of 4
  .. ..$ xend: chr "xend"
  .. ..$ yend: chr "yend"
  .. ..$ x   : chr "x"
  .. ..$ y   : chr "y"
  ..- attr(*, "class")= chr [1:2] "gg" "ggplot"

Expected behaviour

(A clear and concise description of what you expected to happen.)

2. Reproducible example

Code

(Please add the steps to reproduce the bug here. See here for an intro to making a reproducible example (i.e. reprex) and why they're important! This will help us to help you much faster.)

see = magma_tileplot(ctd_quant, nonPD_results_qc)

Data

> str(ctd_quant)
List of 2
 $ level1:List of 8
  ..$ specificity          :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
  .. .. ..@ i       : int [1:296091] 0 1 2 3 4 5 6 7 8 11 ...
  .. .. ..@ p       : int [1:25] 0 12623 25181 35884 47476 60473 72472 85159 96925 110403 ...
  .. .. ..@ Dim     : int [1:2] 14240 24
  .. .. ..@ Dimnames:List of 2
  .. .. .. ..$ : Named chr [1:14240] "ACADM" "ACADVL" "ACAT1" "ACVR1" ...
  .. .. .. .. ..- attr(*, "names")= chr [1:14240] "Acadm" "Acadvl" "Acat1" "Acvr1" ...
  .. .. .. ..$ : chr [1:24] "astrocytes_ependymal" "Dopaminergic_Adult" "Dopaminergic_Neuroblast" "Embryonic_Dopaminergic_Neuron" ...
  .. .. ..@ x       : num [1:296091] 0.0859 0.0907 0.0245 0.0266 0.1668 ...
  .. .. ..@ factors : list()
  ..$ mean_exp             :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
  .. .. ..@ i       : int [1:296091] 0 1 2 3 4 5 6 7 8 11 ...
  .. .. ..@ p       : int [1:25] 0 12623 25181 35884 47476 60473 72472 85159 96925 110403 ...
  .. .. ..@ Dim     : int [1:2] 14240 24
  .. .. ..@ Dimnames:List of 2
  .. .. .. ..$ : chr [1:14240] "ACADM" "ACADVL" "ACAT1" "ACVR1" ...
  .. .. .. ..$ : chr [1:24] "astrocytes_ependymal" "Dopaminergic_Adult" "Dopaminergic_Neuroblast" "Embryonic_Dopaminergic_Neuron" ...
  .. .. ..@ x       : num [1:296091] 1.377 1.34 1.314 0.176 0.044 ...
  .. .. ..@ factors : list()
  ..$ annot                :'data.frame':   24 obs. of  1 variable:
  .. ..$ celltype: chr [1:24] "astrocytes_ependymal" "Dopaminergic Adult" "Dopaminergic Neuroblast" "Embryonic Dopaminergic Neuron" ...
  ..$ standardised         : logi TRUE
  ..$ species              :List of 2
  .. ..$ input_species : chr "mouse"
  .. ..$ output_species: chr "human"
  ..$ versions             :List of 3
  .. ..$ EWCE      :Classes 'package_version', 'numeric_version'  hidden list of 1
  .. .. ..$ : int [1:3] 1 5 5
  .. ..$ orthogene :Classes 'package_version', 'numeric_version'  hidden list of 1
  .. .. ..$ : int [1:3] 1 3 1
  .. ..$ homologene:Classes 'package_version', 'numeric_version'  hidden list of 1
  .. .. ..$ : int [1:6] 1 4 68 19 3 27
  ..$ specificity_quantiles:Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
  .. .. ..@ i       : int [1:296091] 0 1 2 3 4 5 6 7 8 11 ...
  .. .. ..@ p       : int [1:25] 0 12623 25181 35884 47476 60473 72472 85159 96925 110403 ...
  .. .. ..@ Dim     : int [1:2] 14240 24
  .. .. ..@ Dimnames:List of 2
  .. .. .. ..$ : Named chr [1:14240] "ACADM" "ACADVL" "ACAT1" "ACVR1" ...
  .. .. .. .. ..- attr(*, "names")= chr [1:14240] "Acadm" "Acadvl" "Acat1" "Acvr1" ...
  .. .. .. ..$ : chr [1:24] "astrocytes_ependymal" "Dopaminergic_Adult" "Dopaminergic_Neuroblast" "Embryonic_Dopaminergic_Neuron" ...
  .. .. ..@ x       : num [1:296091] 36 36 22 23 39 14 32 40 25 38 ...
  .. .. ..@ factors : list()
  ..$ specificity_deciles  :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
  .. .. ..@ i       : int [1:296091] 0 1 2 3 4 5 6 7 8 11 ...
  .. .. ..@ p       : int [1:25] 0 12623 25181 35884 47476 60473 72472 85159 96925 110403 ...
  .. .. ..@ Dim     : int [1:2] 14240 24
  .. .. ..@ Dimnames:List of 2
  .. .. .. ..$ : Named chr [1:14240] "ACADM" "ACADVL" "ACAT1" "ACVR1" ...
  .. .. .. .. ..- attr(*, "names")= chr [1:14240] "Acadm" "Acadvl" "Acat1" "Acvr1" ...
  .. .. .. ..$ : chr [1:24] "astrocytes_ependymal" "Dopaminergic_Adult" "Dopaminergic_Neuroblast" "Embryonic_Dopaminergic_Neuron" ...
  .. .. ..@ x       : num [1:296091] 9 9 6 6 10 4 8 10 7 10 ...
  .. .. ..@ factors : list()
 $ level2:List of 8
  ..$ specificity          :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
  .. .. ..@ i       : int [1:1494549] 0 1 2 3 4 5 6 7 8 11 ...
  .. .. ..@ p       : int [1:150] 0 11070 22299 35820 49231 60945 72757 81515 89851 101568 ...
  .. .. ..@ Dim     : int [1:2] 14240 149
  .. .. ..@ Dimnames:List of 2
  .. .. .. ..$ : Named chr [1:14240] "ACADM" "ACADVL" "ACAT1" "ACVR1" ...
  .. .. .. .. ..- attr(*, "names")= chr [1:14240] "Acadm" "Acadvl" "Acat1" "Acvr1" ...
  .. .. .. ..$ : chr [1:149] "Astro1" "Astro2" "CA1Pyr1" "CA1Pyr2" ...
  .. .. ..@ x       : num [1:1494549] 0.01329 0.01375 0.00448 0.00389 0.09232 ...
  .. .. ..@ factors : list()
  ..$ mean_exp             :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
  .. .. ..@ i       : int [1:1494549] 0 1 2 3 4 5 6 7 8 11 ...
  .. .. ..@ p       : int [1:150] 0 11070 22299 35820 49231 60945 72757 81515 89851 101568 ...
  .. .. ..@ Dim     : int [1:2] 14240 149
  .. .. ..@ Dimnames:List of 2
  .. .. .. ..$ : chr [1:14240] "ACADM" "ACADVL" "ACAT1" "ACVR1" ...
  .. .. .. ..$ : chr [1:149] "Astro1" "Astro2" "CA1Pyr1" "CA1Pyr2" ...
  .. .. ..@ x       : num [1:1494549] 1.265 1.544 1.588 0.162 0.103 ...
  .. .. ..@ factors : list()
  ..$ annot                :'data.frame':   149 obs. of  1 variable:
  .. ..$ celltype: chr [1:149] "Astro1" "Astro2" "CA1Pyr1" "CA1Pyr2" ...
  ..$ standardised         : logi TRUE
  ..$ species              :List of 2
  .. ..$ input_species : chr "mouse"
  .. ..$ output_species: chr "human"
  ..$ versions             :List of 3
  .. ..$ EWCE      :Classes 'package_version', 'numeric_version'  hidden list of 1
  .. .. ..$ : int [1:3] 1 5 5
  .. ..$ orthogene :Classes 'package_version', 'numeric_version'  hidden list of 1
  .. .. ..$ : int [1:3] 1 3 1
  .. ..$ homologene:Classes 'package_version', 'numeric_version'  hidden list of 1
  .. .. ..$ : int [1:6] 1 4 68 19 3 27
  ..$ specificity_quantiles:Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
  .. .. ..@ i       : int [1:1494549] 0 1 2 3 4 5 6 7 8 11 ...
  .. .. ..@ p       : int [1:150] 0 11070 22299 35820 49231 60945 72757 81515 89851 101568 ...
  .. .. ..@ Dim     : int [1:2] 14240 149
  .. .. ..@ Dimnames:List of 2
  .. .. .. ..$ : Named chr [1:14240] "ACADM" "ACADVL" "ACAT1" "ACVR1" ...
  .. .. .. .. ..- attr(*, "names")= chr [1:14240] "Acadm" "Acadvl" "Acat1" "Acvr1" ...
  .. .. .. ..$ : chr [1:149] "Astro1" "Astro2" "CA1Pyr1" "CA1Pyr2" ...
  .. .. ..@ x       : num [1:1494549] 37 37 28 26 40 11 25 40 23 30 ...
  .. .. ..@ factors : list()
  ..$ specificity_deciles  :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
  .. .. ..@ i       : int [1:1494549] 0 1 2 3 4 5 6 7 8 11 ...
  .. .. ..@ p       : int [1:150] 0 11070 22299 35820 49231 60945 72757 81515 89851 101568 ...
  .. .. ..@ Dim     : int [1:2] 14240 149
  .. .. ..@ Dimnames:List of 2
  .. .. .. ..$ : Named chr [1:14240] "ACADM" "ACADVL" "ACAT1" "ACVR1" ...
  .. .. .. .. ..- attr(*, "names")= chr [1:14240] "Acadm" "Acadvl" "Acat1" "Acvr1" ...
  .. .. .. ..$ : chr [1:149] "Astro1" "Astro2" "CA1Pyr1" "CA1Pyr2" ...
  .. .. ..@ x       : num [1:1494549] 10 10 7 7 10 3 7 10 6 8 ...
  .. .. ..@ factors : list()

 > str(nonPD_results_qc)
'data.frame':   72 obs. of  15 variables:
 $ Celltype      : chr  "astrocytes_ependymal" "Dopaminergic_Adult" "Dopaminergic_Neuroblast" "Embryonic_Dopaminergic_Neuron" ...
 $ OBS_GENES     : chr  "1166" "1132" "980" "1059" ...
 $ BETA          : num  -0.00764 0.00903 0.01247 -0.00519 -0.00681 ...
 $ BETA_STD      : num  -0.00187 0.00218 0.00281 -0.00121 -0.00169 ...
 $ SE            : num  0.0273 0.0284 0.0294 0.029 0.0272 ...
 $ P             : num  0.61 0.375 0.336 0.571 0.599 ...
 $ level         : int  1 1 1 1 1 1 1 1 1 1 ...
 $ Method        : chr  "MAGMA" "MAGMA" "MAGMA" "MAGMA" ...
 $ GCOV_FILE     : chr  "als_ldscQCed.tsv.35UP.10DOWN.level1.Karolinska_Top10.gsa.out" "als_ldscQCed.tsv.35UP.10DOWN.level1.Karolinska_Top10.gsa.out" "als_ldscQCed.tsv.35UP.10DOWN.level1.Karolinska_Top10.gsa.out" "als_ldscQCed.tsv.35UP.10DOWN.level1.Karolinska_Top10.gsa.out" ...
 $ CONTROL       : chr  "BASELINE" "BASELINE" "BASELINE" "BASELINE" ...
 $ CONTROL_label : chr  "BASELINE" "BASELINE" "BASELINE" "BASELINE" ...
 $ log10p        : num  -0.214 -0.425 -0.474 -0.243 -0.223 ...
 $ genesOutCOND  : chr  "NA" "NA" "NA" "NA" ...
 $ EnrichmentMode: chr  "Top 10%" "Top 10%" "Top 10%" "Top 10%" ...
 $ LABEL         : chr  "als_ldscQCed" "als_ldscQCed" "als_ldscQCed" "als_ldscQCed" ...

3. Session info

(Add output of the R function utils::sessionInfo() below. This helps us assess version/OS conflicts which could be causing bugs.)

``` > sessionInfo() R version 4.2.0 (2022-04-22) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.5 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/liblapack.so.3 locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 [6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] MAGMA.Celltyping_2.0.7 here_1.0.1 forcats_0.5.2 stringr_1.4.1 dplyr_1.0.10 purrr_0.3.4 [7] readr_2.1.2 tidyr_1.2.0 tibble_3.1.8 ggplot2_3.3.6 tidyverse_1.3.2 data.table_1.14.2 loaded via a namespace (and not attached): [1] utf8_1.2.2 R.utils_2.12.0 tidyselect_1.1.2 lme4_1.1-30 [5] RSQLite_2.2.16 AnnotationDbi_1.59.1 htmlwidgets_1.5.4 grid_4.2.0 [9] BiocParallel_1.31.12 munsell_0.5.0 codetools_0.2-18 withr_2.5.0 [13] colorspace_2.0-3 Biobase_2.57.1 filelock_1.0.2 knitr_1.40 [17] rstudioapi_0.14 orthogene_1.3.2 stats4_4.2.0 SingleCellExperiment_1.19.0 [21] ggsignif_0.6.3 gitcreds_0.1.1 labeling_0.4.2 MatrixGenerics_1.9.1 [25] GenomeInfoDbData_1.2.8 farver_2.1.1 bit64_4.0.5 rprojroot_2.0.3 [29] vctrs_0.4.1 treeio_1.21.2 generics_0.1.3 xfun_0.32 [33] BiocFileCache_2.5.0 R6_2.5.1 GenomeInfoDb_1.33.5 bitops_1.0-7 [37] cachem_1.0.6 gridGraphics_0.5-1 DelayedArray_0.23.1 assertthat_0.2.1 [41] promises_1.2.0.1 BiocIO_1.7.1 scales_1.2.1 googlesheets4_1.0.1 [45] gtable_0.3.1 rlang_1.0.5 MungeSumstats_1.5.13 splines_4.2.0 [49] rtracklayer_1.57.0 rstatix_0.7.0 lazyeval_0.2.2 gargle_1.2.0 [53] broom_1.0.1 BiocManager_1.30.18 yaml_2.3.5 reshape2_1.4.4 [57] abind_1.4-5 modelr_0.1.9 GenomicFeatures_1.49.6 backports_1.4.1 [61] httpuv_1.6.5 tools_4.2.0 ggplotify_0.1.0 ellipsis_0.3.2 [65] ggdendro_0.1.23 BiocGenerics_0.43.1 Rcpp_1.0.9 plyr_1.8.7 [69] progress_1.2.2 zlibbioc_1.43.0 RCurl_1.98-1.8 prettyunits_1.1.1 [73] ggpubr_0.4.0 S4Vectors_0.35.3 SummarizedExperiment_1.27.2 haven_2.5.1 [77] fs_1.5.2 magrittr_2.0.3 gh_1.3.0 reprex_2.0.2 [81] googledrive_2.0.0 matrixStats_0.62.0 hms_1.1.2 patchwork_1.1.2 [85] mime_0.12 evaluate_0.16 xtable_1.8-4 XML_3.99-0.10 [89] EWCE_1.5.7 readxl_1.4.1 IRanges_2.31.2 gridExtra_2.3 [93] compiler_4.2.0 biomaRt_2.53.2 crayon_1.5.1 minqa_1.2.4 [97] R.oo_1.25.0 htmltools_0.5.3 ggfun_0.0.7 later_1.3.0 [101] tzdb_0.3.0 aplot_0.1.6 lubridate_1.8.0 DBI_1.1.3 [105] ExperimentHub_2.5.0 gprofiler2_0.2.1 dbplyr_2.2.1 MASS_7.3-58.1 [109] rappdirs_0.3.3 boot_1.3-28 babelgene_22.3 Matrix_1.4-1 [113] car_3.1-0 piggyback_0.1.3 cli_3.3.0 R.methodsS3_1.8.2 [117] parallel_4.2.0 GenomicRanges_1.49.1 pkgconfig_2.0.3 GenomicAlignments_1.33.1 [121] plotly_4.10.0 xml2_1.3.3 ggtree_3.5.3 XVector_0.37.1 [125] rvest_1.0.3 yulab.utils_0.0.5 VariantAnnotation_1.43.3 digest_0.6.29 [129] Biostrings_2.65.3 rmarkdown_2.16 cellranger_1.1.0 HGNChelper_0.8.1 [133] tidytree_0.4.0 restfulr_0.0.15 curl_4.3.2 shiny_1.7.2 [137] Rsamtools_2.13.4 nloptr_2.0.3 rjson_0.2.21 lifecycle_1.0.1 [141] nlme_3.1-159 jsonlite_1.8.0 carData_3.0-5 viridisLite_0.4.1 [145] limma_3.53.6 BSgenome_1.65.2 fansi_1.0.3 pillar_1.8.1 [149] lattice_0.20-45 homologene_1.4.68.19.3.27 KEGGREST_1.37.3 fastmap_1.1.0 [153] httr_1.4.4 googleAuthR_2.0.0 interactiveDisplayBase_1.35.0 glue_1.6.2 [157] RNOmni_1.0.1 png_0.1-7 ewceData_1.5.0 BiocVersion_3.16.0 [161] bit_4.0.4 stringi_1.7.8 blob_1.2.3 AnnotationHub_3.5.0 [165] memoise_2.0.1 ape_5.6-2 ```

</details>
bschilder commented 1 year ago

It is expected, it's simply an artefact of the method that was used to save them.

That said, I've been working on updating the code to merge plots in other function like this with patchwork, so I'll see if I can implement something like this here as well.

bschilder commented 1 year ago

Now implemented in MAGMA.Celltyping v2.0.8:

New argument bind_plots (default=TRUE) will merge and align the two subplots together.

res <- MAGMA.Celltyping::enrichment_results[[1]]
results <- res$ctAssocMerged$level1$results
ctd <- ewceData::ctd()
tile_res <- magma_tileplot(ctd=ctd, results=results)

plot_zoom_png?width=762 height=900