Skip to content

Commit 4cc5ed6

Browse files
committed
homoloss parameter handling fixed...
1 parent 2439be0 commit 4cc5ed6

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

R/file_utils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ cells_filename <- function(output_dir, casename) {
6868
case_filenames <- function(output_dir, casename) {
6969
suffixes <- list(
7070
'ratio', 'clone', 'tree', 'seg',
71-
'featuremat', 'features',
71+
'featuremat', 'features', 'ploidies',
7272
'guide', 'genome', 'cells',
7373
'sim_pv', 'true_pv')
7474

R/pinmat.R

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ augment_gc <- function(gc_df, df) {
1616
return(augment_df)
1717
}
1818

19-
calc_segments_short <- function(gc_df, segment_df, homoloss=0.01, chromrange=1:24) {
19+
calc_segments_short <- function(gc_df, segment_df, homoloss=1.0, chromrange=1:24) {
2020
assertthat::assert_that(is.numeric(gc_df$chrom))
2121
assertthat::assert_that(is.numeric(segment_df$chrom))
2222
assertthat::assert_that(all(colnames(gc_df) ==
@@ -51,11 +51,9 @@ calc_segments_short <- function(gc_df, segment_df, homoloss=0.01, chromrange=1:2
5151

5252
cells <- rownames(ploidies_df)
5353

54-
if(homoloss > 0) {
55-
good_index <- ploidies_df[,"homoloss"] <= homoloss
56-
tshort <- tshort[tshort[,"profid"]%in%dimnames(ploidies_df)[[1]][good_index],]
57-
cells <- rownames(ploidies_df[good_index,])
58-
}
54+
good_index <- ploidies_df[,"homoloss"] <= homoloss
55+
tshort <- tshort[tshort[,"profid"]%in%dimnames(ploidies_df)[[1]][good_index],]
56+
cells <- rownames(ploidies_df[good_index,])
5957

6058
res <- list(tshort, ploidies_df, cells)
6159
names(res) <- c("short", "ploidies", "cells")
@@ -276,7 +274,7 @@ calc_ploidies <- function(gc_df, segment_df, chromrange=1:24) {
276274
#' @return a list of pinmat and pins objects.
277275
#' pinmat is the incidence table; pins is the bin location
278276
#' @export
279-
calc_pinmat <- function(gc_df, segment_df, homoloss=0.0, dropareas=NULL,
277+
calc_pinmat <- function(gc_df, segment_df, homoloss=1.0, dropareas=NULL,
280278
smear=1, chromrange=1:24, keepboundaries=F) {
281279

282280
augment_df <- augment_gc(gc_df, segment_df)

0 commit comments

Comments
 (0)