-
Notifications
You must be signed in to change notification settings - Fork 1
Add CINmetrics module #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SaraPotente
wants to merge
7
commits into
master
Choose a base branch
from
cinmetrics_module
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b6a2ea5
fix: add CINmetrics module and MultiQC integration
SaraPotente 5c5d156
add cinmetrics module
SaraPotente f46cdb6
modify schema for cinmetrics params
SaraPotente 34a56a8
add cinmetrics config
SaraPotente 4307667
add cinmetrics section in multiqc report
SaraPotente eb3c0dd
add cinmetrics module and container
SaraPotente 4491b45
Add CINmetrics citation
SaraPotente File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| #!/usr/bin/env Rscript | ||
| suppressPackageStartupMessages({ | ||
| library(CINmetrics, quietly = TRUE) | ||
| library(argparser, quietly = TRUE) | ||
| library(readr, quietly = TRUE) | ||
| library(dplyr, quietly = TRUE) | ||
| }) | ||
|
|
||
| parser <- arg_parser("Compute CINmetrics", hide.opts = TRUE) | ||
|
|
||
| parser <- add_argument(parser, "--seg_file", | ||
| help = "Input segmentation file", | ||
| nargs = Inf) | ||
| parser <- add_argument(parser, "--output", | ||
| help = "Output TSV file", | ||
| default = "cinmetrics_output.tsv") | ||
| parser <- add_argument(parser, "--segmentMean_tai", | ||
| help = "Threshold for TAI", | ||
| type = "numeric", default = 0.2) | ||
| parser <- add_argument(parser, "--segmentMean_cna", | ||
| help = "Threshold for CNA", | ||
| type = "numeric", default = (log(1.7, 2) - 1)) | ||
| parser <- add_argument(parser, "--segmentMean_base_segments", | ||
| help = "Threshold for base segments", | ||
| type = "numeric", default = 0.2) | ||
| parser <- add_argument(parser, "--segmentMean_break_points", | ||
| help = "Threshold for break points", | ||
| type = "numeric", default = 0.2) | ||
| parser <- add_argument(parser, "--segmentMean_fga", | ||
| help = "Threshold for FGA", | ||
| type = "numeric", default = 0.2) | ||
| parser <- add_argument(parser, "--numProbes", | ||
| help = "Minimum number of probes", | ||
| type = "numeric", default = NA) | ||
| parser <- add_argument(parser, "--segmentDistance_cna", | ||
| help = "Segment distance for CNA", | ||
| type = "numeric", default = 0.2) | ||
| parser <- add_argument(parser, "--minSegSize_cna", | ||
| help = "Minimum segment size for CNA", | ||
| type = "numeric", default = 10) | ||
| parser <- add_argument(parser, "--genomeSize_fga", | ||
| help = "Genome size for FGA", | ||
| type = "numeric", default = 2873203431) | ||
|
|
||
| args <- parse_args(parser) | ||
|
|
||
| input_file <- args$seg_file | ||
| cat("Reading:", input_file, "\n") | ||
| df <- read_tsv(input_file, show_col_types = FALSE) | ||
|
|
||
| colnames(df) <- c("Sample", "Chromosome", "Start", "End", "Num_Probes", "Segment_Mean") | ||
|
|
||
| df <- df %>% | ||
| mutate( | ||
| Sample = as.character(Sample), | ||
| Chromosome = gsub("^chr", "", Chromosome) | ||
| ) | ||
|
|
||
| cat("CINmetrics calculation...\n") | ||
| metrics <- CINmetrics( | ||
| cnvData = df, | ||
| segmentMean_tai = args$segmentMean_tai, | ||
| segmentMean_cna = args$segmentMean_cna, | ||
| segmentMean_base_segments = args$segmentMean_base_segments, | ||
| segmentMean_break_points = args$segmentMean_break_points, | ||
| segmentMean_fga = args$segmentMean_fga, | ||
| numProbes = args$numProbes, | ||
| segmentDistance_cna = args$segmentDistance_cna, | ||
| minSegSize_cna = args$minSegSize_cna, | ||
| genomeSize_fga = args$genomeSize_fga | ||
| ) | ||
|
|
||
| metrics$tai[is.na(metrics$tai)] <- 0 | ||
SaraPotente marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| write_tsv(metrics, args$output) | ||
| cat("Output file:", args$output, "\n") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| process COMPUTE_CINMETRICS{ | ||
| tag "Compute CINmetrics" | ||
| label 'process_single' | ||
|
|
||
| container 'ghcr.io/dincalcilab/cinmetrics:0.1.0' | ||
|
|
||
| input: | ||
| file(seg_file) | ||
|
|
||
| output: | ||
| path("*.tsv"), emit: cinmetrics_summary | ||
| path("versions.yml"), emit: versions | ||
|
|
||
| when: | ||
| task.ext.when == null || task.ext.when | ||
|
|
||
| script: | ||
| def args = task.ext.args ?: '' | ||
| def VERSION = "0.1" | ||
| """ | ||
| compute_cinmetrics.R \\ | ||
| --seg_file $seg_file \\ | ||
| --output cinmetrics_summary_mqc.tsv \\ | ||
| $args | ||
SaraPotente marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| cat << END_VERSIONS > versions.yml | ||
| "${task.process}": | ||
| CINmetrics: ${VERSION} | ||
| END_VERSIONS | ||
| """ | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.