load
genie.load
¶
This module contains all the functions that stores data to Synapse
Attributes¶
__version__ = '16.6.0'
module-attribute
¶
logger = logging.getLogger(__name__)
module-attribute
¶
Functions¶
store_file(syn, filepath, parentid, name=None, annotations=None, used=None, version_comment=None)
¶
Stores file into Synapse
PARAMETER | DESCRIPTION |
---|---|
syn
|
Synapse connection
TYPE:
|
filepath
|
Path to file
TYPE:
|
parentid
|
Synapse Id of a folder or project
TYPE:
|
name
|
Name of entity. Defaults to basename of your file path.
TYPE:
|
annotations
|
Synapse annotations to the File Entity. Defaults to None.
TYPE:
|
used
|
Entities used to generate file. Defaults to None.
TYPE:
|
version_comment
|
File Entity version comment. Defaults to None.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
File
|
synapseclient.File: Synapse File entity |
Source code in genie/load.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
store_files(syn, filepaths, parentid)
¶
Stores a list of files
PARAMETER | DESCRIPTION |
---|---|
syn
|
Synapse connection
TYPE:
|
filepaths
|
List of filepaths
TYPE:
|
parentid
|
Synapse Id of a folder or project
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
List[File]
|
List[synapseclient.File]: List of Synaps File entities |
Source code in genie/load.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
store_table(syn, filepath, tableid)
¶
Stores a tsv to a Synapse Table. This can append, update, and delete rows in a Synapse table depending on how the tsv file is formatted.
PARAMETER | DESCRIPTION |
---|---|
syn
|
Synapse connection
TYPE:
|
filepath
|
Path to a TSV
TYPE:
|
tableid
|
Synapse Id of a Synapse Table
TYPE:
|
Source code in genie/load.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
update_process_trackingdf(syn, process_trackerdb_synid, center, process_type, start=True)
¶
Updates the processing tracking database
PARAMETER | DESCRIPTION |
---|---|
syn
|
Synapse connection
TYPE:
|
process_trackerdb_synid
|
Synapse Id of Process Tracking Table
TYPE:
|
center
|
GENIE center (ie. SAGE)
TYPE:
|
process_type
|
processing type (dbToStage or public)
TYPE:
|
start
|
Start or end of processing. Default is True for start
TYPE:
|
Source code in genie/load.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
update_table(syn, databaseSynId, newData, filterBy, filterByColumn='CENTER', col=None, toDelete=False)
¶
Update Synapse table given a new dataframe
PARAMETER | DESCRIPTION |
---|---|
syn
|
Synapse connection
TYPE:
|
databaseSynId
|
Synapse Id of Synapse Table
TYPE:
|
newData
|
New data in a dataframe
TYPE:
|
filterBy
|
Value to filter new data by
TYPE:
|
filterByColumn
|
Column to filter values by. Defaults to "CENTER".
TYPE:
|
col
|
List of columns to ingest. Defaults to None.
TYPE:
|
toDelete
|
Delete rows given the primary key. Defaults to False.
TYPE:
|
Source code in genie/load.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
|
_update_table(syn, database, new_dataset, database_synid, primary_key_cols, to_delete=False)
¶
Updates synapse tables by a row identifier with another dataset that has the same number and order of columns
PARAMETER | DESCRIPTION |
---|---|
syn
|
Synapse object
TYPE:
|
database
|
Original Data
TYPE:
|
new_dataset
|
New Data
TYPE:
|
database_synid
|
Synapse Id of the Synapse table
TYPE:
|
primary_key_cols
|
Column(s) that make up the primary key
TYPE:
|
to_delete
|
Delete rows. Defaults to False
TYPE:
|
Source code in genie/load.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
|
_copyRecursive(syn, entity, destinationId, mapping=None, skipCopyAnnotations=False, **kwargs)
¶
NOTE: This is a copy of the function found here: https://github.com/Sage-Bionetworks/synapsePythonClient/blob/develop/synapseutils/copy_functions.py#L409 This was copied because there is a restriction that doesn't allow for copying entities with access requirements
Recursively copies synapse entites, but does not copy the wikis
PARAMETER | DESCRIPTION |
---|---|
syn
|
A Synapse object with user's login
TYPE:
|
entity
|
A synapse entity ID
TYPE:
|
destinationId
|
Synapse ID of a folder/project that the copied entity is being copied to
TYPE:
|
mapping
|
A mapping of the old entities to the new entities
TYPE:
|
skipCopyAnnotations
|
Skips copying the annotations Default is False
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Dict[str, str]
|
a mapping between the original and copied entity: {'syn1234':'syn33455'} |
Source code in genie/load.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
|