Skip to content

Commit

Permalink
Update to package
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvindiyer committed Nov 26, 2024
1 parent a7463c6 commit 2317abf
Show file tree
Hide file tree
Showing 65 changed files with 251 additions and 199 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: select
Version: 1.6.3
Version: 1.6.4
Date: 2019-12-01
Title: SELECT - Selected Events Linked by Evolutionary Conditions across human Tumors
Authors@R: c(
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# select 1.6.4

* Fixed some bugs and updated code.

# select 1.6.3

* Added a `NEWS.md` file to track changes to the package.
Expand Down
15 changes: 11 additions & 4 deletions R/select.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
calculate_FDR = TRUE,
verbose = TRUE,
nbatches = 1,
FDR.thresh = 0.1
FDR.thresh = FDR.cutoff
) {
print(paste('-> Collecting event stats on observed GAM...'))
# Get AL stats
Expand Down Expand Up @@ -166,20 +166,25 @@
print(paste('Memory usage:', gc()['Vcells',2], 'MB'))
}
}

if(save.intermediate.files) save(FDR, file=paste(folder,'wMI_FDR.RData',sep=''))

alpi$select_score_good_cancer_cell_2017_criterion_1 = NA
# Select optimal APC score threshold (removing 95% of FP)
if(calculate_APC_threshold) {
print(paste('-> Calculating APC threshold...'))
TP.FP.thr = select:::establish_APC_threshold(alpi)
threshold = TP.FP.thr$thresh['t']
#print(threshold)
alpi$select_score_good_cancer_cell_2017_criterion_1 = FALSE
alpi$select_score_good_cancer_cell_2017_criterion_1[which(alpi$APC >= threshold)] = TRUE
#print(dim(alpi))
#print(colnames(alpi))
}

#print(head(alpi,3))
alpi$select_score = alpi$APC
alpi$APC = NULL

#alpi$APC = NULL
# Save pairwise results
if(save.intermediate.files) save(alpi, file=paste(folder,'alpi.RData',sep=''))
out.format = c('name','SFE_1','SFE_2','int_type', 'support_1', 'support_2', 'overlap', 'r_overlap', 'max_overlap', 'direction', 'freq_overlap', 'wMI_p.value', 'ME_p.value', 'wMI_p.value_FDR', 'select_score', 'select_score_good_cancer_cell_2017_criterion_1')
Expand Down Expand Up @@ -238,6 +243,7 @@ select <- function(
save.intermediate.files = TRUE,
randomization.switch.threshold = 30,
max.memory.size=100,
FDR.cutoff=0.1,
calculate_APC_threshold = TRUE,
calculate_FDR = TRUE,
verbose = TRUE
Expand Down Expand Up @@ -296,6 +302,7 @@ select <- function(
save.intermediate.files = save.intermediate.files,
calculate_APC_threshold = calculate_APC_threshold,
calculate_FDR = calculate_FDR,
FDR.thresh=FDR.cutoff,
verbose = verbose,
nbatches = nbatches
)
Expand Down
16 changes: 11 additions & 5 deletions R/select_APC_threshold.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,29 @@ TP.FP.stats <- function(A,res=1000) {
AA$FP = 1 - AA$TN
AA$F1 = 2 * AA$TP / (2 * AA$TP + AA$FN + AA$FP)
AA$MCC = ((AA$TP * AA$TN) - (AA$FP * AA$FN)) / sqrt((AA$TP + AA$FP)*(AA$TP + AA$FN)*(AA$TN + AA$FP)*(AA$TN + AA$FN))
return(as.vector(AA))
return(AA)
}

#' Establish which threshold is the best, using the 95\% of FP exclusion criterion
get_thresh.2 <- function(x, A) {
#print('here')
#print(dim(x))
#print(x[,'FP'])
TP.FP.thresh_v1 = x[x[,'FP'] <= 0.05,,drop=FALSE]
TP.FP.thresh_v2 = x[x[,'FP'] >= 0.05,,drop=FALSE]
if(is.null(x)) return(NA) # there are no solutions at all. return NA
if(is.null(dim(x))) return(NA) # there are no solutions at all. return NA
if(nrow(x)==0) return(NA) # there are no solutions at all. return NA
if(nrow(TP.FP.thresh_v1)==0) return(x[nrow(x),]) # there are no good solutions. Set highest th possible
if(nrow(TP.FP.thresh_v2)==0) return(TP.FP.thresh_v1[1,]) # All solutions are good. Set threshold to minimum score of good solutions
# print('here')
# print(TP.FP.thresh_v1[1,'t'])
#print('here')
#print(TP.FP.thresh_v1[1,'t'])
# print(TP.FP.thresh_v2[nrow(TP.FP.thresh_v2),'t'])
th = (TP.FP.thresh_v1[1,'t'] + TP.FP.thresh_v2[nrow(TP.FP.thresh_v2),'t']) / 2
th = (TP.FP.thresh_v1[1,'t']) # + TP.FP.thresh_v2[nrow(TP.FP.thresh_v2),'t']) / 2
th = TP.FP.thresh_v2[nrow(TP.FP.thresh_v2),'t'] # Set threshold at maximum score associated to FP > 0.05
# print(th)
# print(TP.FP.stat(A, th))
#print(th)
#print(TP.FP.stat(A, th))
return(TP.FP.stat(A, th))
# return(TP.FP.thresh_v1[1,])
}
Expand All @@ -63,7 +66,10 @@ establish_APC_threshold <- function(alpi) {
thresh = rep(NA, 7)
} else {
stats = TP.FP.stats(alpi, 10000)
#print(str(stats))
#print(head(alpi,2))
thresh = get_thresh.2(stats, alpi)
#print(str(thresh))
}
return(list('stats' = stats, thresh = thresh))

Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is the official repository of the R package SELECT - Selected Events Linked
### What is this repository for? ###

* SELECT is a package for inferring evolutionary dependencies between functional alterations in cancer starting from patterns of alteration occurrences in large tumor sample cohorts.
* Last Version: 1.6.3
* Last Version: 1.6.4


### How To ###
Expand All @@ -19,18 +19,19 @@ devtools::install_github("CSOgroup/select")

* How to use
- Check the introduction fom vignettes folder or the website.
- Also refere to *methods section* of papers to know the best way to apply the method.

### Citation ###

If you use this tool, please cite the papers

- Mina, M., Iyer, A., Tavernari, D., Raynaud, F., & Ciriello, G. (2020). Discovering functional evolutionary dependencies in human cancers. Nature Genetics, 52(11), 1198-1207.
- Mina, M., Raynaud, F., Tavernari, D., Battistello, E., Sungalee, S., Saghafinia, S., ... & Ciriello, G. (2017). Conditional selection of genomic alterations dictates cancer evolution and oncogenic dependencies. Cancer cell, 32(2), 155-168.
- Mina, M., Iyer, A., Tavernari, D., Raynaud, F., & Ciriello, G. (2020). [Discovering functional evolutionary dependencies in human cancers](https://www.nature.com/articles/s41588-020-0703-5) Nature Genetics, 52(11), 1198-1207.
- Mina, M., Raynaud, F., Tavernari, D., Battistello, E., Sungalee, S., Saghafinia, S., ... & Ciriello, G. (2017). [Conditional selection of genomic alterations dictates cancer evolution and oncogenic dependencies.](https://www.cell.com/cancer-cell/fulltext/S1535-6108(17)30261-1) Cancer cell, 32(2), 155-168.

### Contribution guidelines ###

- SELECT was originally developed by Marco Mina at the University of Lausanne, Switzerland.
- SELECT is currently maintained by Arvind Iyer from the Computational Systems Oncology lab (CSO) at the University of Lausanne (Unil), Switzerland.
- SELECT was originally developed by **Marco Mina** at the University of Lausanne, Switzerland.
- SELECT is currently maintained by Arvind Iyer and memeber of the Computational Systems Oncology lab (CSO) at the University of Lausanne (Unil), Switzerland.

### Who do I talk to? ###

Expand Down
Binary file added archive/select_1.6.4.tar.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 10 additions & 9 deletions docs/LICENSE.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2317abf

Please sign in to comment.