scallops.io.read_barcodes
- scallops.io.read_barcodes(barcodes_path, barcode_indices, barcode_column='barcode')
Load barcodes from a CSV file.
This function reads barcodes from a CSV file. It optionally allows selecting specific indices from the barcode column. It performs validation to ensure all barcodes have the same length.
- Parameters:
barcodes_path (str) – Path to the CSV file containing barcodes.
barcode_indices (None | Sequence[int]) – Optional list of indices (0-based) to extract from the barcode column.
barcode_column (str) – Name of the barcode column in the CSV file.
- Returns:
DataFrame containing the loaded barcodes.
- Example:
- Return type:
DataFrame
import scallops.io # Define the path to the barcodes CSV file barcodes_path = "path/to/barcodes.csv" # Load barcodes without selecting specific indices barcodes_df = scallops.io.read_barcodes(barcodes_path) print(barcodes_df.head()) # Load barcodes and select specific indices selected_indices = [0, 1, 2] barcodes_df_selected = scallops.io.read_barcodes( barcodes_path, barcode_indices=selected_indices ) print(barcodes_df_selected.head())