snakemake.remote package

Submodules

snakemake.remote.EGA module

class snakemake.remote.EGA.EGAFile(dataset, path)

基类:tuple

dataset

Alias for field number 0

path

Alias for field number 1

class snakemake.remote.EGA.EGAFileInfo(size, status, id, checksum)

基类:tuple

checksum

Alias for field number 3

id

Alias for field number 2

size

Alias for field number 0

status

Alias for field number 1

class snakemake.remote.EGA.RemoteObject(*args, protocol=None, keep_local=False, stay_on_remote=False, provider=None, **kwargs)[源代码]

基类:snakemake.remote.AbstractRemoteObject

download()[源代码]
exists()[源代码]
mtime()[源代码]
parts
size()[源代码]
class snakemake.remote.EGA.RemoteProvider(*args, keep_local=False, stay_on_remote=False, is_default=False, retry=5, **kwargs)[源代码]

基类:snakemake.remote.AbstractRemoteProvider

api_request(url_suffix, url_prefix='https://ega.ebi.ac.uk:8051/elixir/', json=True, post=False, **params)[源代码]

Make an API request.

参数:
available_protocols

List of valid protocols for this remote provider.

default_protocol

The protocol that is prepended to the path when no protocol is specified.

get_files(dataset)[源代码]
token

snakemake.remote.FTP module

class snakemake.remote.FTP.RemoteObject(*args, keep_local=False, provider=None, encrypt_data_channel=False, immediate_close=False, **kwargs)[源代码]

基类:snakemake.remote.DomainObject

This is a class to interact with an FTP server.

close()[源代码]
download(make_dest_dirs=True)[源代码]
exists()[源代码]
ftpc()[源代码]
list
mtime()[源代码]
size()[源代码]
upload()[源代码]
class snakemake.remote.FTP.RemoteProvider(*args, keep_local=False, stay_on_remote=False, is_default=False, immediate_close=False, **kwargs)[源代码]

基类:snakemake.remote.AbstractRemoteProvider

allows_directories = True
available_protocols

List of valid protocols for this remote provider.

default_protocol

The protocol that is prepended to the path when no protocol is specified.

remote(value, *args, encrypt_data_channel=None, immediate_close=None, **kwargs)[源代码]
supports_default = True

snakemake.remote.GS module

snakemake.remote.HTTP module

class snakemake.remote.HTTP.RemoteObject(*args, keep_local=False, provider=None, additional_request_string='', allow_redirects=True, **kwargs)[源代码]

基类:snakemake.remote.DomainObject

This is a class to interact with an HTTP server.

download(make_dest_dirs=True)[源代码]
exists()[源代码]
get_header_item(httpr, header_name, default)[源代码]

Since HTTP header capitalization may differ, this returns a header value regardless of case

httpr(verb='GET', stream=False)[源代码]
list
mtime()[源代码]
size()[源代码]
upload()[源代码]
class snakemake.remote.HTTP.RemoteProvider(*args, keep_local=False, stay_on_remote=False, is_default=False, **kwargs)[源代码]

基类:snakemake.remote.AbstractRemoteProvider

available_protocols

List of valid protocols for this remote provider.

default_protocol

The protocol that is prepended to the path when no protocol is specified.

remote(value, *args, insecure=None, **kwargs)[源代码]

snakemake.remote.NCBI module

snakemake.remote.S3 module

class snakemake.remote.S3.RemoteObject(*args, keep_local=False, provider=None, **kwargs)[源代码]

基类:snakemake.remote.AbstractRemoteObject

This is a class to interact with the AWS S3 object store.

download()[源代码]
exists()[源代码]
list
mtime()[源代码]
name
s3_bucket
s3_create_stub()[源代码]
s3_key
size()[源代码]
upload()[源代码]
class snakemake.remote.S3.RemoteProvider(*args, stay_on_remote=False, keep_local=False, is_default=False, **kwargs)[源代码]

