flowcraft/templates/process_mapping.py
def main(sample_id, bowite_log):
    """Main executor of the process_mapping template.

    Parameters
    ----------
    sample_id : str
        Sample Identification string.
    boetie_log: str
        Path to the log file generated by bowtie.

    """

    logger.info("Starting mapping file processing")
    warnings = []
    fails = ""

    bowtie_info = Bowtie(sample_id, bowite_log)

    print(bowtie_info.overall_rate)


    with open(".report.json", "w") as json_report:
        json_dic = {
            "tableRow": [{
                "sample": sample_id,
                "data": [
                    {"header": "Reads",
                     "value": int(bowtie_info.n_reads),
                     "table": "mapping",
                     "columnBar": False},
                    {"header": "Unmapped",
                     "value": int(bowtie_info.align_0x),
                     "table": "mapping",
                     "columnBar": False},
                    {"header": "Mapped 1x",
                     "value": int(bowtie_info.align_1x),
                     "table": "mapping",
                     "columnBar": False},
                    {"header": "Mapped >1x",
                     "value": int(bowtie_info.align_mt1x),
                     "table": "mapping",
                     "columnBar": False},
                    {"header": "Overall alignment rate (%)",
                     "value": float(bowtie_info.overall_rate),
                     "table": "mapping",
                     "columnBar": False}
                ]
            }],
        }

        if warnings:
            json_dic["warnings"] = [{
                "sample": sample_id,
                "table": "mapping",
                "value": warnings
            }]

        if fails:
            json_dic["fail"] = [{
                "sample": sample_id,
                "table": "mapping",
                "value": [fails]
            }]

        json_report.write(json.dumps(json_dic, separators=(",", ":")))

    with open(".status", "w") as status_fh:
        status_fh.write("pass")
def main(sample_id, bowite_log):
    """Main executor of the process_mapping template.

    Parameters
    ----------
    sample_id : str
        Sample Identification string.
    boetie_log: str
        Path to the log file generated by bowtie.

    """

    logger.info("Starting mapping file processing")
    warnings = []
    fails = ""

    bowtie_info = Bowtie(sample_id, bowite_log)

    print(bowtie_info.overall_rate)


    with open(".report.json", "w") as json_report:
        json_dic = {
            "tableRow": [{
                "sample": sample_id,
                "data": [
                    {"header": "Reads",
                     "value": int(bowtie_info.n_reads),
                     "table": "mapping",
                     "columnBar": False},
                    {"header": "Unmapped",
                     "value": int(bowtie_info.align_0x),
                     "table": "mapping",
                     "columnBar": False},
                    {"header": "Mapped 1x",
                     "value": int(bowtie_info.align_1x),
                     "table": "mapping",
                     "columnBar": False},
                    {"header": "Mapped >1x",
                     "value": int(bowtie_info.align_mt1x),
                     "table": "mapping",
                     "columnBar": False},
                    {"header": "Overall alignment rate (%)",
                     "value": float(bowtie_info.overall_rate),
                     "table": "mapping",
                     "columnBar": False}
                ]
            }],
        }

        if warnings:
            json_dic["warnings"] = [{
                "sample": sample_id,
                "table": "mapping",
                "value": warnings
            }]

        if fails:
            json_dic["fail"] = [{
                "sample": sample_id,
                "table": "mapping",
                "value": [fails]
            }]

        json_report.write(json.dumps(json_dic, separators=(",", ":")))

    with open(".status", "w") as status_fh:
        status_fh.write("pass")
def main ( sample_id , bowite_log ) : logger . info ( "Starting mapping file processing" ) warnings = [ ] fails = "" bowtie_info = Bowtie ( sample_id , bowite_log ) print ( bowtie_info . overall_rate ) with open ( ".report.json" , "w" ) as json_report : json_dic = { "tableRow" : [ { "sample" : sample_id , "data" : [ { "header" : "Reads" , "value" : int ( bowtie_info . n_reads ) , "table" : "mapping" , "columnBar" : False } , { "header" : "Unmapped" , "value" : int ( bowtie_info . align_0x ) , "table" : "mapping" , "columnBar" : False } , { "header" : "Mapped 1x" , "value" : int ( bowtie_info . align_1x ) , "table" : "mapping" , "columnBar" : False } , { "header" : "Mapped >1x" , "value" : int ( bowtie_info . align_mt1x ) , "table" : "mapping" , "columnBar" : False } , { "header" : "Overall alignment rate (%)" , "value" : float ( bowtie_info . overall_rate ) , "table" : "mapping" , "columnBar" : False } ] } ] , } if warnings : json_dic [ "warnings" ] = [ { "sample" : sample_id , "table" : "mapping" , "value" : warnings } ] if fails : json_dic [ "fail" ] = [ { "sample" : sample_id , "table" : "mapping" , "value" : [ fails ] } ] json_report . write ( json . dumps ( json_dic , separators = ( "," , ":" ) ) ) with open ( ".status" , "w" ) as status_fh : status_fh . write ( "pass" )
Main executor of the process_mapping template.

    Parameters
    ----------
    sample_id : str
        Sample Identification string.
    boetie_log: str
        Path to the log file generated by bowtie.
Main executor of the process_mapping template .