Exemplo n.º 1
0
 def test_batch_fastqs_multiple_fastqs_single_batch(self):
     """batch_fastqs: multiple Fastqs, single batch
     """
     fqs = batch_fastqs([self.r1, self.r1, self.r1, self.r1],
                        batch_size=12,
                        out_dir=self.wd)
     self.assertEqual(fqs, [
         os.path.join(self.wd, "batched.B000.r1.fastq"),
     ])
     for fq in fqs:
         self.assertTrue(os.path.exists(fq))
Exemplo n.º 2
0
        tmpdir = os.path.abspath(args.temporary_directory)
    else:
        try:
            tmpdir = os.path.abspath(os.environ["TMPDIR"])
        except KeyError:
            tmpdir = None
    working_dir = tempfile.mkdtemp(suffix="icell8_stats", dir=tmpdir)
    print "Using working dir %s" % working_dir

    # Split into batches for multiprocessing
    if nprocs > 1:
        try:
            batch_size, nbatches = get_batch_size(
                fastqs, max_batch_size=args.max_batch_size, min_batches=nprocs)
            batched_fastqs = batch_fastqs(fastqs,
                                          batch_size,
                                          basename="icell8_stats",
                                          out_dir=working_dir)
        except Exception as ex:
            logging.critical("Failed to split Fastqs into batches: " "%s" % ex)
            sys.exit(1)
    else:
        batched_fastqs = fastqs

    # Collect statistics
    stats = ICell8Stats(*batched_fastqs, nprocs=nprocs, verbose=True)

    # Remove the working directory
    shutil.rmtree(working_dir)

    # Report the stats
    if args.stats_file is not None: