Skip to content

Commit a675d41

Browse files
committed
add aneuploidy score calculation
1 parent aee5eb5 commit a675d41

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Rscript run_ascets.R -i seg_example.seg -c genomic_arm_coordinates_hg19.txt -m 0
6969
#### Output files
7070
- Arm-level calls for each arm in each sample in the input (arm_level_calls.txt)
7171
- Weighted average segment mean values for each arm in each sample in the input (weighted_average_segmeans.txt)
72+
- Aneuploidy scores (range 0-1, fraction of arms amplified or deleted out of total called arms [call ≠ LOWCOV])
7273
- Histogram of modeled noise in the segments in the input cohort (noise_hist.pdf)
7374
- Parameters used to make arm-level calls (params.txt)
7475
- Histogram of the segment means in the input cohort (segmean_hist.pdf)
@@ -84,7 +85,7 @@ ASCETS can also be run from within R Studio through calling the *ascets()* funct
8485
- The following columns are required in this order (names can vary): sample, chromosome, segment start, segment end, number of markers, log2ratio
8586
- See sample data for an example file
8687
- Chromosome arm genomic coordinates (*cytoband* argument supplied as a data frame)
87-
- We supply an example file in the repository for hg19 (original data from [bioMart](http://grch37.ensembl.org/biomart/martview/69a5479f5796c22ca786f81386e2d5e4)), but other coordinates can be supplied in the same format such as cytoband coordinates (also provided for hg19)
88+
- We supply a example files in the repository for hg19/38 (original data from [bioMart](http://grch37.ensembl.org/biomart/martview/69a5479f5796c22ca786f81386e2d5e4)), but other coordinates can be supplied in the same format such as cytoband coordinates (also provided for hg19)
8889
- Minimum arm breadth of coverage (BOC) to make a call (range 0.0 - 1.0; *min_cov* argument supplied as a numeric value)
8990
- Optional, defaults to 0.5
9091
- Specify 0.0 to allow any BOC
@@ -103,7 +104,8 @@ ASCETS can also be run from within R Studio through calling the *ascets()* funct
103104

104105
A list containing:
105106
- *calls*: data frame containing aSCNA calls
106-
- *weight_ave*: data frame arm weighted average segment means
107+
- *weight_ave*: data frame containing arm weighted average segment means
108+
- *aneu_scores*: data frame containing aneuploidy scores for each sample
107109
- *amp_thresh*: numeric value representing amplification threshold that was used to make aSCNA calls
108110
- *del_thresh*: numeric value representing deletion threshold that was used to make aSCNA calls
109111
- *alteration_thresh*: numeric value representing fraction of arm that must be altered to call an aSCNA

ascets_resources.R

+13
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,13 @@ compute_alt_fractions <- function(cna, amp_thresh, del_thresh, min_boc) {
262262
distinct()
263263
}
264264

265+
calc_aneu_scores <- function(calls) {
266+
calls %>% gather(arm, call, -sample) %>%
267+
group_by(sample) %>%
268+
summarize(aneuploidy_score = length(call[call %in% c("AMP", "DEL")]) /
269+
length(call[call != "LOWCOV"]))
270+
}
271+
265272
# main function to run the ASCETS algorithm
266273

267274
# INPUT
@@ -340,7 +347,12 @@ ascets <- function(cna, cytoband, min_boc = 0.5, name, noise = data.frame(), kee
340347
cat("Making arm level calls...\n")
341348
calls <- make_all_calls(cna_output, alteration_threshold)
342349

350+
# calculate aneuploidy scores
351+
cat("Calculating aneuploidy scores...\n")
352+
aneu_scores <- calc_aneu_scores(calls)
353+
343354
list(calls = calls,
355+
aneu_scores = aneu_scores,
344356
weight_ave = weight_ave,
345357
amp_thresh = amp_thresh,
346358
del_thresh = del_thresh,
@@ -376,6 +388,7 @@ write_outputs_to_file <- function(ascets, location = "./") {
376388
cat("Writing final outputs...\n")
377389
write.table(ascets$calls, paste0(location, ascets$name, "_arm_level_calls.txt"), quote = F, row.names = F, sep = "\t")
378390
write.table(ascets$weight_ave, paste0(location, ascets$name, "_arm_weighted_average_segmeans.txt"), quote = F, row.names = F, sep = "\t")
391+
write.table(ascets$aneu_scores, paste0(location, ascets$name, "_aneuploidy_scores.txt"), quote = F, row.names = F, sep = "\t")
379392

380393
f <- file(paste0(location, ascets$name, "_params.txt"))
381394
writeLines(c(ascets$name,

0 commit comments

Comments
 (0)