##################################### LIBRARIES USED ###############################################library(optparse)library(cDriver)library(devtools)library(R.utils)################################### PARSING COMMAND-LINE ARGUMENTS ##########################################option_list<-list(make_option(c("-d","--dire"),action="store_true",dest="input",type="character",default=FALSE,help="Path to the input directory"),make_option(c("-p","--pat"),action="store_true",dest="patient",type="character",default=FALSE,help="Patient ID"))opt<-parse_args(OptionParser(option_list=option_list),args=commandArgs(trailingOnly=TRUE))###################################### RUNNING CCF FROM cDriver ################################################ Argumentsin_dir=opt$inputpat=opt$patientsetwd(paste(in_dir,pat,"CCF_estimation",sep='/'))# Read and run CCF from cDriver to estimate CCFsample<-read.csv("ccf_input.txt",header=TRUE,sep="\t")sample_ccf<-CCF(sample.mutations=sample,VAF=NULL,ploidy=NULL,CCF_CNV=NULL,purity=NULL,correct=TRUE)# Write resultsfile.create('snv_ccf_cdriver.txt')write.table(sample_ccf,file='snv_ccf_cdriver.txt',sep='\t',append=TRUE,row.names=FALSE)# Read and run CCF from cDriver to estimate CAFsample<-read.csv("caf_input.txt",header=TRUE,sep="\t")sample_ccf<-CCF(sample.mutations=sample,VAF=NULL,ploidy=NULL,CCF_CNV=NULL,purity=NULL,correct=TRUE)# Write resultsfile.create('snv_caf_cdriver.txt')write.table(sample_ccf,file='snv_caf_cdriver.txt',sep='\t',append=TRUE,row.names=FALSE)