基类:snakemake.remote.AbstractRemoteProvider

available_protocols

List of valid protocols for this remote provider.

default_protocol

The protocol that is prepended to the path when no protocol is specified.

remote_interface()[源代码]
supports_default = True
class snakemake.remote.S3.S3Helper(*args, **kwargs)[源代码]

基类:object

bucket_exists(bucket_name)[源代码]
delete_from_bucket(bucket_name, key)[源代码]

Delete a file from s3

This function deletes an object from a specified AWS S3 bucket.

参数:
  • bucket_name – the name of the S3 bucket to use (bucket name only, not ARN)
  • key – the key of the object to delete from the bucket
返回:

The name of the object deleted

download_from_s3(bucket_name, key, destination_path=None, expandKeyIntoDirs=True, make_dest_dirs=True, create_stub_only=False)[源代码]

Download a file from s3

This function downloads an object from a specified AWS S3 bucket.

参数:
  • bucket_name – the name of the S3 bucket to use (bucket name only, not ARN)
  • destination_path – If specified, the file will be saved to this path, otherwise cwd.
  • expandKeyIntoDirs – Since S3 keys can include slashes, if this is True (defult) then S3 keys with slashes are expanded into directories on the receiving end. If it is False, the key is passed to os.path.basename() to get the substring following the last slash.
  • make_dest_dirs – If this is True (default) and the destination path includes directories that do not exist, they will be created.
返回:

The destination path of the downloaded file on the receiving end, or None if the destination_path could not be downloaded

exists_in_bucket(bucket_name, key)[源代码]

Returns whether the key exists in the bucket

参数:
  • bucket_name – the name of the S3 bucket to use (bucket name only, not ARN)
  • key – the key of the object to delete from the bucket
返回:

True | False

key_last_modified(bucket_name, key)[源代码]

Returns a timestamp of a key based on a HEAD request

参数:
  • bucket_name – the name of the S3 bucket to use (bucket name only, not ARN)
  • key – the key of the object to delete from the bucket
返回:

timestamp

key_size(bucket_name, key)[源代码]

Returns the size of a key based on a HEAD request

参数:
  • bucket_name – the name of the S3 bucket to use (bucket name only, not ARN)
  • key – the key of the object to delete from the bucket
返回:

Size in kb

list_keys(bucket_name)[源代码]
upload_to_s3(bucket_name, file_path, key=None, use_relative_path_for_key=True, relative_start_dir=None, extra_args=None, config=None)[源代码]

Upload a file to S3

This function uploads a file to an AWS S3 bucket.

参数:
  • bucket_name – the name of the S3 bucket to use (bucket name only, not ARN)
  • file_path – The path to the file to upload.
  • key – The key to set for the file on S3. If not specified, this will default to the name of the file.
  • use_relative_path_for_key – If set to True (default), and key is None, the S3 key will include slashes representing the path of the file relative to the CWD. If False only the file basename will be used for the key.
  • relative_start_dir – The start dir to use for use_relative_path_for_key. No effect if key is set.

Returns: The key of the file on S3 if written, None otherwise

snakemake.remote.S3Mocked module

snakemake.remote.SFTP module

class snakemake.remote.SFTP.RemoteObject(*args, keep_local=False, provider=None, **kwargs)[源代码]

基类:snakemake.remote.DomainObject

This is a class to interact with an SFTP server.

download(make_dest_dirs=True)[源代码]
exists()[源代码]
is_newer(time)[源代码]

Returns true if the file is newer than time, or if it is a symlink that points to a file newer than time.

list
mtime()[源代码]
sftpc()[源代码]
size()[源代码]
upload()[源代码]
class snakemake.remote.SFTP.RemoteProvider(*args, keep_local=False, stay_on_remote=False, is_default=False, **kwargs)[源代码]

基类:snakemake.remote.AbstractRemoteProvider

allows_directories = True
available_protocols

List of valid protocols for this remote provider.

default_protocol

