scallops.io.read_in_situ_reads_and_barcodes

scallops.io.read_in_situ_reads_and_barcodes(reads_directory, barcodes_path, barcode_indices, reads_pattern)
Load reads and barcodes information for in situ experiments. This function loads reads and

barcodes information from the specified directories and files. It also matches reads with barcodes and adds a ‘barcode_match’ column to the reads DataFrame.

param reads_directory:

Path to the directory containing reads information.

param barcodes_path:

Path to the file containing barcodes information.

param barcode_indices:

Optional list of indices (0-based) to extract from the barcode column.

param reads_pattern:

Optional pattern to filter read paths.

return:

Tuple containing DataFrames for reads and barcodes.

example:

import scallops.io

# Define paths and parameters
reads_directory = "path/to/reads/directory"
barcodes_path = "path/to/barcodes/file.csv"
barcode_indices = [
    0,
    1,
    2,
]  # Optional list of indices to extract from the barcode column
reads_pattern = "*.csv"  # Optional pattern to filter read paths

# Load reads and barcodes
reads, barcodes = scallops.io.read_in_situ_reads_and_barcodes(
    reads_directory, barcodes_path, barcode_indices, reads_pattern
)

# Display loaded data
print("Reads DataFrame:")
print(reads.head())
print("
Barcodes DataFrame:”)

print(barcodes.head())

Parameters:
  • reads_directory (str)

  • barcodes_path (str)

  • barcode_indices (None | Sequence[int])

  • reads_pattern (None | str)

Return type:

tuple[DataFrame, DataFrame]