Skip to content

Commit 779ed83

Browse files
committed
Refactor how mp_chooser is specified
1 parent 689dc15 commit 779ed83

File tree

3 files changed

+25
-24
lines changed

3 files changed

+25
-24
lines changed

Extract details from StatPackets/ExtractPVals.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ DRSummaryAcross = function(x) {
367367

368368

369369
########## Main function
370-
f = function(start, end, file = 'Index_DR101_V1.txt') {
370+
f = function(start, end, file = 'Index_DR101_V1.txt', mp_chooser_file = mp_chooser_file) {
371371
if (is.na(end))
372372
end = start
373373
ofname = paste0('R', '_', start, '-', end, '_pval.tsv')
@@ -421,12 +421,14 @@ f = function(start, end, file = 'Index_DR101_V1.txt') {
421421
stringsAsFactors = FALSE
422422
)
423423
rN = DRrequiredAgeing:::annotationChooser(statpacket = r0,
424-
level = .0001)
424+
level = .0001,
425+
mp_chooser_file = mp_chooser_file)
425426
rW = DRrequiredAgeing:::annotationChooser(
426427
statpacket = r0,
427428
level = .0001,
428429
resultKey = 'Windowed result',
429-
TermKey = 'WMPTERM'
430+
TermKey = 'WMPTERM',
431+
mp_chooser_file = mp_chooser_file
430432
)
431433

432434

@@ -758,7 +760,7 @@ makejobs = function(path = getwd()) {
758760
#makejobs()
759761
#qvalue2AllZips()
760762
#parameter2qvalue(args[1], args[2])
761-
ignore.my.name = f(start = as.numeric(args[1]), end = as.numeric(args[2]),file = args[3])
763+
ignore.my.name = f(start = as.numeric(args[1]), end = as.numeric(args[2]), file = args[3], mp_chooser_file = args[4])
762764

763765

764766

Extract details from StatPackets/ExtractPValsPhenStat.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ makejobs = function(path = getwd()) {
661661
#makejobs()
662662
#qvalue2AllZips()
663663
#parameter2qvalue(args[1], args[2])
664-
ignore.my.name = f(start = as.numeric(args[1]), end = as.numeric(args[2]),file = args[3])
664+
ignore.my.name = f(start = as.numeric(args[1]), end = as.numeric(args[2]), file = args[3])
665665

666666

667667

Late adults stats pipeline/DRrequiredAgeing/DRrequiredAgeingPackage/R/sideFunctions.R

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4912,7 +4912,8 @@ StatsPipeline = function(path = getwd(),
49124912

49134913
IMPC_statspipelinePostProcess = function(SP.results = getwd(),
49144914
waitUntillSee = 'impc_stats_pipeline_job',
4915-
ignoreThisLineInWaitingCheck = 0) {
4915+
ignoreThisLineInWaitingCheck = 0,
4916+
mp_chooser_file = NULL) {
49164917

49174918
DRrequiredAgeing:::message0('Step 1: Clean ups and creating the global index of results')
49184919
DRrequiredAgeing:::message0('Zipping the logs ...')
@@ -4952,7 +4953,7 @@ IMPC_statspipelinePostProcess = function(SP.results = getwd(),
49524953
setwd(file.path(SP.results, 'ExtractPvalues'))
49534954
system('cp ../SingleIndeces/AllResultsIndeces.txt .', wait = TRUE)
49544955

4955-
DRrequiredAgeing:::splitIndexFileIntoPiecesForPvalueExtraction(indexFilePath = 'AllResultsIndeces.txt')
4956+
DRrequiredAgeing:::splitIndexFileIntoPiecesForPvalueExtraction(indexFilePath = 'AllResultsIndeces.txt', mp_chooser_file = mp_chooser_file)
49564957
system('chmod 775 ExtractPValJobs.bch', wait = TRUE)
49574958
system('rm -f ExtractPVals.R',wait = TRUE)
49584959
system(
@@ -5965,7 +5966,7 @@ annotationChooser = function(statpacket = NULL,
59655966
rrlevel = .005,
59665967
TermKey = 'MPTERM',
59675968
resultKey = 'Normal result',
5968-
mp_chooser_file = 'mp_chooser.json.Rdata') {
5969+
mp_chooser_file = NULL) {
59695970
requireNamespace('RPostgreSQL')
59705971
requireNamespace('data.table')
59715972
requireNamespace("data.table")
@@ -5999,7 +6000,7 @@ annotationChooser = function(statpacket = NULL,
59996000
)
60006001
##################################################################
60016002
message('\t Reading the index file ...')
6002-
load(file.path(local(),'annotation',mp_chooser_file))
6003+
load(mp_chooser_file)
60036004
message(
60046005
'\t~>',
60056006
paste(
@@ -6228,7 +6229,8 @@ splitIndexFileIntoPiecesForPvalueExtraction = function(indexFilePath = NULL,
62286229
split = 1500,
62296230
mem = "9G",
62306231
time = "2-00",
6231-
outputfile = 'ExtractPValJobs.bch') {
6232+
outputfile = 'ExtractPValJobs.bch',
6233+
mp_chooser_file = NULL) {
62326234
ldf = length(readLines(indexFilePath))
62336235
ind = round(seq(1, ldf, length.out = split))
62346236

@@ -6260,6 +6262,8 @@ splitIndexFileIntoPiecesForPvalueExtraction = function(indexFilePath = NULL,
62606262
ind[i] - 1,
62616263
' "',
62626264
indexFilePath,
6265+
'" "',
6266+
mp_chooser_file,
62636267
'"',
62646268
"'",
62656269
sep = ''
@@ -6298,7 +6302,7 @@ IMPC_HadoopLoad = function(SP.results = getwd(),
62986302
waitUntillSee = 'impc_stats_pipeline_job',
62996303
ignoreThisLineInWaitingCheck = 0,
63006304
###
6301-
mp_chooser_file = 'mp_chooser.json.Rdata',
6305+
mp_chooser_file = NULL,
63026306
host = "hh-hdp-master-02.ebi.ac.uk",
63036307
path = 'impc/statpackets',
63046308
prefix = 'DRXXX_',
@@ -6376,6 +6380,14 @@ IMPC_HadoopLoad = function(SP.results = getwd(),
63766380
DRrequiredAgeing:::message0('Writing the config file ...')
63776381
save(configlist,file = 'configHadoop.Rdata')
63786382

6383+
if (is.null(mp_chooser_file) || !file.exists(mp_chooser_file)) {
6384+
DRrequiredAgeing:::message0(
6385+
'ERROR: mp_chooser not found at location\n\t',
6386+
mp_chooser_file
6387+
)
6388+
quit()
6389+
}
6390+
63796391
DRrequiredAgeing:::annotationIndexCreator(
63806392
path = getwd(),
63816393
pattern = 'split_index',
@@ -6385,19 +6397,6 @@ IMPC_HadoopLoad = function(SP.results = getwd(),
63856397
)
63866398
system('chmod 775 annotation_jobs.bch', wait = TRUE)
63876399

6388-
6389-
if (is.null(mp_chooser_file) || !file.exists(file.path(DRrequiredAgeing:::local(), 'annotation', mp_chooser_file))) {
6390-
DRrequiredAgeing:::message0(
6391-
'mp_chooser not found\n\t',
6392-
file.path(DRrequiredAgeing:::local(), 'annotation', mp_chooser_file)
6393-
)
6394-
mp_chooser_file = 'mp_chooser.json.Rdata'
6395-
DRrequiredAgeing:::message0(
6396-
'mp_chooser defaulted to \n',
6397-
file.path(DRrequiredAgeing:::local(), 'annotation', mp_chooser_file)
6398-
)
6399-
}
6400-
64016400
DRrequiredAgeing:::message0('Downloading the action script ...')
64026401
system(
64036402
'wget -O loader.R https://raw.githubusercontent.com/mpi2/impc_stats_pipeline/dev/IMPC%20annotation%20pipeline/loaderHadoop.R',

0 commit comments

Comments
 (0)