Exemple #1
0
def test_run_bam2fasta_percell_no_shard():
    with utils.TempDirectory() as location:
        testdata1 = utils.get_test_data(
            '10x-example/possorted_genome_bam.fastq.gz')

        fasta_files = cli.percell(
            ['--filename', testdata1, '--save-fastas', location])
        print(fasta_files)

        barcodes = [filename.replace(".fasta", "") for filename in fasta_files]
        assert len(barcodes) == 8
Exemple #2
0
def test_run_bam2fasta_fq_percell_no_shard_nonzero_umi():
    with utils.TempDirectory() as location:
        testdata1 = utils.get_test_data(
            '10x-example/possorted_genome_bam.fastq.gz')

        fasta_files = cli.percell([
            '--filename', testdata1, '--save-fastas', location,
            '--min-umi-per-barcode', '10'
        ])
        print(fasta_files)
        barcodes = [filename.replace(".fastq", "") for filename in fasta_files]
        assert len(barcodes) == 1
        sequences_fastq = []
        with screed.open(fasta_files[0]) as f:
            for record in f:
                sequences_fastq.append(record.sequence)
        gt_data = utils.get_test_data(
            '10x-example/groundtruth_fasta_sequences.txt')
        with open(gt_data, "r") as f:
            for index, line in enumerate(f.readlines()):
                assert line.strip() in sequences_fastq, \
                    "failed at index {}".format(index)