-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
correctInvertedRegionPhasing() always ends with a list of warnings about unused connections being closed. I think this is a minor bug (rather than something system-specific) because I tested it on a Linux server and on a Windows laptop with the newest R and StrandPhaseR versions. I was running this on GIAB's HG002 Strand-seq data and their v4.2.1 small variant benchmark.
The warnings look like this (edit: I put the traceback() at the bottom of this issue):
Warning messages:
1: In for (i in seq_len(n)) { ... :
closing unused connection 3 (./SPR_output/VCFfiles/chr1_phased_INVcorr.vcf)
2: In for (i in seq_len(n)) { ... :
closing unused connection 3 (./SPR_output/VCFfiles/chr1_phased_INVcorr.vcf)
3: In for (i in seq_len(n)) { ... :
closing unused connection 3 (./SPR_output/VCFfiles/chr1_phased_INVcorr.vcf)
4: In for (i in seq_len(n)) { ... :
closing unused connection 3 (./SPR_output/VCFfiles/chr1_phased_INVcorr.vcf)
5: In for (i in seq_len(n)) { ... :
closing unused connection 3 (./SPR_output/VCFfiles/chr1_phased_INVcorr.vcf)
6: In for (i in seq_len(n)) { ... :
closing unused connection 3 (./SPR_output/VCFfiles/chr1_phased_INVcorr.vcf)
7: In UseMethod("anyDuplicated") :
closing unused connection 3 (./SPR_output/VCFfiles/chr1_phased_INVcorr.vcf)
8: In for (i in seq_len(n)) { ... :
closing unused connection 4 (./SPR_output/VCFfiles/chr1_phased_INVcorr.vcf)
9: In for (i in seq_along(slots)) { ... :
closing unused connection 3 (./SPR_output/VCFfiles/chr1_phased_INVcorr.vcf)
10: In for (i in (1L:cols)[do]) { ... :
closing unused connection 3 (./SPR_output/VCFfiles/chr2_phased_INVcorr.vcf)
11: In for (i in (1L:cols)[do]) { ... :
closing unused connection 3 (./SPR_output/VCFfiles/chr2_phased_INVcorr.vcf)
12: In standardGeneric("get") :
closing unused connection 3 (./SPR_output/VCFfiles/chr3_phased_INVcorr.vcf)
13: In .Internal(anyDuplicated(x, incomparables, fromLast)) :
closing unused connection 3 (./SPR_output/VCFfiles/chr3_phased_INVcorr.vcf)
14: In for (i in (1L:cols)[do]) { ... :
closing unused connection 3 (./SPR_output/VCFfiles/chr8_phased_INVcorr.vcf)
The code I ran looks like this:
suppressPackageStartupMessages(library("breakpointR"))
suppressPackageStartupMessages(library("StrandPhaseR"))
suppressPackageStartupMessages(library("BSgenome.Hsapiens.UCSC.hg38"))
breakpointr(
inputfolder = "./",
outputfolder = "./BPR_output",
pairedEndReads = TRUE,
numCPU = 4,
windowsize = 2000000,
binMethod = "size",
chromosomes = c("chr1","chr2","chr3","chr8"),
background = 0.1,
maskRegions = "blacklist.highdepth.centromeres.bed"
)
exportRegions("./BPR_output/data", file = "wc_regions.txt", collapseInversions = FALSE,
minRegionSize = 5000000, state = "wc")
strandPhaseR(
inputfolder = "./",
outputfolder = "./SPR_output",
numCPU = 4,
positions = "./HG002_GRCh38_1_22_v4.2.1_benchmark.vcf.gz",
WCregions = "wc_regions.txt",
chromosomes = c("chr1","chr2","chr3","chr8"),
num.iterations = 3,
exportVCF = "HG002",
bsGenome = "BSgenome.Hsapiens.UCSC.hg38",
splitPhasedReads = TRUE,
assume.biallelic = TRUE,
pairedEndReads = TRUE
)
r <- read.table("./blacklist.highdepth.centromeres.bed")
mask <- makeGRangesFromDataFrame(r,seqnames.field="V1", end.field="V3", start.field="V2")
correctInvertedRegionPhasing(
outputfolder = "./SPR_output/VCFfiles",
inv.bed = "./gm24385.inversions.bed",
strandphaseR.data = "./SPR_output/data",
breakpointR.data = "./BPR_output/data",
vcfs.files = "./SPR_output/VCFfiles",
snv.positions = "./HG002_GRCh38_1_22_v4.2.1_benchmark.vcf.gz",
input.bams = "./HG002_inversion_phasing_test",
chromosomes = c("chr1","chr2","chr3","chr8"),
bsGenome = "BSgenome.Hsapiens.UCSC.hg38",
recall.phased = TRUE,
het.genotype = "lenient",
pairedEndReads = TRUE,
min.mapq = 10,
background = 0.1,
lookup.bp = 1000000,
assume.biallelic = TRUE,
lookup.blacklist = mask
)
When I run the script with options(warn=2) and traceback(), I get the following output, which suggests that a read.table command in vcf2ranges might be implicated in at least one of the warnings:
correcting phase at inversions ...Error in for (i in (1L:cols)[do]) { :
(converted from warning) closing unused connection 3 (test/SPR_output/VCFfiles/chr15_phased_INVcorr.vcf)
Backtrace:
1: doWithOneRestart(return(expr), restart)
2: withOneRestart(expr, restarts[[1L]])
3: withRestarts({
4: .signalSimpleWarning("closing unused connection 3 (test/SPR_output/VCFfiles/chr15_phased_INVcorr.vcf)",
5: read.table(vcfFile, stringsAsFactors = FALSE, fill = TRUE)
6: vcf2ranges(vcfFile = snv.positions, genotypeField = 1, chromosome = chromosome)
7: withCallingHandlers(expr, message = function(c) if (inherits(c,
8: suppressMessages(vcf2ranges(vcfFile = snv.positions, genotypeField = 1,
9: phaseHETinversion(input.bams = input.bams, snv.positions = snv.positions,
10: correctInvertedRegionPhasing(outputfolder = file.path(args$output_folder,
11: withCallingHandlers(expr, message = function(c) if (inherits(c,
12: suppressMessages(correctInvertedRegionPhasing(outputfolder = file.path(args$output_folder,
Metadata
Metadata
Assignees
Labels
No labels