Skip to content

Commit

Permalink
minor adaptations
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesGawron committed Dec 10, 2024
1 parent 5562bfc commit 2d1251a
Show file tree
Hide file tree
Showing 5 changed files with 509 additions and 117 deletions.
1 change: 0 additions & 1 deletion experiments/assessing_cluster_clonality/workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ MARKDOWNS = PROJECT_DIR / "data" / "markdowns"


######Rules######
include: "rules/common.smk"
include: "rules/base.smk"


Expand Down
4 changes: 4 additions & 0 deletions experiments/assessing_cluster_clonality/workflow/envs/R.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ dependencies:
- r-tidyverse>=2.0
- pandoc>=3.1
- r-heatmaply>=1.5
- r-optparse>=1.7
- r-viridis>=0.6
- r-vgam>=1.1
- r-pscl>=1.5
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ annotate_variants <- function(sampleName, inputFolder, variantList) {


# Read VCF file to extract column names
file <- file.path(inputFolder, "filtered", "vcf_files_annotated", paste0(sampleName, ".ann.vcf"))
file <- file.path(inputFolder, "annotations", paste0(sampleName, ".ann.vcf"))
lines <- readLines(file, warn = FALSE)
vcf_names <- strsplit(lines[grep("^#CHROM", lines)], "\t")[[1]]

# Read VCF file into a data frame
vcf <- read.table(file.path(inputFolder, "filtered", "vcf_files_annotated", paste0(sampleName, ".ann.vcf")),
vcf <- read.table(file.path(inputFolder, "annotations", paste0(sampleName, ".ann.vcf")),
comment.char = "#", sep = "\t", header = FALSE, col.names = vcf_names
)
colnames(vcf)[1] <- "#CHROM"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,37 @@ source("../resources/functions.R")
library("optparse")

parser <- OptionParser()
parser <- add_option(parser, c("-i", "--input-file"),
parser <- add_option(parser, c("-i", "--input-folder"),
type = "character",
default = "~/Documents/projects/CTC_backup/input_folder", help = "Path to the folder containing all input files"
)
parser <- add_option(parser, c("-n", "--name-of-tree"),
type = "character",
default = "Br23", help = "Name of the tree for which to simulate CTC-clusters"
)
args <- parse_args(parser, args = c("--input-file", "--name-of-tree"))
args <- parse_args(parser)




inputFolder <- dirname(args$"input-file")
treeName <- args$name_of_tree
input_folder <- args$"input-folder"
tree_name <- args$"name-of-tree"


# inputFolder <- "~/Documents/projects/CTC_backup/input_folder"
# treeName <- "Br23"

# input_folder <- "~/Documents/projects/CTC_backup/input_folder"
# tree_name <- "Br23"

input <- load_data(inputFolder, treeName)

allClusterSizes <- input$sample_description %>%
input <- load_data(input_folder, tree_name)

all_cluster_sizes <- input$sample_description %>%
filter(WBC == 0 & color != "gray93") %>%
group_by(color) %>%
filter(n() > 1) %>%
summarize(cluster_size = n()) %>%
dplyr::select("cluster_size") %>%
unique()

write_csv(allClusterSizes, file.path(inputFolder, treeName, paste(treeName, "clusterSizes.csv", sep = "_")))
write_csv(all_cluster_sizes, file.path(input_folder, tree_name, paste(tree_name, "clusterSizes.csv", sep = "_")))
print("Success.")
Loading

0 comments on commit 2d1251a

Please sign in to comment.