<commit_before>"""
Created on March 17, 2015
Description: Runs the delly program on case and control bam file to give its results
@author: <NAME>
"""
"""
::Inputs::
delly:Path to delly executables (0.7.3 or above)
bcftools:Path to bcftools executables (1.3.1 or above)
type: What ot run in delly, DEL:Deletion, DUP: Duplication,TRA:Translocation, INV:Inversion
reference: Reference Genome that was used to align the reads.
controlBam: Path to control/normal bam file
caseBam: Path to case/tumor bam file
controlID: Id of the control/normal sample
caseID: Id of the case/tumor sample
mapq: mapping quality cutoff for delly
excludeRegions: Regions to be excluded for calling structural variation.
outputdir: directory for the output of delly
debug: If you just wish to test what we will do
::Output::
VCF file having all the structural variants called
"""

import os
import sys
from subprocess import Popen
import shlex
import time
from datetime import date, timedelta
import checkparameters as cp
import makebamindex as mbi
import logging
# This function will run delly based on given inputs


def run(
        delly,
        version,
        bcftools,
        analysisType,
        reference,
        controlBam,
        caseBam,
        caseId,
        mapq,
        excludeRegions,
        outputdir,
        verbose,
        version,
        debug):
    start_time = time.time()
    if(verbose):
        logging.info("Run_Delly: We are now going to run Delly for you. It going to be exciting time.")
    myPid = os.getpid()
    day = date.today()
    today = day.isoformat()
    tag = analysisType.lower()
    outputBcf = outputdir + "/" + caseId + "_" + tag + ".bcf"
    outputVcf = outputdir + "/" + caseId + "_" + tag + ".vcf"
    # Check all input variables
    cp.checkFile(controlBam)
    cp.checkFile(caseBam)
    cp.checkFile(delly)
    cp.checkFile(bcftools)
    cp.checkFile(reference)
    cp.checkFile(excludeRegions)
    cp.checkDir(outputdir)
    cp.checkInt(mapq, "Delly MAPQ")
    cp.checkEmpty(caseId, "Delly Case BAM ID")
    cp.checkDellyAnalysisType(analysisType)
    if(verbose):
        logging.info("Run_Delly: All the input parameters look good for running delly")
        logging.info("Run_Delly: ProcessID:%s,Date:%s", myPid, today)
    if(debug):
        cmd = delly + " -t " + analysisType + " -g " + reference + " -x " + excludeRegions + \
            " -q " + str(mapq) + " -o " + outputBcf + " " + caseBam + " " + controlBam
        logging.debug("Run_Delly: Command that will be run %s", cmd)
    else:
        # Check if bam index files are there else make them
        controlBai = controlBam + ".bai"<commit_msg>bug fixes<commit_after>"""
Created on March 17, 2015
Description: Runs the delly program on case and control bam file to give its results
@author: <NAME>
"""
"""
::Inputs::
delly:Path to delly executables (0.7.3 or above)
bcftools:Path to bcftools executables (1.3.1 or above)
type: What ot run in delly, DEL:Deletion, DUP: Duplication,TRA:Translocation, INV:Inversion
reference: Reference Genome that was used to align the reads.
controlBam: Path to control/normal bam file
caseBam: Path to case/tumor bam file
controlID: Id of the control/normal sample
caseID: Id of the case/tumor sample
mapq: mapping quality cutoff for delly
excludeRegions: Regions to be excluded for calling structural variation.
outputdir: directory for the output of delly
debug: If you just wish to test what we will do
::Output::
VCF file having all the structural variants called
"""

import os
import sys
from subprocess import Popen
import shlex
import time
from datetime import date, timedelta
import checkparameters as cp
import makebamindex as mbi
import logging
# This function will run delly based on given inputs


def run(
        delly,
        version,
        bcftools,
        analysisType,
        reference,
        controlBam,
        caseBam,
        caseId,
        mapq,
        excludeRegions,
        outputdir,
        verbose,
        debug):
    start_time = time.time()
    if(verbose):
        logging.info("Run_Delly: We are now going to run Delly for you. It going to be exciting time.")
    myPid = os.getpid()
    day = date.today()
    today = day.isoformat()
    tag = analysisType.lower()
    outputBcf = outputdir + "/" + caseId + "_" + tag + ".bcf"
    outputVcf = outputdir + "/" + caseId + "_" + tag + ".vcf"
    # Check all input variables
    cp.checkFile(controlBam)
    cp.checkFile(caseBam)
    cp.checkFile(delly)
    cp.checkFile(bcftools)
    cp.checkFile(reference)
    cp.checkFile(excludeRegions)
    cp.checkDir(outputdir)
    cp.checkInt(mapq, "Delly MAPQ")
    cp.checkEmpty(caseId, "Delly Case BAM ID")
    cp.checkDellyAnalysisType(analysisType)
    if(verbose):
        logging.info("Run_Delly: All the input parameters look good for running delly")
        logging.info("Run_Delly: ProcessID:%s,Date:%s", myPid, today)
    if(debug):
        cmd = delly + " -t " + analysisType + " -g " + reference + " -x " + excludeRegions + \
            " -q " + str(mapq) + " -o " + outputBcf + " " + caseBam + " " + controlBam
        logging.debug("Run_Delly: Command that will be run %s", cmd)
    else:
        # Check if bam index files are there else make them
        controlBai = controlBam + ".bai"
{'fraction_non_alphanumeric': 0.09607731665719159, 'fraction_numerical': 0.0045480386583285955, 'mean_word_length': 3.0444444444444443, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4471162', 'n_tokens_mistral': 1679, 'n_tokens_neox': 1635, 'n_words': 569}