Skip to content

Commit

Permalink
Start adding provenance - Add github URL with specified tag. (#353)
Browse files Browse the repository at this point in the history
* Add in tag or commit to GENIE storing of files

* update tag

* use version stated in GENIE package as tag for provenance

* make sure data guide has provenance added
  • Loading branch information
thomasyu888 authored Sep 15, 2020
1 parent 41602e7 commit 04f49bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions bin/database_to_staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ def main(genie_version,
database_mapping=databaseSynIdMappingId,
genie_user=genie_user,
genie_pass=genie_pass)
data_guide_ent = synapseclient.File(data_guide_pdf,
parent=folders['release_folder'])
syn.store(data_guide_ent)
database_to_staging.store_file(syn, data_guide_pdf,
genieVersion=genie_version,
parent=folders['release_folder'])
logger.info("COMPLETED DATABASE TO STAGING")


Expand Down
12 changes: 10 additions & 2 deletions genie/database_to_staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import synapseutils

from . import process_functions
from . import __version__

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -61,7 +62,8 @@ def find_caselistid(syn, parentid):


def store_file(syn, filePath, genieVersion="database", name=None,
parent=None, fileFormat=None, cBioFileFormat=None):
parent=None, fileFormat=None, cBioFileFormat=None,
tag_or_commit=None):
'''
Convenience function to store files
Expand All @@ -74,6 +76,7 @@ def store_file(syn, filePath, genieVersion="database", name=None,
cBioFileFormat: cBioPortal file format
staging: Staging GENIE release. Default to False
caseLists: Case lists are stored elsewhere
tag_or_commit: Github tag or commit
'''
logger.info("STORING FILE: {}".format(os.path.basename(filePath)))
if name is None:
Expand All @@ -84,7 +87,12 @@ def store_file(syn, filePath, genieVersion="database", name=None,
ent.fileFormat = fileFormat
if cBioFileFormat is not None:
ent.cBioFileFormat = cBioFileFormat
ent = syn.store(ent)
if tag_or_commit is None:
tag_or_commit = f"v{__version__.__version__}"
ent = syn.store(
ent,
used=f"https://github.com/Sage-Bionetworks/Genie/tree/{tag_or_commit}"
)
return ent


Expand Down

0 comments on commit 04f49bc

Please sign in to comment.