def ensure_bed_version(store: Store, bed_name: str = "dummy_bed") -> models.ApplicationVersion: """Utility function to return existing or create bed version for tests""" bed = store.bed(name=bed_name) if not bed: bed = store.add_bed(name=bed_name) store.add_commit(bed) version = store.latest_bed_version(bed_name) if not version: version = store.add_bed_version(bed, 1, "dummy_filename", shortname=bed_name) store.add_commit(version) return version
def fixture_base_store(store: Store, apptag_rna: str) -> Store: """Setup and example store.""" customer_group = store.add_customer_group("all_customers", "all customers") store.add_commit(customer_group) customers = [ store.add_customer( "cust000", "Production", scout_access=True, customer_group=customer_group, invoice_address="Test street", invoice_reference="ABCDEF", ), store.add_customer( "cust001", "Customer", scout_access=False, customer_group=customer_group, invoice_address="Test street", invoice_reference="ABCDEF", ), store.add_customer( "cust002", "Karolinska", scout_access=True, customer_group=customer_group, invoice_address="Test street", invoice_reference="ABCDEF", ), store.add_customer( "cust003", "CMMS", scout_access=True, customer_group=customer_group, invoice_address="Test street", invoice_reference="ABCDEF", ), ] store.add_commit(customers) applications = [ store.add_application( tag="WGXCUSC000", category="wgs", description="External WGS", sequencing_depth=0, is_external=True, percent_kth=80, percent_reads_guaranteed=75, target_reads=10, ), store.add_application( tag="EXXCUSR000", category="wes", description="External WES", sequencing_depth=0, is_external=True, percent_kth=80, percent_reads_guaranteed=75, target_reads=10, ), store.add_application( tag="WGSPCFC060", category="wgs", description="WGS, double", sequencing_depth=30, accredited=True, percent_kth=80, percent_reads_guaranteed=75, target_reads=10, ), store.add_application( tag="RMLP05R800", category="rml", description="Ready-made", sequencing_depth=0, percent_kth=80, percent_reads_guaranteed=75, target_reads=10, ), store.add_application( tag="WGSPCFC030", category="wgs", description="WGS trio", is_accredited=True, sequencing_depth=30, target_reads=30, limitations="some", percent_kth=80, percent_reads_guaranteed=75, ), store.add_application( tag="METLIFR020", category="wgs", description="Whole genome metagenomics", sequencing_depth=0, target_reads=400000, percent_kth=80, percent_reads_guaranteed=75, ), store.add_application( tag="METNXTR020", category="wgs", description="Metagenomics", sequencing_depth=0, target_reads=200000, percent_kth=80, percent_reads_guaranteed=75, ), store.add_application( tag="MWRNXTR003", category="mic", description="Microbial whole genome ", sequencing_depth=0, percent_kth=80, percent_reads_guaranteed=75, target_reads=10, ), store.add_application( tag=apptag_rna, category="tgs", description="RNA seq, poly-A based priming", percent_kth=80, percent_reads_guaranteed=75, sequencing_depth=25, accredited=True, target_reads=10, ), store.add_application( tag="VWGDPTR001", category="cov", description="Viral whole genome ", sequencing_depth=0, percent_kth=80, percent_reads_guaranteed=75, target_reads=10, ), ] store.add_commit(applications) prices = {"standard": 10, "priority": 20, "express": 30, "research": 5} versions = [ store.add_version(application, 1, valid_from=dt.datetime.now(), prices=prices) for application in applications ] store.add_commit(versions) beds = [store.add_bed("Bed")] store.add_commit(beds) bed_versions = [store.add_bed_version(bed, 1, "Bed.bed") for bed in beds] store.add_commit(bed_versions) organism = store.add_organism("C. jejuni", "C. jejuni") store.add_commit(organism) yield store