Skip to content

Commit

Permalink
tilde expansion for vcf filename
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob-Munro-VCCRI committed Feb 20, 2017
1 parent be25f2a commit d1c1484
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
17 changes: 9 additions & 8 deletions SVPV
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ from __future__ import print_function
import sys
import os
import re
from os.path import expanduser as expu
from svpv.vcf import VCFManager, BCFtools
from svpv.sam import SAMtools
from svpv.refgene import RefgeneManager
Expand Down Expand Up @@ -131,9 +132,9 @@ class Params:
elif a == '-manifest':
if self.run.samples or self.run.bams:
print("samples and alignments provided as command line arguments overriden by manifest file\n")
self.run.read_samples_file(args[i + 1])
self.run.read_samples_file(expu(args[i + 1]))
elif a == '-o':
self.run.out_dir = args[i + 1]
self.run.out_dir = expu(args[i + 1])
elif a == '-gui':
self.run.gui = True
elif a == '-disp':
Expand All @@ -147,15 +148,15 @@ class Params:
elif a == '-n_bins':
self.run.num_bins = int(args[i + 1])
elif a == '-fa':
check_file_exists(args[i + 1])
self.run.fa = args[i + 1]
check_file_exists(expu(args[i + 1]))
self.run.fa = expu(args[i + 1])
elif a == '-ref_gene':
self.run.ref_genes = RefgeneManager(args[i + 1])
self.filter.ref_genes = self.run.ref_genes
elif a == '-ref_vcf':
if ':' in args[i + 1]:
check_file_exists(args[i + 1].split(':')[1])
self.run.ref_vcf = VCFManager(args[i + 1].split(':')[1], name=args[i + 1].split(':')[0], db_mode=True)
check_file_exists(expu(args[i + 1].split(':')[1]))
self.run.ref_vcf = VCFManager(expu(args[i + 1].split(':')[1]), name=args[i + 1].split(':')[0], db_mode=True)
else:
check_file_exists(args[i + 1])
self.run.ref_vcf = VCFManager(args[i + 1], name='reference', db_mode=True)
Expand Down Expand Up @@ -339,8 +340,8 @@ class RunParams:
def set_vcfs(self, vcfs_arg):
for sv_vcf in vcfs_arg.split(','):
if ':' in sv_vcf:
check_file_exists(sv_vcf.split(':')[1])
vcf = VCFManager(sv_vcf.split(':')[1], name=sv_vcf.split(':')[0])
check_file_exists(expu(sv_vcf.split(':')[1]))
vcf = VCFManager(expu(sv_vcf.split(':')[1]), name=sv_vcf.split(':')[0])
else:
check_file_exists(sv_vcf)
vcf = VCFManager(sv_vcf)
Expand Down
4 changes: 3 additions & 1 deletion svpv/svpv.r
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,9 @@ get_units <- function(num_bp) {
# heuristic for avoiding errors when determing insert size upper
estimate_ylim <- function(ins) {
sorted <- sort(ins)
return(1.1 * sorted[floor(length(sorted) * 0.985)])
ylim <- 1.1 * sorted[floor(length(sorted) * 0.985)]
if (length(ylim) < 1) { ylim <- 500}
return(ylim)
}
plot_insert_sizes <- function(params, ins, ylim, num_y_bins=10){
# organise sensible units for ticks on plot
Expand Down

0 comments on commit d1c1484

Please sign in to comment.