JaneliaSciComp / msg

Multiplexed Shotgun Genotyping
http://genomics.princeton.edu/AndolfattoLab/MSG.html
11 stars 12 forks source link

summaryPlots.R - On memory error in thinning - should show helpful message #30

Open gregpinero opened 12 years ago

gregpinero commented 12 years ago

I believe the error is happening in this line (but I'm not positive): pp.thin <- pp2.thin <- get.ancestry.probs("par2", thinfac=thinfac, difffac=difffac, contigs=contigs2plot, pna.thresh=pna.thresh, type="thinned_plot")

Change this call to run inside of R's tryCatch function [1] . On error, have it set current_contigs to be empty so further program flow will hit the helpful message.

[1] http://mazamascience.com/WorkingWithData/?p=912

Original Error Report (pasted from Email):

run3 throws an error

Error: cannot allocate vector of size 8.2 Gb Execution halted

This happens after the data are thinned to plot a 2D graph of linkage, but before plotting. Here is the output, it dies after thinning.


[login - nn@nnn]~/nnn/BCT/msgOut.21652>cat msgRun3.21652.o5125870 Input parameters for summaryPlots.R opts <-structure(list(c = "2,3,4,X", p = "2,3,4,X", d = "hmm_fit", t = "1", f = ".01", b = "BCT.txt", n = ".05"), .Names = c("c", "p", "d", "t", "f", "b", "n")) Extracting markers for the following contigs: 2,3,4,Xall par1: Numbers of markers after removal for high missing data proportion (%NA<1): 2 3 4 X "171919/171919" "190471/190471" "1580/1580" "72879/72879" all par2: Numbers of markers after removal for high missing data proportion (%NA<1): 2 3 4 X "171919/171919" "190471/190471" "1580/1580" "72879/72879"

Off-diagonal LOD profile... plot par1: Numbers of markers after removal for high missing data proportion (%NA<1): 2 3 4 X "171919/171919" "190471/190471" "1580/1580" "72879/72879" plot par2: Numbers of markers after removal for high missing data proportion (%NA<1): 2 3 4 X "171919/171919" "190471/190471" "1580/1580" "72879/72879" null device 1 null device 1 null device 1

Thinning ancestry probabilities... thinned_plot par2: Numbers of markers after removal for high missing data proportion (%NA<0.05): 2 3 4 X "12831/12854" "15471/15475" "116/191" "4704/4705"


In a situation like this, the code (in SummaryPlots.R) is supposed to print the error

cat("Unable to create thinned lod-matrix.bmp plot: Try increasing pna.thresh (",pna.thresh,") or decreasing difffac (",difffac,")\n",sep="")

Which, in fact, is the solution. It appears to have crashed inelegantly, rather than print this error.

Also, we need to add back the difffac and thinfac options to msg.cfg.