Skip to content

Commit

Permalink
fix to sporadic output read failure
Browse files Browse the repository at this point in the history
  • Loading branch information
oganm committed Oct 15, 2024
1 parent 3f848c0 commit 703635e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions R/readErmineJOutput.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@
readErmineJOutput = function(output){
fileHead = readLines(output,100,warn = FALSE)
dataStart = fileHead %>% grep(x = .,pattern = '#!') %>% max
cn = c("#!", "Name", "ID", "NumProbes", "NumGenes", "RawScore", "Pval",
"CorrectedPvalue", "MFPvalue", "CorrectedMFPvalue", "Multifunctionality",
"Same as", "GeneMembers","")
frame = suppressMessages(suppressWarnings(
readr::read_tsv(output,skip = dataStart-1,col_names=TRUE)
readr::read_tsv(output,skip = dataStart,col_names=cn)
))

if(!is.numeric(frame$Pval)){
frame = suppressMessages(suppressWarnings(
readr::read_tsv(output,skip = dataStart-1,col_names=TRUE, locale = readr::locale(decimal_mark = ','))
readr::read_tsv(output,skip = dataStart,col_names=cn, locale = readr::locale(decimal_mark = ','))
))
}
frame = frame[1:(nrow(frame)-1),2:ncol(frame)]
frame = frame[,2:(ncol(frame)-1)]

settingsStart = fileHead %>% grep(x = .,pattern = 'Settings')
settingsEnd = fileHead %>% grep(x = .,pattern = '#!----')
Expand Down

0 comments on commit 703635e

Please sign in to comment.