How to use the synapseclient.Synapse function in synapseclient

To help you get started, we’ve selected a few synapseclient examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Sage-Bionetworks / synapsePythonClient / tests / load / test_large_file_upload.py View on Github external
parser.add_argument('-f', '--file', '--path', dest='filepath', default=None)

    parser.add_argument('--size-mb', type=int, dest='size_mb')
    parser.add_argument('--size-gb', type=int, dest='size_gb')

    args = parser.parse_args()

    if args.size_mb:
        args.file_to_upload_size = args.size_mb * utils.MB
    elif args.size_gb:
        args.file_to_upload_size = args.size_gb * utils.GB
    else:
        args.file_to_upload_size = 11*utils.KB

    synapseclient.USER_AGENT['User-Agent'] = "test-large-file-upload " + synapseclient.USER_AGENT['User-Agent']
    syn = synapseclient.Synapse(debug=args.debug, skip_checks=args.skip_checks)
    if args.staging:
        print("switching to STAGING endpoints")
        syn.setEndpoints(**synapseclient.client.STAGING_ENDPOINTS)
    syn.login(args.user, args.password, silent=True)

    test_large_file_upload(file_to_upload_size=args.file_to_upload_size, filepath=args.filepath)
github Sage-Bionetworks / synapsePythonClient / tests / unit / __init__.py View on Github external
def setup_module(module):
    print("Python version:", sys.version)

    syn = synapseclient.Synapse(debug=False, skip_checks=True)
    syn.logger = logging.getLogger(SILENT_LOGGER_NAME)
    module.syn = syn
github ga4gh / cloud-interop-testing / scripts / send_report_reminder.py View on Github external
def main(argv):
    syn = synapseclient.Synapse()
    user = os.environ.get('SYNAPSE_USER', None)
    password = os.environ.get('SYNAPSE_PASSWORD', None)
    syn.login(email=user, password=password)
    messages.syn = syn
    project_id = conf.CHALLENGE_SYN_ID
    for queue_info in conf.evaluation_queues:
    #eval_id = argv[0]
        if queue_info['id'] > 9603664:
            print("sending report reminders for queue {}..."
                  .format(queue_info['id']))
            send_reminders(syn, queue_info['id'])
github Sage-Bionetworks / synapsePythonClient / tests / load / test_large_file_upload.py View on Github external
def setup(module):

    module.syn = synapseclient.Synapse()
    module.syn.login()
github ga4gh / cloud-interop-testing / scripts / update_submission_team.py View on Github external
def main(argv):
    syn = synapseclient.Synapse()
    user = os.environ.get('SYNAPSE_USER', None)
    password = os.environ.get('SYNAPSE_PASSWORD', None)
    syn.login(email=user, password=password)

    project_id = conf.CHALLENGE_SYN_ID
    #for queue_info in conf.evaluation_queues:
    eval_id = argv[0]
    print("updating team annotations for queue {}...".format(eval_id))
    
    update_submissions(syn, eval_id)
github Sage-Bionetworks / synapsePythonClient / tests / unit / unit_test_credentials / unit_test_cached_sessions.py View on Github external
def setup(self):
        read_session_cache_patcher = patch.object(cached_sessions, "_read_session_cache")
        set_most_recent_user_patcher = patch.object(cached_sessions, "set_most_recent_user")
        set_api_key_patcher = patch.object(cached_sessions, "set_api_key")
        os_patcher = patch.object(cached_sessions, 'os')
        equals_path_patcher = patch.object(cached_sessions, 'equal_paths')
        self.patchers = [read_session_cache_patcher, set_most_recent_user_patcher, set_api_key_patcher, os_patcher,
                         equals_path_patcher]

        self.mock_syn = create_autospec(Synapse())

        self.mock_read_session_cache = read_session_cache_patcher.start()
        self.mock_set_most_recent_user = set_most_recent_user_patcher.start()
        self.mock_set_api_key = set_api_key_patcher.start()
        self.mock_os = os_patcher.start()
        self.mock_equals_path = equals_path_patcher.start()

        self.file_path = "/asdf/asdf/asdf/.session"
        self.mock_os.path.join.return_value = self.file_path
github nsalomonis / altanalyze / stats_scripts / metaDataAnalysis.py View on Github external
if opt == '--dPSI':
                log_fold_cutoff = float(arg)
            if opt == '--u':
                if string.lower(arg) == 'yes' or string.lower(arg) == 'true':
                    uniqueDonors=True
                    use_adjusted_p = False
                else:
                    uniqueDonors = False
                    if string.lower(arg) == 'both':
                        runAgain = True

    if len(used)>0:
        ###Upload existing results folder to Synapse
        import synapseclient
        import os,sys,string,shutil,getopt
        syn = synapseclient.Synapse()
        syn.login()
        synapseDirectoryUpload(target_dir, parent_syn, executed_urls, used)
        sys.exit()
    elif compareEnrichmentProfiles:
        #print expression_files
        compareGOEliteEnrichmentProfiles(expression_files[0],expression_files[1])
    elif runGOElite:
        runGOEliteAnalysis(species,expression_files[0])
    elif (len(expression_files)==1 and '.txt' in expression_files[0]) or (len(expression_files)==1 and 'syn' in expression_files[0]):
        ### Perform a covariate based analysis on the lone input expression file
        metadata_file = metadata_files[0]
        if 'syn' in metadata_file:
            try: metadata_file = downloadSynapseFile(metadata_file,output_dir)
            except Exception:
                print 'Is the destination file %s already open?' % metadata_file;sys.exit()
        expression_file = expression_files[0]
github Sage-Bionetworks / synapsePythonClient / synapseclient / __main__.py View on Github external
def main():
    args = build_parser().parse_args()
    synapseclient.USER_AGENT['User-Agent'] = "synapsecommandlineclient " + synapseclient.USER_AGENT['User-Agent']
    syn = synapseclient.Synapse(debug=args.debug, skip_checks=args.skip_checks)
    if not ('func' in args and args.func == login):
        # if we're not executing the "login" operation, automatically authenticate before running operation
        login_with_prompt(syn, args.synapseUser, args.synapsePassword, silent=True)
    perform_main(args, syn)
github nsalomonis / altanalyze / stats_scripts / metaDataAnalysis.py View on Github external
def downloadSynapseFile(synid,output_dir):
    import synapseclient
    import os,sys,string,shutil
    syn = synapseclient.Synapse()
    syn.login()
    matrix = syn.get(synid, downloadLocation=output_dir, ifcollision="keep.local")
    return matrix.path