Skip to content

Commit

Permalink
Merge 143dbac into c7a3f81
Browse files Browse the repository at this point in the history
  • Loading branch information
aschroed committed Apr 14, 2022
2 parents c7a3f81 + 143dbac commit 9ed9286
Show file tree
Hide file tree
Showing 35 changed files with 390 additions and 297 deletions.
83 changes: 49 additions & 34 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ packages = [
python = ">=3.6.1,<3.10"
python-magic = ">=0.4.12"
attrs = ">=21.4"
xlrd3 = "1.1.0"
openpyxl = "^3.0.9"
xlwt = "1.3.0"
dcicutils = ">=3.11.0"
# awscli is not directly imported but is required for aws cp operation
Expand Down
23 changes: 23 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# flake8: noqa
import pytest
from wranglertools.get_field_info import FDN_Key, FDN_Connection
from pathlib import Path
import openpyxl


class MockedResponse(object):
Expand Down Expand Up @@ -365,6 +367,18 @@ def embed_properties():
}


@pytest.fixture
def workbooks():
workbooks = {}
WORKBOOK_DIR = './tests/data_files/workbooks/'
filenames = Path(WORKBOOK_DIR).glob('*.xlsx')
for fn in filenames:
if fn.name.startswith('~'):
continue
workbooks[fn.name] = openpyxl.load_workbook(fn)
return workbooks


@pytest.fixture
def file_metadata():
from collections import OrderedDict
Expand Down Expand Up @@ -414,6 +428,15 @@ def returned_award_schema():
return MockedResponse(data, 200)


@pytest.fixture
def returned_bcc_schema():
""" trimmed schema with examples of various permutations of properties including descriptions, comments, enums, suggested enums
and also a calcprop and schema version that have import-item permission for testing sheet generation
"""
data = {"title": "Cell culture details for biosample preparation","id": "/profiles/biosample_cell_culture.json","$schema": "http://json-schema.org/draft-04/schema#","type": "object","required": ["culture_start_date", "award", "lab"],"identifyingProperties": ["uuid", "aliases"],"additionalProperties": False,"mixinProperties": [{ "$ref": "mixins.json#/schema_version" },],"mixinFacets" : [{ "$ref": "mixins.json#/facets_common" }],"properties": {"description": {"title": "Description","description": "A short description of the cell culture procedure - eg. Details on culturing a preparation of K562 cells","type": "string","lookup": 20,"formInput": "textarea"},"culture_start_date": {"title": "Culture start date","description": "YYYY-MM-DD format date for most recently thawed cell culture.","comment": "Date can be submitted in as YYYY-MM-DD or YYYY-MM-DDTHH:MM:SSTZD","type": "string","lookup": 40,"anyOf": [{"format": "date-time"},{"format": "date"}]},"culture_harvest_date": {"title": "Culture harvest date","type": "string","lookup": 50,"anyOf": [{"format": "date-time"},{"format": "date"}]},"culture_duration":{"title":"Total Days in Culture","description":"Total number of culturing days since receiving original vial","type":"number","lookup": 60},"passage_number": {"title": "Passage Number","type": "integer","lookup": 70},"protocols_additional": {"title": "Additional Protocols used in Cell Culture","description": "Protocols including additional culture manipulations such as stem cell differentiation or cell cycle synchronization.","type": "array","lookup": 150,"items": {"title": "Culture Protocol","type": "string","linkTo": "Protocol"}},"in_vitro_differentiated": {"title": "Differentiated in vitro","description": "Relevant for pluripotent and stem cell lines - set to Yes if cells have undergone in vitro differentiation","type": "string","enum": ["Yes", "No"],"default": "No","lookup": 98},"tissue": {"title": "Differentiation Tissue/Cell Type","description": "The resulting tissue or cell type for cells that have undergone differentiation.","type": "string","linkTo": "OntologyTerm","lookup": 99,"suggested_enum": ["cardiac muscle myoblast","cardiac muscle cell"]},"synchronization_stage": {"title": "Synchronization Stage","description": "If a culture is synchronized the cell cycle stage from which the biosample used in an experiment is prepared","type": "string","lookup": 120,"suggested_enum": ["non synchronized","G1",],"ignored_enum": ["3h after mitotic shakeoff"]},"@type":{"calculatedProperty":True,"title":"Type","type":"array","items":{"type":"string"}}, "schema_version":{"requestMethod":[],"type":"string","default":"1","pattern":"^\\d+(\\.\\d+)*$","title":"Schema Version", "permission":"import_items"}}}
return MockedResponse(data, 200)


