Esempio n. 1
0
def run_preflight_checks(args):
    print "Checking sample info..."
    cr_preflight.check_sample_def(args.sample_def)

    print "Checking reference..."
    cr_preflight.check_refdata(args.reference_path)

    print "Checking chemistry..."
    cr_preflight.check_chemistry(args.chemistry_name, args.custom_chemistry_def,
                                 args.allowed_chems)

    if args.r1_length is not None:
        print "Checking read 1 length..."
        cr_preflight.check_read_length(args.r1_length)
    if args.r2_length is not None:
        print "Checking read 2 length..."
        cr_preflight.check_read_length(args.r2_length)

    # Open file handles limit - per CELLRANGER-824, only check this on the execution machine.
    # We can tell if we're on the execution machine by looking at args.check_executables
    if args.check_executables:
        print "Checking system environment..."
        cr_preflight.check_environment()

    print "Checking optional arguments..."
    if args.recovered_cells is not None and args.force_cells is not None:
        raise cr_preflight.PreflightException("Cannot specify both --force-cells and --expect-cells in the same run.")
Esempio n. 2
0
def run_preflight_checks(args):

    if args.feature_reference is not None:
        print "Checking feature definition file..."
        feature_ref = cr_preflight.check_feature_ref(args.reference_path,
                                                     args.feature_reference)
    else:
        feature_ref = None

    print "Checking sample info..."
    cr_preflight.check_sample_def(args.sample_def,
                                  feature_ref,
                                  pipeline=PIPELINE_COUNT)

    # If any non "Gene Expression" libraries are present then the feature-ref is required.
    if any((x.get("library_type") != None
            and x.get("library_type") != GENE_EXPRESSION_LIBRARY_TYPE)
           for x in args.sample_def):
        if args.feature_reference is None:
            raise cr_preflight.PreflightException(
                "You must specify --feature-ref when using Cell Ranger with feature barcoding libraries."
            )

    # At least one "Gene Expression" library is required.
    # Treat an empty library_type as GENE_EXPRESSION
    if not any(
            x.get("library_type") == GENE_EXPRESSION_LIBRARY_TYPE
            or x.get("library_type") == None for x in args.sample_def):
        raise cr_preflight.PreflightException(
            "You must specify >= 1 input library with library_type == '%s' to run 'cellranger count'"
            % GENE_EXPRESSION_LIBRARY_TYPE)

    print "Checking reference..."
    cr_preflight.check_refdata(args.reference_path)

    print "Checking chemistry..."
    cr_preflight.check_chemistry(args.chemistry_name,
                                 args.custom_chemistry_def, args.allowed_chems)

    if args.r1_length is not None:
        print "Checking read 1 length..."
        cr_preflight.check_read_length(args.r1_length)
    if args.r2_length is not None:
        print "Checking read 2 length..."
        cr_preflight.check_read_length(args.r2_length)

    # Open file handles limit - per CELLRANGER-824, only check this on the execution machine.
    # We can tell if we're on the execution machine by looking at args.check_executables
    if args.check_executables:
        print "Checking system environment..."
        cr_preflight.check_environment()

    print "Checking optional arguments..."
    if args.recovered_cells is not None and args.force_cells is not None:
        raise cr_preflight.PreflightException(
            "Cannot specify both --force-cells and --expect-cells in the same run."
        )
Esempio n. 3
0
def run_preflight_checks(args):
    print "Checking sample info..."
    cr_preflight.check_sample_def(args.sample_def)

    # Don't check the GEX reference if we are just distinguishing between SCVDJ seq configs
    if 'SCVDJ' not in args.chemistry_name_spec:
        print "Checking reference..."
        cr_preflight.check_refdata(args.reference_path)

    if args.vdj_reference_path is not None:
        print "Checking V(D)J reference..."
        vdj_preflight.check_refdata(args.vdj_reference_path, True)
Esempio n. 4
0
def main(args, outs):
    hostname = socket.gethostname()

    print "Checking sample info..."
    ok, msg = tk_preflight.check_gem_groups(args.sample_def)
    if not ok:
        martian.exit(msg)

    print "Checking FASTQ folder..."
    for sample_def in args.sample_def:
        read_path = sample_def["read_path"]
        if not read_path.startswith('/'):
            martian.exit(
                "Specified FASTQ folder must be an absolute path: %s" %
                read_path)
        if not os.path.exists(read_path):
            martian.exit(
                "On machine: %s, specified FASTQ folder does not exist: %s" %
                (hostname, read_path))
        if not os.access(read_path, os.X_OK):
            martian.exit(
                "On machine: %s, cellranger does not have permission to open FASTQ folder: %s"
                % (hostname, read_path))
        if not os.listdir(read_path):
            martian.exit("Specified FASTQ folder is empty: " + read_path)

        lanes = sample_def["lanes"]
        if lanes is not None:
            for lane in lanes:
                if not is_int(lane):
                    martian.exit(
                        "Lanes must be a comma-separated list of numbers.")

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

    if args.reference_path is None and args.vdj_reference_path is None:
        martian.exit(
            "Must specify either reference_path or vdj_reference_path.")

    print "Checking transcriptome..."
    if args.reference_path is not None:
        ok, msg = cr_preflight.check_refdata(args.reference_path)
        if not ok:
            martian.exit(msg)

    if args.vdj_reference_path is not None:
        ok, msg = vdj_preflight.check_refdata(args.vdj_reference_path)
        if not ok:
            martian.exit(msg)

    print "Checking chemistry..."
    ok, msg = cr_chem.check_chemistry_defs()
    if not ok:
        martian.exit(msg)

    ok, msg = cr_chem.check_chemistry_arg(args.chemistry_name)
    if not ok:
        martian.exit(msg)

    if args.chemistry_name == cr_chem.CUSTOM_CHEMISTRY_NAME:
        ok, msg = cr_chem.check_chemistry_def(args.custom_chemistry_def)
        if not ok:
            martian.exit(msg)

    # Open file handles limit - per CELLRANGER-824, only check this on the execution machine.
    # We can tell if we're on the execution machine by looking at args.check_executables
    if args.check_executables:
        print "Checking system environment..."
        ok, msg = tk_preflight.check_open_fh()
        if not ok:
            martian.exit(msg)

    print "Checking optional arguments..."
    if args.recovered_cells is not None and args.force_cells is not None:
        martian.exit(
            "Cannot specify both --force-cells and --expect-cells (or --cells) in the same run."
        )

    cr_preflight.record_package_versions()