Giter Site home page Giter Site logo

ppbc's People

Contributors

ksm113 avatar tychobismeijer avatar

Stargazers

 avatar

Watchers

 avatar  avatar

ppbc's Issues

Merge src/utils/outcome.R with src/spatial/process_density_outcomes.R

Handy to have just one function for processing outcome data, now that we have a "final" metadata file. outcome.R is the more robust of the two existing options and will also be used in the RNAseq pipeline post refactor. Both run and produce the desired result; low priority task.

Rerun analysis pipeline using "final" metadata

This is already WIP under the refactor branch. Incorporating a new metadata file requires a substantial rework of older notebooks. Where necessary, the code will be rewritten for legibility and polish as well as compatibility with the new file. Some reorganization is also taking place (i.e. RNAseq reports go in reports/rnaseq instead of reports).

Check the following enhancement when calculating density_total

Pertains to model_density.R.

# Also perform total aggregation on combined tumor and stroma
  totals <- region %>%    group_by(t_number, panel, cell_type, batch) %>%
    summarise(area = sum(area), n = sum(n), .groups = "drop") %>%
    mutate(classifier_label = "Total", .before = everything()) %>%
    group_by(classifier_label) %>%
    mutate(
      area = ensure_one_value(area), # Fill in area when n==0
      classifier_label = factor(classifier_label, levels = c("Stroma", "Tumor", "Total"))
    ) %>%
    mutate(density = if_else(n==0, 0, n / area))


  bind_rows(region, totals)
}

Unnecessarily copied code. How about

density_total <- density_per_region %>%
    group_by(t_number, panel, cell_type, batch, .drop=F) %>%
    summarize(n = sum(n), area = ensure_one_value(area)) %>%
    mutate(classifier_label = 'Total')

the density calculation from area and n can also be shared:

bind_rows(region, totals) %>%
    mutate(density = if_else(n==0, 0, n / area))

Originally posted by @tychobismeijer in #2 (comment)

Incorporate Hanne's code

All of Hanne's work is outside the git repo and based upon a mix of (mostly untracked) output files, sometimes with manual edits in Excel or similar. These need to be incorporated into version control before the project is reproducible.

Reworking the existing code to accept the "final" metadata file is a prerequisite, as her notebooks are based upon it.

Move min_cell_count Snakemake parameters to config file.

rule invbf_time_density:
  input:
    density_outcome = "data/vectra/processed/density_ppbc.Rds",
    rmd="reports/spatial/06b_inv_time_density.Rmd",
    script="src/rmarkdown.R"
  params:
    min_cell_count = 20000,

Snakemake will not rerun if the parameters are changed. If they are in a seperate file, in input, it will rerun as expected.

Originally posted by @tychobismeijer in #2 (comment)

R environment cannot be installed

Installation of renv fails for me, so this needs to be fixed or documented how installation is supposed to work.

Retrieving 'https://cloud.r-project.org/src/contrib/Archive/apeglm/apeglm_1.12.0.tar.gz' ...
Warning: failed to find source for 'bbmle 1.0.24' in package repositories
Warning: failed to find source for 'numDeriv 2020.2-1' in package repositories
Warning: failed to retrieve 'https://cloud.r-project.org/src/contrib/Archive/numDeriv/numDeriv_2020.2-1.tar.gz' [error code 22]
Warning: failed to retrieve 'https://cloud.r-project.org/src/contrib/Archive/apeglm/apeglm_1.12.0.tar.gz' [error code 22]
Error: failed to retrieve package '[email protected]'
In addition: Warning messages:
1: curl: (22) The requested URL returned error: 404  
2: failed to find source for 'bbmle 1.0.24' in package repositories 
3: curl: (22) The requested URL returned error: 404  
4: curl: (22) The requested URL returned error: 404  
Traceback (most recent calls last):
9: renv:::restore()
8: renv_restore_run_actions(project, diff, current, lockfile, rebuild)
7: retrieve(packages)
6: handler(package, renv_retrieve_impl(package))
5: renv_retrieve_impl(package)
4: renv_retrieve_bioconductor(record)
3: renv_retrieve_repos(record)
2: stopf("failed to retrieve package '%s'", renv_record_format_remote(record))
1: stop(sprintf(fmt, ...), call. = call.)
Execution halted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.