def test_run_sambamba(): bam = 'tests/fixtures/ccds.mini.sorted.bam' bed = 'tests/fixtures/CCDS.mini.bed' out = '/tmp/ccds.coverage.bed' thresholds = (10, 20) run_sambamba(bam, bed, outfile=out, cov_treshold=thresholds) assert os.path.exists(out)
def sambamba(): """Run Sambamba for an alignment.""" bam_file = request.form['bam'] region_bed = request.form['bed'] cov_thresholds = request.form.getlist('threshold') out_file = request.form['out'] run_sambamba(bam_file, region_bed, out_file, cov_thresholds) return jsonify(success=True)
def sambamba(context, bam_file, exon_bed, gene_bed, cov_treshold, outfile): """Run Sambamba from chanjo.""" logger = logging.getLogger(__name__) # For testing only: logger = logging.getLogger("chanjo.cli.sambamba") logger.info("Running chanjo sambamba") if not (exon_bed or gene_bed): logger.warning("Please provide a region file in BED format") sys.exit() if exon_bed and gene_bed: logger.warning("Only one region file at a time") sys.exit() region_file = exon_bed if gene_bed: region_file = gene_bed try: run_sambamba(bam_file, region_file, outfile, cov_treshold) except Exception as e: logger.debug(e) click.Abort()