Currently, segger outputs a segger_segmentation.parquet file, which contains only the row_index and segger derived similarity and thresholds. If users want to use this data for downstream analyses, they need to be confident in handling this data:
- Add row index to the input transcripts
- Merge input transcripts and output segger values
- Filter by
qv and segger_similarity thresholds
Example:
import polars as pl
from segger.io import get_preprocessor, StandardTranscriptFields
std = StandardTranscriptFields()
tx = get_preprocessor(source_path).transcripts # polars DataFrame; qv >= 20 already applied
seg = pl.read_parquet("outputs/segger_segmentation.parquet")
merged = tx.join(seg, on=std.row_index, how="left") # row_index aligns rows across both tables
assigned = merged.filter(
pl.col("segger_cell_id").is_not_null()
& (pl.col("segger_similarity") >= pl.col("similarity_threshold")) # per-gene threshold
If the order is shuffled, or a step skipped, the resulting dataset will be noisy or plainly wrong. See #4 which accidentally skipped an important step during anndata creation.
I'd like to propose to store a "complete" anndata file, which contains the columns [x, y, feature_name, cell_id, filtered, segger_similarity, segger_threshold] (maybe more?), and has the same shape and order as the input transcripts. filtered should be True if a transcript is assigned (qv > 20 per default, similarty > threshold, converged = True, cell_id != None).
Some benefits:
- For less experienced segger users and bots, this will significantly simplify and reduce errors when working with segger outputs
- Segger outputs can be shared, without necessarily requiring the input dataset
Open for discussion. @EliHei2 @andrewmoorman
Currently, segger outputs a
segger_segmentation.parquetfile, which contains only therow_indexand segger derived similarity and thresholds. If users want to use this data for downstream analyses, they need to be confident in handling this data:qvandsegger_similaritythresholdsExample:
If the order is shuffled, or a step skipped, the resulting dataset will be noisy or plainly wrong. See #4 which accidentally skipped an important step during anndata creation.
I'd like to propose to store a "complete" anndata file, which contains the columns
[x, y, feature_name, cell_id, filtered, segger_similarity, segger_threshold](maybe more?), and has the same shape and order as the input transcripts.filteredshould beTrueif a transcript is assigned (qv > 20per default,similarty > threshold,converged = True,cell_id != None).Some benefits:
Open for discussion. @EliHei2 @andrewmoorman