@pytest.fixture
def returned_vendor_schema():
data = {"title":"Vendor","description":"Schema for submitting an originating lab or vendor.","id":"/profiles/vendor.json","$schema":"http://json-schema.org/draft-04/schema#","type":"object","required":["title"],"identifyingProperties":["uuid","name"],"additionalProperties":False,"mixinProperties":[{"$ref":"mixins.json#/schema_version"},{"$ref":"mixins.json#/uuid"},{"$ref":"mixins.json#/status"},{"$ref":"mixins.json#/notes"},{"$ref":"mixins.json#/submitted"},{"$ref":"mixins.json#/attribution"},{"$ref":"mixins.json#/aliases"}],"properties":{"aliases":{"type":"array","default":[],"uniqueItems":True,"title":"Lab aliases","description":"Lab specific identifiers to reference an object.","items":{"comment":"Current convention is colon separated lab name and lab identifier. (e.g. john-doe:42).","pattern":"^\\S+:\\S+","uniqueKey":"alias","title":"Lab alias","description":"A lab specific identifier to reference an object.","type":"string"}},"award":{"comment":"See award.json for list of available identifiers.","title":"Grant","description":"Grant associated with the submission.","linkTo":"Award","type":"string"},"lab":{"description":"Lab associated with the submission.","linkSubmitsFor":True,"title":"Lab","comment":"See lab.json for list of available identifiers.","linkTo":"Lab","type":"string"},"date_created":{"anyOf":[{"format":"date-time"},{"format":"date"}],"serverDefault":"now","readonly":True,"type":"string","comment":"Do not submit, value is assigned by the server. The date the object is created.","title":"Date created","rdfs:subPropertyOf":"dc:created","permission":"import_items"},"submitted_by":{"serverDefault":"userid","readonly":True,"type":"string","comment":"Do not submit, value is assigned by the server. The user that created the object.","linkTo":"User","title":"Submitted by","rdfs:subPropertyOf":"dc:creator","permission":"import_items"},"notes":{"elasticsearch_mapping_index_type":{"title":"Field mapping index type","description":"Defines one of three types of indexing available","type":"string","enum":["analyzed","not_analyzed","no"],"default":"analyzed"},"description":"DCIC internal notes.","type":"string","title":"Notes"},"status":{"readonly":True,"default":"in review by lab","title":"Status","type":"string","enum":["released","current","revoked","deleted","replaced","in review by lab","in review by project","released to project"],"permission":"import_items"},"uuid":{"serverDefault":"uuid4","readonly":True,"requestMethod":"POST","type":"string","title":"UUID","format":"uuid","permission":"import_items"},"schema_version":{"default":"1","pattern":"^\\d+(\\.\\d+)*$","requestMethod":[],"title":"Schema Version","comment":"Do not submit, value is assigned by the server. The version of the JSON schema that the server uses to validate the object. Schema version indicates generation of schema used to save version to to enable upgrade steps to work. Individual schemas should set the default.","type":"string"},"description":{"title":"Description","description":"A plain text description of the source.","type":"string","default":""},"title":{"title":"Name","description":"The complete name of the originating lab or vendor. ","type":"string"},"name":{"uniqueKey":True,"type":"string","description":"DON'T SUBMIT, auto-generated, use for referencing vendors in other sheets.","pattern":"^[a-z0-9\\-]+$"},"url":{"title":"URL","description":"An external resource with additional information about the source.","type":"string","format":"uri"},"@type":{"calculatedProperty":True,"title":"Type","type":"array","items":{"type":"string"}},"@id":{"calculatedProperty":True,"title":"ID","type":"string"}},"boost_values":{"name":1,"title":1},"@type":["JSONSchema"]}
Expand Down
Binary file removed tests/data_files/Document_insert.xls
Binary file not shown.
Binary file removed tests/data_files/Exp_HiC_insert.xls
Binary file not shown.
Binary file removed tests/data_files/Exp_Set_Replicate_insert.xls
Binary file not shown.
Binary file removed tests/data_files/Exp_Set_insert.xls
Binary file not shown.
Binary file removed tests/data_files/File_Set_insert.xls
Binary file not shown.
Binary file removed tests/data_files/File_fastq_insert.xls
Binary file not shown.
Binary file removed tests/data_files/Ftp_file_test.xls
Binary file not shown.
Binary file removed tests/data_files/Ftp_file_test_md5.xls
Binary file not shown.
Binary file not shown.
Binary file removed tests/data_files/GFI_test_vendor_reference.xls
Binary file not shown.
Binary file removed tests/data_files/Pseudo_wfr_insert.xls
Binary file not shown.
Binary file removed tests/data_files/Vendor.xls
Binary file not shown.
Binary file removed tests/data_files/Vendor_insert.xls
Binary file not shown.
Binary file removed tests/data_files/Vendor_ordered_reference.xls
Binary file not shown.
Binary file removed tests/data_files/test_cell_values.xls
Binary file not shown.
Binary file added tests/data_files/workbooks/Document_insert.xlsx
Binary file not shown.
Binary file added tests/data_files/workbooks/Exp_HiC_insert.xlsx
Binary file not shown.
Binary file not shown.
Binary file added tests/data_files/workbooks/Exp_Set_insert.xlsx
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file added tests/data_files/workbooks/File_fastq_upload.xlsx
Binary file not shown.
Binary file added tests/data_files/workbooks/Ftp_file_test.xlsx
Binary file not shown.
Binary file added tests/data_files/workbooks/Ftp_file_test_md5.xlsx
Binary file not shown.
Binary file added tests/data_files/workbooks/Pseudo_wfr_insert.xlsx
Binary file not shown.
Binary file added tests/data_files/workbooks/Vendor.xlsx
Binary file not shown.
Binary file added tests/data_files/workbooks/Vendor_insert.xlsx
Binary file not shown.
Binary file added tests/data_files/workbooks/test_cell_values.xlsx
Binary file not shown.

0 comments on commit 9ed9286

Please sign in to comment.