Skip to content

Commit

Permalink
Circos: added gene density, mismatches, coverage tracks, cosmetic cha…
Browse files Browse the repository at this point in the history
…nges
  • Loading branch information
almiheenko committed Aug 14, 2017
1 parent 23490ee commit e0e6212
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 62 deletions.
4 changes: 2 additions & 2 deletions quast.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def main(args):
report_for_icarus_fpath_pattern = None
stdout_pattern = None
draw_alignment_plots = qconfig.draw_svg or qconfig.create_icarus_html
draw_circos_plot = qconfig.draw_plots and ref_fpath
draw_circos_plot = qconfig.draw_plots and ref_fpath and len(aligned_contigs_fpaths)
number_of_steps = sum([int(bool(value)) for value in [draw_alignment_plots, draw_circos_plot, all_pdf_fpath]])
if draw_alignment_plots:
########################################################################
Expand All @@ -255,7 +255,7 @@ def main(args):
if draw_circos_plot:
logger.main_info(' %d of %d: Creating Circos plots...' % (2 if draw_alignment_plots else 1, number_of_steps))
circos_png_fpath = circos.do(ref_fpath, contigs_fpaths, report_for_icarus_fpath_pattern, circos_gc_fpath,
features_containers, os.path.join(output_dirpath, 'circos'), logger)
features_containers, cov_fpath, os.path.join(output_dirpath, 'circos'), logger)

if all_pdf_fpath:
# full report in PDF format: all tables and plots
Expand Down
12 changes: 6 additions & 6 deletions quast_libs/basic_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from os.path import join

from quast_libs import fastaparser, qconfig, qutils, reporting, plotter
from quast_libs.circos import set_window_size
from quast_libs.log import get_logger
logger = get_logger(qconfig.LOGGER_DEFAULT_NAME)

Expand Down Expand Up @@ -81,14 +82,13 @@ def save_icarus_GC(ref_fpath, gc_fpath):


def save_circos_GC(ref_fpath, reference_length, gc_fpath):
max_points = 25000
n = min(20000, max(100, reference_length // max_points))
window_size = set_window_size(reference_length)
with open(gc_fpath, 'w') as out_f:
for name, seq_full in fastaparser.read_fasta(ref_fpath):
for i in range(0, len(seq_full), n):
seq = seq_full[i:i + n]
GC_percent = get_GC_percent(seq, n)
out_f.write('\t'.join([name, str(i), str(i + n), str(GC_percent) + '\n']))
for i in range(0, len(seq_full), window_size):
seq = seq_full[i:i + window_size]
GC_percent = get_GC_percent(seq, window_size)
out_f.write('\t'.join([name, str(i), str(i + window_size), str(GC_percent) + '\n']))


def binning_coverage(cov_values, nums_contigs):
Expand Down
Loading

0 comments on commit e0e6212

Please sign in to comment.