Skip to content

Multi-account basespace file downloader

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

dweb0/basespace-dl

Repository files navigation

basespace-dl

Build Status Build status GitHub release

Download files from projects across multiple basespace accounts.

Features

  • Easy syntax basespace-dl PROJECT
  • Multiple accounts (one time config file setup)
  • Fast (concurrent fetching and downloading)
  • Only download what you need (using regex patterns)

Demo

Demo

Demo data from Basespace's "Public Data"

Examples

List ALL projects

basespace-dl ALL

Download all files from a project

basespace-dl project17890

Download files that match a regex pattern

basespace-dl project17890 -p "(A01|B02|F10)"

Include Undetermined files

basespace-dl project17890 -U

List files from a specific project

basespace-dl project17890 -F

For some more advanced examples of what you can do, check out the cookbook.

Installation

Using macOS Homebrew or Linuxbrew

brew install dweb0/all/basespace-dl

To upgrade to the latest version

brew update
brew upgrade basespace-dl

Using cargo (for rust developers)

cargo install --git https://github.com/dweb0/basespace-dl

Or you can download a pre-built binary for Mac, Windows, or Linux on the releases page.

Getting started

After installation, you will need to set up your config file. The format is a simple key-value toml stored in ~/.config/basespace-dl/default.toml.

# UserID = "access_token"
11111111 = "youraccesstokenforaccount1goeshere"
22222222 = "youraccesstokenforaccount2goeshere"
33333333 = "youraccesstokenforaccount3goeshere"

To link an account, we need to retrieve two things: the access token and its respective userID.

Getting access token

  1. Go to the developer dashboard.
  2. Create a new app.
  3. Navigate to the "Credentials" tab, and copy the "Access Token".

Getting user ID

Now that you have your token, we can run a curl command to get your user ID. Look for the "Id" field in the output.

TOKEN="STORE_YOUR_TOKEN_HERE"
curl "https://api.basespace.illumina.com/v1pre3/users/current/" -H "x-access-token: $TOKEN"

You can also go to https://api.basespace.illumina.com/v1pre3/users/current while logged in to see the same thing.

Final steps

Add the "user_id = access_token" pair to the config file. Do this for each account you would like to link.

Note: It's a good idea to set the file permissions as readable / writeable by only you.

chmod 600 ~/.config/basespace-dl/default.toml

Now you're ready to go!

Try running a command to see if it works (assuming you have projects in your account).

basespace-dl ALL