Data Files

Generic data-file operations are accessed via Client.data.

Upload a data file:

from pathlib import Path
from flowbio.v2 import Client, TokenCredentials

client = Client()
client.log_in(TokenCredentials(token))

data = client.data.upload_data(Path("counts.tsv"))
print(data.id)

Uploading Data Files

Use upload_data() to upload a generic data file. The file is uploaded in chunks and the created data file is returned:

from pathlib import Path

data = client.data.upload_data(Path("counts.tsv"))
print(f"Data ID: {data.id}")

Store the file under a different name than the local path with the filename override (the name must contain no spaces):

data = client.data.upload_data(
    Path("counts.tsv"),
    filename="experiment_42_counts.tsv",
)

Tag the file with a DataType identifier, or upload an archive for the server to unpack:

data = client.data.upload_data(Path("reads.bam"), data_type="bam")

archive = client.data.upload_data(Path("results.zip"), is_directory=True)

See upload_data() for the full list of parameters.

API Reference

class flowbio.v2.data.DataResource(uploader)

Provides access to generic data-file API endpoints.

Accessed via Client.data:

client = Client()
data = client.data.upload_data(Path("counts.tsv"))
upload_data(path, filename=None, data_type=None, is_directory=False)

Upload a generic data file to the Flow platform.

Uploads the file in chunks (chunk size and progress display are controlled via flowbio.v2.ClientConfig) and returns the created data file.

Requires authentication.

Example:

from pathlib import Path

data = client.data.upload_data(Path("counts.tsv"))
print(f"Data ID: {data.id}")
Parameters:
  • path (Path) – The local file to upload.

  • filename (str | None) – Optional override for the name the file is stored under on Flow. Defaults to path.name. Useful when reading from a local path but storing under a different name. Must contain no spaces — the server rejects spaces with a BadRequestError.

  • data_type (str | None) – Optional DataType identifier. Validated server-side only; an invalid value raises a BadRequestError.

  • is_directory (bool) – When True, the server treats the upload as an archive and unpacks it. path must then point at a .zip/.tar/.tar.gz.

Return type:

Data

Returns:

The created Data.

Raises:

Models

pydantic model flowbio.v2.data.Data

A data file on the Flow platform. For now this only includes id, but when we add methods to retrieve data files with more detail, more fields will be added.

field id: str [Required]

The unique identifier of the data file.