Skip to content

Commit

Permalink
--no-sv added
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeigurevich committed May 12, 2016
1 parent bcee7ea commit d292de3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 14 deletions.
6 changes: 4 additions & 2 deletions libs/qconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"gene-thresholds= err-fpath= save-json gage eukaryote glimmer no-plots no-html no-check no-check-meta combined-ref no-gc help debug "\
"ambiguity-usage= scaffolds threads= min-cluster= min-alignment= est-ref-size= use-all-alignments gene-finding "\
"strict-NA meta labels= help-hidden no-snps fast max-ref-number= extensive-mis-size= plots-format= " \
"fragmented significant-part-size= unique-mapping " \
"fragmented significant-part-size= unique-mapping no-sv " \
"references-list= sv-bedpe= reads1= reads2= memory-efficient silent version colors= ls=".split()
short_options = "o:G:O:R:t:m:J:jehvda:c:ufl:Lx:i:s1:2:"

Expand Down Expand Up @@ -68,6 +68,7 @@
no_check_meta = False # for metaQUAST, without checking min-contig
unique_mapping = False # for metaQUAST only
no_gc = False
no_sv = False
show_snps = True
glimmer = False
is_combined_ref = False
Expand Down Expand Up @@ -290,7 +291,7 @@ def usage(show_hidden=False, meta=False, short=True):
print >> sys.stderr, " This may significantly reduce memory consumption on large genomes."
print >> sys.stderr, "-1 --reads1 <filename> File with forward reads (in FASTQ format, may be gzipped). "
print >> sys.stderr, "-2 --reads2 <filename> File with reverse reads (in FASTQ format, may be gzipped). "
print >> sys.stderr, " Reads are used for structural variant detection. "
print >> sys.stderr, " Reads are used for structural variation detection and coverage histogram building in Icarus. "
print >> sys.stderr, " --sv-bedpe <filename> File with structural variations (in BEDPE format)"
print >> sys.stderr, ""
print >> sys.stderr, "Speedup options:"
Expand All @@ -299,6 +300,7 @@ def usage(show_hidden=False, meta=False, short=True):
print >> sys.stderr, " --no-html Do not build html reports and Icarus viewers"
print >> sys.stderr, " --no-snps Do not report SNPs (may significantly reduce memory consumption on large genomes)"
print >> sys.stderr, " --no-gc Do not compute GC% and GC-distribution"
print >> sys.stderr, " --no-sv Do not run structural variation detection (make sense only if reads are specified)"
print >> sys.stderr, " --fast A combination of all speedup options except --no-check"
if show_hidden:
print >> sys.stderr, ""
Expand Down
2 changes: 1 addition & 1 deletion libs/qutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def is_exe(fpath):


def is_non_empty_file(fpath):
return os.path.exists(fpath) and os.path.getsize(fpath) > 10
return fpath and os.path.exists(fpath) and os.path.getsize(fpath) > 10


def cat_files(in_fnames, out_fname):
Expand Down
26 changes: 15 additions & 11 deletions libs/reads_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,14 @@ def run_processing_reads(main_ref_fpath, meta_ref_fpaths, ref_labels, reads_fpat
bed_fpath = bed_fpath or os.path.join(res_path, ref_name + '.bed')
cov_fpath = os.path.join(res_path, ref_name + '.cov')

if is_non_empty_file(bed_fpath):
if qconfig.no_sv:
logger.info(' Will not search Structural Variations (--fast or --no-sv is specified)')
bed_fpath = None
elif is_non_empty_file(bed_fpath):
logger.info(' Using existing BED-file: ' + bed_fpath)
if is_non_empty_file(cov_fpath):
logger.info(' Using existing reads coverage file: ' + cov_fpath)
if is_non_empty_file(bed_fpath) and is_non_empty_file(cov_fpath):
if (is_non_empty_file(bed_fpath) or qconfig.no_sv) and is_non_empty_file(cov_fpath):
return bed_fpath, cov_fpath

logger.info(' ' + 'Pre-processing reads...')
Expand Down Expand Up @@ -224,7 +227,7 @@ def run_processing_reads(main_ref_fpath, meta_ref_fpaths, ref_labels, reads_fpat

if not is_non_empty_file(cov_fpath):
cov_fpath = get_coverage(output_dirpath, ref_name, bam_fpath, err_path, cov_fpath)
if not is_non_empty_file(bed_fpath):
if not is_non_empty_file(bed_fpath) and not qconfig.no_sv:
if meta_ref_fpaths:
logger.info(' Splitting SAM-file by references...')
headers = []
Expand Down Expand Up @@ -340,14 +343,15 @@ def run_processing_reads(main_ref_fpath, meta_ref_fpaths, ref_labels, reads_fpat
if os.path.exists(trivial_deletions_fpath) and not is_non_empty_file(bed_fpath):
shutil.copy(trivial_deletions_fpath, bed_fpath)

if is_non_empty_file(bed_fpath):
logger.main_info(' Structural variations are in ' + bed_fpath)
else:
if isfile(bed_fpath):
logger.main_info(' No structural variations were found.')
if not qconfig.no_sv:
if is_non_empty_file(bed_fpath):
logger.main_info(' Structural variations are in ' + bed_fpath)
else:
logger.main_info(' Failed searching structural variations.')
bed_fpath = None
if isfile(bed_fpath):
logger.main_info(' No structural variations were found.')
else:
logger.main_info(' Failed searching structural variations.')
bed_fpath = None
if is_non_empty_file(cov_fpath):
logger.main_info(' Coverage distribution along the reference genome is in ' + cov_fpath)
else:
Expand Down Expand Up @@ -426,7 +430,7 @@ def do(ref_fpath, contigs_fpaths, reads_fpaths, meta_ref_fpaths, output_dir, int
logger.main_info('Failed searching structural variations')
return None, None

if bed_fpath is None and not all_required_binaries_exist(manta_bin_dirpath, 'configManta.py'):
if not qconfig.no_sv and bed_fpath is None and not all_required_binaries_exist(manta_bin_dirpath, 'configManta.py'):
# making
if not os.path.exists(manta_build_dirpath):
os.mkdir(manta_build_dirpath)
Expand Down
2 changes: 2 additions & 0 deletions metaquast.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,8 @@ def main(args):
pass
elif opt == '--no-gc':
pass
elif opt == '--no-sv':
pass
elif opt == '--no-plots':
pass
elif opt == '--no-html':
Expand Down
3 changes: 3 additions & 0 deletions quast.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,10 +572,13 @@ def main(args):

elif opt == '--no-gc':
qconfig.no_gc = True
elif opt == '--no-sv':
qconfig.no_sv = True

elif opt == '--fast': # --no-gc, --no-plots, --no-snps
#qconfig.no_check = True # too risky to include
qconfig.no_gc = True
qconfig.no_sv = True
qconfig.show_snps = False
qconfig.draw_plots = False
qconfig.html_report = False
Expand Down

0 comments on commit d292de3

Please sign in to comment.