Пример #1
0
def test_create_fastq_dict(
    valid_files_with_index,
    valid_files_with_index_dict,
    invalid_files_one_lane_indexed,
    invalid_files_one_lane_indexed_dict,
):
    fastq_dict = tenx_utils.create_fastq_dict(valid_files_with_index)
    assert fastq_dict == valid_files_with_index_dict

    fastq_dict = tenx_utils.create_fastq_dict(invalid_files_one_lane_indexed)
    assert fastq_dict == invalid_files_one_lane_indexed_dict
Пример #2
0
def test_get_fastqs_for_read_index(valid_files_with_index):
    fastq_dict = tenx_utils.create_fastq_dict(valid_files_with_index)
    fastqs = tenx_utils.get_fastqs_for_read_index(fastq_dict, 'read1')
    assert fastqs == ['gs://5/r1.fastq.gz', 'gs://7/r1.fastq.gz']

    fastqs = tenx_utils.get_fastqs_for_read_index(fastq_dict, 'read2')
    assert fastqs == ['gs://5/r2.fastq.gz', 'gs://7/r2.fastq.gz']

    fastqs = tenx_utils.get_fastqs_for_read_index(fastq_dict, 'index1')
    assert fastqs == ['gs://5/i1.fastq.gz', 'gs://7/i1.fastq.gz']
Пример #3
0
def get_optimus_inputs(primary_bundle):
    """Gather the necessary inputs for Optimus from the bundle metadata object.

    Args:
        humancellatlas.data.metadata.Bundle (obj): A bundle metadata object.

    Returns:
        tuple: tuple of the sample_id, ncbi_taxon_id, dict mapping flow cell lane indices
               to fastq file manifests

    Raises:
        requests.HTTPError: on 4xx errors or 5xx errors beyond the timeout
    """
    sample_id = metadata_utils.get_sample_id(primary_bundle)
    ncbi_taxon_id = metadata_utils.get_ncbi_taxon_id(primary_bundle)
    fastq_files = primary_bundle.sequencing_output
    lane_to_fastqs = tenx_utils.create_fastq_dict(fastq_files)
    library_construction_method = metadata_utils.get_library_construction_method_ontology(
        primary_bundle)
    chemistry = get_tenx_chemistry(library_construction_method)
    return sample_id, ncbi_taxon_id, lane_to_fastqs, chemistry
Пример #4
0
def test_create_fastq_dict_raises_error_when(
        missing_lane_index_multiple_sets_of_reads):
    with pytest.raises(tenx_utils.InsufficientLaneInfoError):
        tenx_utils.create_fastq_dict(missing_lane_index_multiple_sets_of_reads)
Пример #5
0
def test_create_fastq_dict_reindexes_with_zero_when(
        missing_lane_index_one_set_of_reads):
    fastq_dict = tenx_utils.create_fastq_dict(
        missing_lane_index_one_set_of_reads)
    assert 0 in fastq_dict
    assert None not in fastq_dict
Пример #6
0
def test_validate_lanes_accepts_lanes_when_none_indexed(valid_files_no_index):
    fastq_dict = tenx_utils.create_fastq_dict(valid_files_no_index)
    tenx_utils.validate_lanes(fastq_dict)
Пример #7
0
def test_validate_lanes_rejects_mixing_indexed_and_non_indexed_lanes(
        invalid_files_one_lane_indexed):
    fastq_dict = tenx_utils.create_fastq_dict(invalid_files_one_lane_indexed)
    with pytest.raises(tenx_utils.LaneMissingFileError):
        tenx_utils.validate_lanes(fastq_dict)
Пример #8
0
def test_validate_lanes_requires_read2(invalid_files_missing_read2):
    fastq_dict = tenx_utils.create_fastq_dict(invalid_files_missing_read2)
    with pytest.raises(tenx_utils.LaneMissingFileError):
        tenx_utils.validate_lanes(fastq_dict)