Skip to content
This repository was archived by the owner on Oct 2, 2021. It is now read-only.

Latest commit

 

History

History
84 lines (55 loc) · 3.63 KB

README.rst

File metadata and controls

84 lines (55 loc) · 3.63 KB

The GenomeSpace Project has been discontinued

Python bindings and commandline client to the GenomeSpace API

latest version available on PyPI Code Coverage Travis Build Status Documentation Status

This is a python client for the GenomeSpace API. There's a Python API (the genomespaceclient module), and a command-line script (genomespace).

Installation

Install the latest release from PyPi:

pip install python-genomespaceclient

Commandline usage example

# Create remote folder, including all intermediate paths
genomespace -u <username> -p <password> mkdir -p https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/f1/f2/

# copy local files recursively to remote location
genomespace -u <username> -p <password> cp -R /tmp/ https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/

# copy local files matching pattern to remote location - note that paths with wildcards must be enclosed in quotes
genomespace -u <username> -p <password> cp '/tmp/*.txt' https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/

# list remote files
genomespace -u <username> -p <password> ls https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/

# move remote file to new location
genomespace -u <username> -p <password> mv https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/hello.txt https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/world.txt

# download remote files matching pattern, with verbose output
genomespace -vvv -u <username> -p <password> mv https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/*.txt /tmp/

# delete remote file
genomespace -u <username> -p <password> rm https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/world.txt

Python usage example

from genomespaceclient import GenomeSpaceClient

client = GenomeSpaceClient(username="<username>", password="<password>")
client.mkdir("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/f1/f2". create_path=True)
client.copy("/tmp/", "https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/", recurse=True)
client.list("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/")
client.move("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/hello.txt", "https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/world.txt")
client.copy("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/*.txt", "/tmp/")
client.delete("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/*.txt")

Documentation

Documentation can be found at https://python-genomespaceclient.readthedocs.org.