Ejemplo n.º 1
0
def main(args, outs):
    specs = args.specs
    runinfo_path = tk_preflight.check_runinfo_xml(args.run_path)

    output_dir = os.path.dirname(outs.samplesheet)
    csv_specs = [spec for spec in specs if spec.get('csv')]
    if not csv_specs:
        csv_path = make_csv_from_specs(specs, runinfo_path, output_dir)
        outs.input_samplesheet = None
    else:
        csv_path = csv_specs[0]['csv']
        shutil.copy(csv_path, outs.input_samplesheet)

    read_info, flowcell = tk_bcl.load_run_info(runinfo_path)
    (rta_version, rc_i2_read,
     bcl_params) = tk_bcl.get_rta_version(args.run_path)
    read_info_by_read_type = {r['read_name']: r for r in read_info}
    r1_length = read_info_by_read_type.get('R1',
                                           {'read_length': 0})['read_length']
    r2_length = read_info_by_read_type.get('R2',
                                           {'read_length': 0})['read_length']

    rc_sample_index = (args.si_read_type == 'I2' and rc_i2_read)
    lane_count = tk_lane.get_flowcell_lane_count(runinfo_path)

    output_info = tk_sheet.transform_samplesheet(
        csv_path,
        outs.samplesheet,
        flowcell_lane_count=lane_count,
        r1_read_length=r1_length,
        r2_read_length=r2_length,
        rc_sample_index=rc_sample_index,
        project_name=args.project)

    outs.dual_indexed_samplesheet = output_info['dual_indexed']
Ejemplo n.º 2
0
def main(args, outs):
    hostname = socket.gethostname()

    print "Checking run folder..."
    tk_preflight.check_rta_complete(args.run_path)

    print "Checking RunInfo.xml..."
    runinfo = tk_preflight.check_runinfo_xml(args.run_path)

    if not args.allow_no_barcodes:
        ok, msg = check_reads(runinfo)
        if not ok:
            martian.exit(msg)

    print "Checking system environment..."
    ok, msg = tk_preflight.check_ld_library_path()
    if not ok:
        martian.exit(msg)

    # Presence of SampleSheet.csv interferes with demux.
    # Ask customer to move it. Under older RTA, bcl2fastq looks for it
    # in Data/Intensities/BaseCalls while under newer RTA, it looks for it
    # at the top of the run folder.
    bc_dir = os.path.join(args.run_path, "Data", "Intensities", "BaseCalls")
    for ss_dir in [args.run_path, bc_dir]:
        ilmn_sample_sheet = os.path.join(ss_dir, "SampleSheet.csv")

        external = True
        try:
            import kitten
            external = False
        except ImportError:
            pass

        if external and os.path.exists(ilmn_sample_sheet):
            martian.exit(
                "On machine: %s, SampleSheet.csv found in run folder that would interfere with demux:\n%s\nPlease move, rename, or delete the file and run demux again."
                % (hostname, ilmn_sample_sheet))

    if args.check_executables:
        print "Checking bcl2fastq..."
        # Determine the RTA version of the run and whether this instrument
        # requires i2 to RC'd
        (rta_version, rc_i2_read,
         bcl_params) = tenkit.bcl.get_rta_version(args.run_path)
        martian.log_info("RTA Version: %s" % rta_version)
        martian.log_info("BCL Params: %s" % str(bcl_params))

        # Determine the best available bcl2fastq version to use
        # Will call martian.exit() with an error message if there isn't
        # a compatible version available
        (major_ver,
         full_ver) = tenkit.bcl.check_bcl2fastq(hostname, rta_version)
        martian.log_info("Running bcl2fastq mode: %s.  Version: %s" %
                         (major_ver, full_ver))

    ok, msg = tk_preflight.check_open_fh()
    if not ok:
        martian.exit(msg)
Ejemplo n.º 3
0
def main(args, outs):
    hostname = socket.gethostname()

    print "Checking run folder..."
    tk_preflight.check_rta_complete(args.run_path)

    print "Checking RunInfo.xml..."
    tk_preflight.check_runinfo_xml(args.run_path)

    print "Checking system environment..."
    ok, msg = tk_preflight.check_ld_library_path()
    if not ok:
        martian.exit(msg)

    print "Checking barcode whitelist..."
    tk_preflight.check_barcode_whitelist(args.barcode_whitelist)

    if args.check_executables:
        print "Checking bcl2fastq..."
        (rta_version, rc_i2_read, bcl_params) = tk_bcl.get_rta_version(args.run_path)
        martian.log_info("RTA Version: %s" % rta_version)
        martian.log_info("BCL Params: %s" % str(bcl_params))

        (major_ver, full_ver) = tk_bcl.check_bcl2fastq(hostname, rta_version)
        martian.log_info("Running bcl2fastq mode: %s.  Version: %s" % (major_ver, full_ver))

    ok, msg = tk_preflight.check_open_fh()
    if not ok:
        martian.exit(msg)

    if args.output_path is not None:
        tk_preflight.check_folder_or_create("--output-dir", args.output_path, hostname, permission=os.W_OK|os.X_OK)

    if args.interop_output_path is not None:
        tk_preflight.check_folder_or_create("--interop-dir", args.interop_output_path, hostname, permission=os.W_OK|os.X_OK)

    if args.max_bcl2fastq_threads < 1:
        msg = "Cannot run bcl2fastq with zero threads."
        martian.exit(msg)
Ejemplo n.º 4
0
def main(args, outs):
    hostname = socket.gethostname()

    print "Checking run folder..."
    tk_preflight.check_rta_complete(args.run_path)

    print "Checking RunInfo.xml..."
    runinfo = tk_preflight.check_runinfo_xml(args.run_path)

    print "Checking system environment..."
    ok, msg = tk_preflight.check_ld_library_path()
    if not ok:
        martian.exit(msg)

    print "Checking barcode whitelist..."
    tk_preflight.check_barcode_whitelist(args.barcode_whitelist)

    if args.check_executables:
        print "Checking bcl2fastq..."
        (rta_version, rc_i2_read,
         bcl_params) = tk_bcl.get_rta_version(args.run_path)
        martian.log_info("RTA Version: %s" % rta_version)
        martian.log_info("BCL Params: %s" % str(bcl_params))

        (major_ver, full_ver) = tk_bcl.check_bcl2fastq(hostname, rta_version)
        martian.log_info("Running bcl2fastq mode: %s.  Version: %s" %
                         (major_ver, full_ver))

    if '--no-lane-splitting' in args.bcl2fastq2_args:
        martian.exit("The --no-lane-splitting option is not supported.")

    print "Emitting run information..."
    martian.log_info("-------mkfastq diagnostic start-------")
    emit_info(args)

    print "Checking read specification..."
    check_read_params(args, runinfo)
    martian.log_info("-------mkfastq diagnostic end-------")

    print "Checking samplesheet specs..."
    check_specs(args)

    print "Checking for dual index flowcell..."
    check_dual_index(args, runinfo)

    ok, msg = tk_preflight.check_open_fh()
    if not ok:
        martian.exit(msg)