The protocol that is prepended to the path when no protocol is specified.

supports_default = True

snakemake.remote.XRootD module

snakemake.remote.dropbox module

class snakemake.remote.dropbox.RemoteObject(*args, keep_local=False, provider=None, **kwargs)[源代码]

基类:snakemake.remote.AbstractRemoteObject

This is a class to interact with the Dropbox API.

download(make_dest_dirs=True)[源代码]
dropbox_file()[源代码]
exists()[源代码]
list
mtime()[源代码]
name
size()[源代码]
upload(mode=WriteMode('overwrite', None))[源代码]
class snakemake.remote.dropbox.RemoteProvider(*args, keep_local=False, stay_on_remote=False, is_default=False, **kwargs)[源代码]

基类:snakemake.remote.AbstractRemoteProvider

available_protocols

List of valid protocols for this remote provider.

default_protocol

The protocol that is prepended to the path when no protocol is specified.

remote_interface()[源代码]

snakemake.remote.gfal module

snakemake.remote.gridftp module

snakemake.remote.iRODS module

snakemake.remote.webdav module

class snakemake.remote.webdav.RemoteObject(*args, keep_local=False, **kwargs)[源代码]

基类:snakemake.remote.DomainObject

This is a class to interact with a WebDAV file store.

download(make_dest_dirs=True)[源代码]
exists()[源代码]
list
mtime()[源代码]
name
size()[源代码]
upload()[源代码]
webdav_file
webdavc()[源代码]
class snakemake.remote.webdav.RemoteProvider(*args, keep_local=False, stay_on_remote=False, is_default=False, **kwargs)[源代码]

基类:snakemake.remote.AbstractRemoteProvider

available_protocols

List of valid protocols for this remote provider.

default_protocol

The protocol that is prepended to the path when no protocol is specified.

Module contents

class snakemake.remote.AbstractRemoteObject(*args, protocol=None, keep_local=False, stay_on_remote=False, provider=None, **kwargs)[源代码]

基类:object

This is an abstract class to be used to derive remote object classes for different cloud storage providers. For example, there could be classes for interacting with Amazon AWS S3 and Google Cloud Storage, both derived from this common base class.

close()[源代码]
download(*args, **kwargs)[源代码]
exists()[源代码]
file()[源代码]
list(*args, **kwargs)[源代码]
local_file()[源代码]
local_touch_or_create()[源代码]
mtime()[源代码]
name(*args, **kwargs)[源代码]
remote(value, keep_local=False, stay_on_remote=False)[源代码]
remote_file()[源代码]
remove()[源代码]
size()[源代码]
upload(*args, **kwargs)[源代码]
class snakemake.remote.AbstractRemoteProvider(*args, keep_local=False, stay_on_remote=False, is_default=False, **kwargs)[源代码]

基类:object

This is an abstract class to be used to derive remote provider classes. These might be used to hold common credentials, and are then passed to RemoteObjects.

allows_directories = False
available_protocols()[源代码]

List of valid protocols for this remote provider.

default_protocol()[源代码]

The protocol that is prepended to the path when no protocol is specified.

glob_wildcards(pattern, *args, **kwargs)[源代码]
remote(value, *args, keep_local=None, stay_on_remote=None, static=False, **kwargs)[源代码]
remote_interface()[源代码]
supports_default = False
class snakemake.remote.DomainObject(*args, **kwargs)[源代码]

基类:snakemake.remote.AbstractRemoteObject

This is a mixin related to parsing components out of a location path specified as (host|IP):port/remote/location

host
local_path
name
path_prefix
path_remainder
port
remote_path
class snakemake.remote.StaticRemoteObjectProxy[源代码]

基类:ObjectProxy

Proxy that implements static-ness for remote objects.

The constructor takes a real RemoteObject and returns a proxy that behaves the same except for the exists() and mtime() methods.

exists()[源代码]
is_newer(time)[源代码]
mtime()[源代码]