def summary(*samples):
    """Run SignatureCompareRelatedSimple module from qsignature tool.

    Creates a matrix of pairwise comparison among samples. The
    function will not run if the output exists

    :param samples: list with only one element containing all samples information
    :returns: (dict) with the path of the output to be joined to summary
    """
    warnings, similar = [], []
    qsig = config_utils.get_program("qsignature", samples[0][0]["config"])
    if not qsig:
        return [[]]
    res_qsig = config_utils.get_resources("qsignature", samples[0][0]["config"])
    jvm_opts = " ".join(res_qsig.get("jvm_opts", ["-Xms750m", "-Xmx8g"]))
    work_dir = samples[0][0]["dirs"]["work"]
    count = 0
    for data in samples:
        data = data[0]
        vcf = tz.get_in(["summary", "qc", "qsignature", "base"], data)
        if vcf:
            count += 1
            vcf_name = dd.get_sample_name(data) + ".qsig.vcf"
            out_dir = utils.safe_makedir(os.path.join(work_dir, "qsignature"))
            if not os.path.lexists(os.path.join(out_dir, vcf_name)):
                os.symlink(vcf, os.path.join(out_dir, vcf_name))
    if count > 0:
        qc_out_dir = utils.safe_makedir(os.path.join(work_dir, "qc", "qsignature"))
        out_file = os.path.join(qc_out_dir, "qsignature.xml")
        out_ma_file = os.path.join(qc_out_dir, "qsignature.ma")
        out_warn_file = os.path.join(qc_out_dir, "qsignature.warnings")
        log = os.path.join(work_dir, "qsignature", "qsig-summary.log")
        if not os.path.exists(out_file):
            with file_transaction(samples[0][0], out_file) as file_txt_out:
                base_cmd = ("{qsig} {jvm_opts} "
                            "org.qcmg.sig.SignatureCompareRelatedSimple "
                            "-log {log} -dir {out_dir} "
                            "-o {file_txt_out} ")
                do.run(base_cmd.format(**locals()), "qsignature score calculation")
        error, warnings, similar = _parse_qsignature_output(out_file, out_ma_file,
                                                            out_warn_file, samples[0][0])
        return [{'total samples': count,
                 'similar samples pairs': len(similar),
                 'warnings samples pairs': len(warnings),
                 'error samples': list(error),
                 'out_dir': qc_out_dir}]
    else:
        return []
def summary ( * samples ) : warnings , similar = [ ] , [ ] qsig = config_utils . get_program ( "qsignature" , samples [ 0 ] [ 0 ] [ "config" ] ) if not qsig : return [ [ ] ] res_qsig = config_utils . get_resources ( "qsignature" , samples [ 0 ] [ 0 ] [ "config" ] ) jvm_opts = " " . join ( res_qsig . get ( "jvm_opts" , [ "-Xms750m" , "-Xmx8g" ] ) ) work_dir = samples [ 0 ] [ 0 ] [ "dirs" ] [ "work" ] count = 0 for data in samples : data = data [ 0 ] vcf = tz . get_in ( [ "summary" , "qc" , "qsignature" , "base" ] , data ) if vcf : count += 1 vcf_name = dd . get_sample_name ( data ) + ".qsig.vcf" out_dir = utils . safe_makedir ( os . path . join ( work_dir , "qsignature" ) ) if not os . path . lexists ( os . path . join ( out_dir , vcf_name ) ) : os . symlink ( vcf , os . path . join ( out_dir , vcf_name ) ) if count > 0 : qc_out_dir = utils . safe_makedir ( os . path . join ( work_dir , "qc" , "qsignature" ) ) out_file = os . path . join ( qc_out_dir , "qsignature.xml" ) out_ma_file = os . path . join ( qc_out_dir , "qsignature.ma" ) out_warn_file = os . path . join ( qc_out_dir , "qsignature.warnings" ) log = os . path . join ( work_dir , "qsignature" , "qsig-summary.log" ) if not os . path . exists ( out_file ) : with file_transaction ( samples [ 0 ] [ 0 ] , out_file ) as file_txt_out : base_cmd = ( "{qsig} {jvm_opts} " "org.qcmg.sig.SignatureCompareRelatedSimple " "-log {log} -dir {out_dir} " "-o {file_txt_out} " ) do . run ( base_cmd . format ( ** locals ( ) ) , "qsignature score calculation" ) error , warnings , similar = _parse_qsignature_output ( out_file , out_ma_file , out_warn_file , samples [ 0 ] [ 0 ] ) return [ { 'total samples' : count , 'similar samples pairs' : len ( similar ) , 'warnings samples pairs' : len ( warnings ) , 'error samples' : list ( error ) , 'out_dir' : qc_out_dir } ] else : return [ ]
Run SignatureCompareRelatedSimple module from qsignature tool.

    Creates a matrix of pairwise comparison among samples. The
    function will not run if the output exists

    :param samples: list with only one element containing all samples information
    :returns: (dict) with the path of the output to be joined to summary