Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
synapse add random_numbers.txt --parentId syn1901847 --executed ./generate_random_data.R --used http://mathworld.wolfram.com/NormalDistribution.html

Python

Code Block
languagepy
# Set provenance for data file generated by the script file
data_file = File(path="random_numbers.txt", parent="syn1901847")
data_file = syn.store(data_file, executed="syn7205215", used="http://mathworld.wolfram.com/NormalDistribution.html")

R

Code Block
languager
# Set provenance for data file generated by the script file
data_file <- File(path="random_numbers.txt", parent="syn1901847")
data_file <- synStore(data_file, executed="syn7205215", used="http://mathworld.wolfram.com/NormalDistribution.html")

...

Code Block
# Add the data file to Synapse
synapse add squares.txt -parentId syn1901847 
# Set the provenance for newly created entity syn7209166 using synId
synapse set-provenance -id syn7209166 -executed syn7209078 -used syn7208917
# Set the provenance for newly created entity syn7209166 using local path
synapse set-provenance -id syn7209166 -executed ./square.R -used ./random_numbers.txt

Python

Code Block
languagepy
# Add the data file to Synapse
squared_file = File(path="squares.txt", parentId="syn1901847")
squared_file = syn.store(squared_file)

# Set provenance for newly created entity syn7209166
squared_file = syn.setProvenance(squared_file, activity = Activity(used = "syn7208917", executed = "syn7209078"))
# Provenance can also be set using local variables instead of looking up synIds
squared_file = syn.setProvenance(squared_file, activity = Activity(used = data_file, executed = "syn7209078"))

R

Code Block
languager
# Add the data file to Synapse
squared_file <- File(path="squares.txt", parentId="syn1901847")
squared_file <- synStore(squared_file)

# Set provenance for newly created entity syn7209166
act <- Activity(name = "Squared numbers", used = "syn7208917", executed = "syn7209078")
synStore(squared_file, activity=act)

# Provenance can also be set using local variables instead of looking up synIds
act <- Activity(name = "Squared numbers", used = data_file, executed = "syn7209078")
squared_file <- synStore(squared_file, activity=act)

...

Code Block
# Delete provenance on entity syn123 
delete_provenance = syn.deleteProvenance('syn123')

R

Code Block
languager
# Delete provenance on entity syn123
deleteProvenance = synDeleteProvenance('syn123')

...

Code Block
synapse get-provenance -id syn7209166

Python

Code Block
languagepy
provenance = syn.getProvenance("syn7209166")
provenance

R

Code Block
languager
provenance <- synGetProvenance("syn7209166")
provenance

...

Unfortunately, the web interface does not support assigning the same activity to multiple files. This action must be completed using either the R or the Python client.

Command Line

The command line currently does not support assigning the same activity to multiple files.

Python

Code Block
languagepy
# Code used to generate the file will be syn123456
# Files used to generate the information
expr_file = syn.get("syn246810", download=F)
filter_file = syn.get("syn135791", download=F)

# Activity to assign to multiple files
act = Activity(name="filtering",
                used=[expr_file, filter_file],
                executed="syn123456")
syn.store(final_file, activity=act)

# Get the activity now associated with an entity
act = syn.getProvenance(final_file)

# Now you can set this activity to as many files as you want (file1, file2, etc are Synapse Files)
file_list = [file_1, file_2, file_3]
file_list = map(lambda x: syn.store(x, activity=act), file_list)

R

Code Block
languager
# Code used to generate the file will be syn123456
# Files used to generate the information
expr_file <- synGet("syn246810", download=F)
filter_file <- synGet("syn135791", download=F)

# Activity to assign to multiple files
act <- Activity(name="filtering",
                used=list(expr_file, filter_file),
                executed="syn123456")
finalFile <- synStore(finalFile, activity=act)

# Get the activity now associated with an entity
act <- synGetProvenance(finalFile)

# Now you can set this activity to as many files as you want (file1, file2, etc are Synapse Files)
finalList <- c(file1, file2, file3)
finalList <- lapply(finalList, function(x) synStore(x, activity=act))

...