Skip to content

Add wrapper function for running internal references #1130

@sjspielman

Description

@sjspielman

If you are filing this issue based on a specific GitHub Discussion, please link to the relevant Discussion.

Part of #1080

Describe the goals of the changes to the analysis module.

In #1126, a function was added to the infercnv-consensus-cell-type module to prepare internal normal references, i.e. a normal reference that uses cells only from the given library. The function was implemented to be specific to ewings data from SCPCP000015.

In the future if we want to run other projects with internal references, we will need to update this code to include project-specific functions and an overall wrapper function to call from the inferCNV script.


Here are the relevant sections of code with TODOs:

# TODO: Currently this function is specific to SCPCP000015
# In the future this may need to be updated as a wrapper function to call individual project functions
prepare_internal_reference_annotations(
opts$reference_celltype_group, # cell type groups to include in reference
opts$reference_celltype_tsv, # map between reference groups and consensus cell types
opts$celltype_tsv, # consensus cell type annotations
opts$annotation_file, # annotations file to export
library_id, # SCE of interest library id
opts$testing # logical if we're running with test data
)
}

# TODO: currently the code assumes this contains columns `ewing_annotation` and `consensus_annotation`
celltype_df <- readr::read_tsv(celltype_tsv)

annotation_df <- celltype_df |>
# add indicator for cell types intended for the reference
dplyr::mutate(annotation = ifelse(
# TODO: If we want to use non-ewings projects in this script, this will NOT WORK.
# We may need project-specific helper functions for this spot in the code if/when the time comes.
consensus_annotation %in% reference_celltypes & !stringr::str_detect(ewing_annotation, "tumor"),
"reference",
"unknown"
))
}

What will your pull request contain?

Re-organized functions

Will you require additional software beyond what is already in the analysis module?

No, only renv

Will you require different computational resources beyond what the analysis module already uses?

No

If known, when do you expect to file the pull request?

This PR will be filed as needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions