11# !/usr/bin/Rscript
22
3- # Library
43library(signature.tools.lib )
54library(" optparse" )
65
7- # ####INPUT
8-
9- # ##
106option_list = list (
117 make_option(c(" -i" , " --input_file" ), type = " character" , default = NULL ,
128 help = " Matrix of counts" , metavar = " character" ),
@@ -23,38 +19,36 @@ if (is.null(opt$input_file) | is.null(opt$output_dir) ){
2319 stop(" Missing some input arguments... Exiting..." , call. = FALSE )
2420}
2521
26- # ## Set seed
22+ # # Set seed used to match expected output
2723set.seed(164 )
2824
29- # #### Input variables
25+ # # Input variables
3026DIR_RES <- opt $ output_dir
3127INPUT_MAT <- opt $ input_file
3228
33- # Import variables
29+ # # Import matrix of counts
3430mut_mat_ICGC <- read.table(INPUT_MAT , row.names = 1 , header = TRUE )
3531
36- # # Function for extracting signatures
37- extractSignatures <- function (input_matrix , sig_matrix ) {
32+ # # Function for signature attribution
33+ assignSignatures <- function (input_matrix , sig_matrix ) {
3834
35+ # # use Fit function, FitMS is still undergoing testing
3936 subs_fit_res <- signature.tools.lib :: Fit(catalogues = input_matrix ,
4037 exposureFilterType = " giniScaledThreshold" ,
4138 signatures = sig_matrix ,
4239 useBootstrap = TRUE ,
4340 nboot = 100 ,
4441 nparallel = 6 )
45- # Save
46- # snv_exp <- subs_fit_res$E_median_filtered
47- # Return
4842 return (subs_fit_res )
4943}
5044
51-
52- # Extract the signatures
53- sign_res <- extractSignatures (mut_mat_ICGC , COSMIC30_subs_signatures )
45+ # # Assign the signatures
46+ # # Currently testing with COSMIC 30 signatures (To update)
47+ sign_res <- assignSignatures (mut_mat_ICGC , COSMIC30_subs_signatures )
5448
5549# ## Save output as JSON
56- fitToJSON(sign_res ,
57- paste0(DIR_RES , " /export_signatures .json" ) )
50+ signature.tools.lib :: fitToJSON(sign_res ,
51+ paste0(DIR_RES , " /export_assignments .json" ) )
5852
5953
60-
54+
0 commit comments