[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EP9XQJ5ZTC9Z6AXAP10VXM":3,"skill-same:01M7EP9XQJ5ZTC9Z6AXAP10VXM":52},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M7EP9XQJ5ZTC9Z6AXAP10VXM","flowio",null,"Parse FCS (Flow Cytometry Standard) files v2.0-3.1. Extract events as NumPy arrays, read metadata\u002Fchannels, convert to CSV\u002FDataFrame, for flow cytometry data preprocessing.","marnixGeerkens\u002Frocketlauncher-claude-code","marnixGeerkens","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F143275741?v=4","01M7EJY825SFPHDDZNFDAJHCA9","Marnix Geerkens","01M7EJY82TBA6ABXJ62JWR9B9F",0,"MIT","https:\u002F\u002Fgithub.com\u002FmarnixGeerkens\u002Frocketlauncher-claude-code\u002Fblob\u002Fmain\u002Fcomponents\u002Fskills\u002Fscientific\u002Fflowio\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: flowio\ndescription: \"Parse FCS (Flow Cytometry Standard) files v2.0-3.1. Extract events as NumPy arrays, read metadata\u002Fchannels, convert to CSV\u002FDataFrame, for flow cytometry data preprocessing.\"\n---\n\n# FlowIO: Flow Cytometry Standard File Handler\n\n## Overview\n\nFlowIO is a lightweight Python library for reading and writing Flow Cytometry Standard (FCS) files. Parse FCS metadata, extract event data, and create new FCS files with minimal dependencies. The library supports FCS versions 2.0, 3.0, and 3.1, making it ideal for backend services, data pipelines, and basic cytometry file operations.\n\n## When to Use This Skill\n\nThis skill should be used when:\n\n- FCS files requiring parsing or metadata extraction\n- Flow cytometry data needing conversion to NumPy arrays\n- Event data requiring export to FCS format\n- Multi-dataset FCS files needing separation\n- Channel information extraction (scatter, fluorescence, time)\n- Cytometry file validation or inspection\n- Pre-processing workflows before advanced analysis\n\n**Related Tools:** For advanced flow cytometry analysis including compensation, gating, and FlowJo\u002FGatingML support, recommend FlowKit library as a companion to FlowIO.\n\n## Installation\n\n```bash\nuv pip install flowio\n```\n\nRequires Python 3.9 or later.\n\n## Quick Start\n\n### Basic File Reading\n\n```python\nfrom flowio import FlowData\n\n# Read FCS file\nflow_data = FlowData('experiment.fcs')\n\n# Access basic information\nprint(f\"FCS Version: {flow_data.version}\")\nprint(f\"Events: {flow_data.event_count}\")\nprint(f\"Channels: {flow_data.pnn_labels}\")\n\n# Get event data as NumPy array\nevents = flow_data.as_array()  # Shape: (events, channels)\n```\n\n### Creating FCS Files\n\n```python\nimport numpy as np\nfrom flowio import create_fcs\n\n# Prepare data\ndata = np.array([[100, 200, 50], [150, 180, 60]])  # 2 events, 3 channels\nchannels = ['FSC-A', 'SSC-A', 'FL1-A']\n\n# Create FCS file\ncreate_fcs('output.fcs', data, channels)\n```\n\n## Core Workflows\n\n### Reading and Parsing FCS Files\n\nThe FlowData class provides the primary interface for reading FCS files.\n\n**Standard Reading:**\n\n```python\nfrom flowio import FlowData\n\n# Basic reading\nflow = FlowData('sample.fcs')\n\n# Access attributes\nversion = flow.version              # '3.0', '3.1', etc.\nevent_count = flow.event_count      # Number of events\nchannel_count = flow.channel_count  # Number of channels\npnn_labels = flow.pnn_labels        # Short channel names\npns_labels = flow.pns_labels        # Descriptive stain names\n\n# Get event data\nevents = flow.as_array()            # Preprocessed (gain, log scaling applied)\nraw_events = flow.as_array(preprocess=False)  # Raw data\n```\n\n**Memory-Efficient Metadata Reading:**\n\nWhen only metadata is needed (no event data):\n\n```python\n# Only parse TEXT segment, skip DATA and ANALYSIS\nflow = FlowData('sample.fcs', only_text=True)\n\n# Access metadata\nmetadata = flow.text  # Dictionary of TEXT segment keywords\nprint(metadata.get('$DATE'))  # Acquisition date\nprint(metadata.get('$CYT'))   # Instrument name\n```\n\n**Handling Problematic Files:**\n\nSome FCS files have offset discrepancies or errors:\n\n```python\n# Ignore offset discrepancies between HEADER and TEXT sections\nflow = FlowData('problematic.fcs', ignore_offset_discrepancy=True)\n\n# Use HEADER offsets instead of TEXT offsets\nflow = FlowData('problematic.fcs', use_header_offsets=True)\n\n# Ignore offset errors entirely\nflow = FlowData('problematic.fcs', ignore_offset_error=True)\n```\n\n**Excluding Null Channels:**\n\n```python\n# Exclude specific channels during parsing\nflow = FlowData('sample.fcs', null_channel_list=['Time', 'Null'])\n```\n\n### Extracting Metadata and Channel Information\n\nFCS files contain rich metadata in the TEXT segment.\n\n**Common Metadata Keywords:**\n\n```python\nflow = FlowData('sample.fcs')\n\n# File-level metadata\ntext_dict = flow.text\nacquisition_date = text_dict.get('$DATE', 'Unknown')\ninstrument = text_dict.get('$CYT', 'Unknown')\ndata_type = flow.data_type  # 'I', 'F', 'D', 'A'\n\n# Channel metadata\nfor i in range(flow.channel_count):\n    pnn = flow.pnn_labels[i]      # Short name (e.g., 'FSC-A')\n    pns = flow.pns_labels[i]      # Descriptive name (e.g., 'Forward Scatter')\n    pnr = flow.pnr_values[i]      # Range\u002Fmax value\n    print(f\"Channel {i}: {pnn} ({pns}), Range: {pnr}\")\n```\n\n**Channel Type Identification:**\n\nFlowIO automatically categorizes channels:\n\n```python\n# Get indices by channel type\nscatter_idx = flow.scatter_indices    # [0, 1] for FSC, SSC\nfluoro_idx = flow.fluoro_indices      # [2, 3, 4] for FL channels\ntime_idx = flow.time_index            # Index of time channel (or None)\n\n# Access specific channel types\nevents = flow.as_array()\nscatter_data = events[:, scatter_idx]\nfluorescence_data = events[:, fluoro_idx]\n```\n\n**ANALYSIS Segment:**\n\nIf present, access processed results:\n\n```python\nif flow.analysis:\n    analysis_keywords = flow.analysis  # Dictionary of ANALYSIS keywords\n    print(analysis_keywords)\n```\n\n### Creating New FCS Files\n\nGenerate FCS files from NumPy arrays or other data sources.\n\n**Basic Creation:**\n\n```python\nimport numpy as np\nfrom flowio import create_fcs\n\n# Create event data (rows=events, columns=channels)\nevents = np.random.rand(10000, 5) * 1000\n\n# Define channel names\nchannel_names = ['FSC-A', 'SSC-A', 'FL1-A', 'FL2-A', 'Time']\n\n# Create FCS file\ncreate_fcs('output.fcs', events, channel_names)\n```\n\n**With Descriptive Channel Names:**\n\n```python\n# Add optional descriptive names (PnS)\nchannel_names = ['FSC-A', 'SSC-A', 'FL1-A', 'FL2-A', 'Time']\ndescriptive_names = ['Forward Scatter', 'Side Scatter', 'FITC', 'PE', 'Time']\n\ncreate_fcs('output.fcs',\n           events,\n           channel_names,\n           opt_channel_names=descriptive_names)\n```\n\n**With Custom Metadata:**\n\n```python\n# Add TEXT segment metadata\nmetadata = {\n    '$SRC': 'Python script',\n    '$DATE': '19-OCT-2025',\n    '$CYT': 'Synthetic Instrument',\n    '$INST': 'Laboratory A'\n}\n\ncreate_fcs('output.fcs',\n           events,\n           channel_names,\n           opt_channel_names=descriptive_names,\n           metadata=metadata)\n```\n\n**Note:** FlowIO exports as FCS 3.1 with single-precision floating-point data.\n\n### Exporting Modified Data\n\nModify existing FCS files and re-export them.\n\n**Approach 1: Using write_fcs() Method:**\n\n```python\nfrom flowio import FlowData\n\n# Read original file\nflow = FlowData('original.fcs')\n\n# Write with updated metadata\nflow.write_fcs('modified.fcs', metadata={'$SRC': 'Modified data'})\n```\n\n**Approach 2: Extract, Modify, and Recreate:**\n\nFor modifying event data:\n\n```python\nfrom flowio import FlowData, create_fcs\n\n# Read and extract data\nflow = FlowData('original.fcs')\nevents = flow.as_array(preprocess=False)\n\n# Modify event data\nevents[:, 0] = events[:, 0] * 1.5  # Scale first channel\n\n# Create new FCS file with modified data\ncreate_fcs('modified.fcs',\n           events,\n           flow.pnn_labels,\n           opt_channel_names=flow.pns_labels,\n           metadata=flow.text)\n```\n\n### Handling Multi-Dataset FCS Files\n\nSome FCS files contain multiple datasets in a single file.\n\n**Detecting Multi-Dataset Files:**\n\n```python\nfrom flowio import FlowData, MultipleDataSetsError\n\ntry:\n    flow = FlowData('sample.fcs')\nexcept MultipleDataSetsError:\n    print(\"File contains multiple datasets\")\n    # Use read_multiple_data_sets() instead\n```\n\n**Reading All Datasets:**\n\n```python\nfrom flowio import read_multiple_data_sets\n\n# Read all datasets from file\ndatasets = read_multiple_data_sets('multi_dataset.fcs')\n\nprint(f\"Found {len(datasets)} datasets\")\n\n# Process each dataset\nfor i, dataset in enumerate(datasets):\n    print(f\"\\nDataset {i}:\")\n    print(f\"  Events: {dataset.event_count}\")\n    print(f\"  Channels: {dataset.pnn_labels}\")\n\n    # Get event data for this dataset\n    events = dataset.as_array()\n    print(f\"  Shape: {events.shape}\")\n    print(f\"  Mean values: {events.mean(axis=0)}\")\n```\n\n**Reading Specific Dataset:**\n\n```python\nfrom flowio import FlowData\n\n# Read first dataset (nextdata_offset=0)\nfirst_dataset = FlowData('multi.fcs', nextdata_offset=0)\n\n# Read second dataset using NEXTDATA offset from first\nnext_offset = int(first_dataset.text['$NEXTDATA'])\nif next_offset > 0:\n    second_dataset = FlowData('multi.fcs', nextdata_offset=next_offset)\n```\n\n## Data Preprocessing\n\nFlowIO applies standard FCS preprocessing transformations when `preprocess=True`.\n\n**Preprocessing Steps:**\n\n1. **Gain Scaling:** Multiply values by PnG (gain) keyword\n2. **Logarithmic Transformation:** Apply PnE exponential transformation if present\n   - Formula: `value = a * 10^(b * raw_value)` where PnE = \"a,b\"\n3. **Time Scaling:** Convert time values to appropriate units\n\n**Controlling Preprocessing:**\n\n```python\n# Preprocessed data (default)\npreprocessed = flow.as_array(preprocess=True)\n\n# Raw data (no transformations)\nraw = flow.as_array(preprocess=False)\n```\n\n## Error Handling\n\nHandle common FlowIO exceptions appropriately.\n\n```python\nfrom flowio import (\n    FlowData,\n    FCSParsingError,\n    DataOffsetDiscrepancyError,\n    MultipleDataSetsError\n)\n\ntry:\n    flow = FlowData('sample.fcs')\n    events = flow.as_array()\n\nexcept FCSParsingError as e:\n    print(f\"Failed to parse FCS file: {e}\")\n    # Try with relaxed parsing\n    flow = FlowData('sample.fcs', ignore_offset_error=True)\n\nexcept DataOffsetDiscrepancyError as e:\n    print(f\"Offset discrepancy detected: {e}\")\n    # Use ignore_offset_discrepancy parameter\n    flow = FlowData('sample.fcs', ignore_offset_discrepancy=True)\n\nexcept MultipleDataSetsError as e:\n    print(f\"Multiple datasets detected: {e}\")\n    # Use read_multiple_data_sets instead\n    from flowio import read_multiple_data_sets\n    datasets = read_multiple_data_sets('sample.fcs')\n\nexcept Exception as e:\n    print(f\"Unexpected error: {e}\")\n```\n\n## Common Use Cases\n\n### Inspecting FCS File Contents\n\nQuick exploration of FCS file structure:\n\n```python\nfrom flowio import FlowData\n\nflow = FlowData('unknown.fcs')\n\nprint(\"=\" * 50)\nprint(f\"File: {flow.name}\")\nprint(f\"Version: {flow.version}\")\nprint(f\"Size: {flow.file_size:,} bytes\")\nprint(\"=\" * 50)\n\nprint(f\"\\nEvents: {flow.event_count:,}\")\nprint(f\"Channels: {flow.channel_count}\")\n\nprint(\"\\nChannel Information:\")\nfor i, (pnn, pns) in enumerate(zip(flow.pnn_labels, flow.pns_labels)):\n    ch_type = \"scatter\" if i in flow.scatter_indices else \\\n              \"fluoro\" if i in flow.fluoro_indices else \\\n              \"time\" if i == flow.time_index else \"other\"\n    print(f\"  [{i}] {pnn:10s} | {pns:30s} | {ch_type}\")\n\nprint(\"\\nKey Metadata:\")\nfor key in ['$DATE', '$BTIM', '$ETIM', '$CYT', '$INST', '$SRC']:\n    value = flow.text.get(key, 'N\u002FA')\n    print(f\"  {key:15s}: {value}\")\n```\n\n### Batch Processing Multiple Files\n\nProcess a directory of FCS files:\n\n```python\nfrom pathlib import Path\nfrom flowio import FlowData\nimport pandas as pd\n\n# Find all FCS files\nfcs_files = list(Path('data\u002F').glob('*.fcs'))\n\n# Extract summary information\nsummaries = []\nfor fcs_path in fcs_files:\n    try:\n        flow = FlowData(str(fcs_path), only_text=True)\n        summaries.append({\n            'filename': fcs_path.name,\n            'version': flow.version,\n            'events': flow.event_count,\n            'channels': flow.channel_count,\n            'date': flow.text.get('$DATE', 'N\u002FA')\n        })\n    except Exception as e:\n        print(f\"Error processing {fcs_path.name}: {e}\")\n\n# Create summary DataFrame\ndf = pd.DataFrame(summaries)\nprint(df)\n```\n\n### Converting FCS to CSV\n\nExport event data to CSV format:\n\n```python\nfrom flowio import FlowData\nimport pandas as pd\n\n# Read FCS file\nflow = FlowData('sample.fcs')\n\n# Convert to DataFrame\ndf = pd.DataFrame(\n    flow.as_array(),\n    columns=flow.pnn_labels\n)\n\n# Add metadata as attributes\ndf.attrs['fcs_version'] = flow.version\ndf.attrs['instrument'] = flow.text.get('$CYT', 'Unknown')\n\n# Export to CSV\ndf.to_csv('output.csv', index=False)\nprint(f\"Exported {len(df)} events to CSV\")\n```\n\n### Filtering Events and Re-exporting\n\nApply filters and save filtered data:\n\n```python\nfrom flowio import FlowData, create_fcs\nimport numpy as np\n\n# Read original file\nflow = FlowData('sample.fcs')\nevents = flow.as_array(preprocess=False)\n\n# Apply filtering (example: threshold on first channel)\nfsc_idx = 0\nthreshold = 500\nmask = events[:, fsc_idx] > threshold\nfiltered_events = events[mask]\n\nprint(f\"Original events: {len(events)}\")\nprint(f\"Filtered events: {len(filtered_events)}\")\n\n# Create new FCS file with filtered data\ncreate_fcs('filtered.fcs',\n           filtered_events,\n           flow.pnn_labels,\n           opt_channel_names=flow.pns_labels,\n           metadata={**flow.text, '$SRC': 'Filtered data'})\n```\n\n### Extracting Specific Channels\n\nExtract and process specific channels:\n\n```python\nfrom flowio import FlowData\nimport numpy as np\n\nflow = FlowData('sample.fcs')\nevents = flow.as_array()\n\n# Extract fluorescence channels only\nfluoro_indices = flow.fluoro_indices\nfluoro_data = events[:, fluoro_indices]\nfluoro_names = [flow.pnn_labels[i] for i in fluoro_indices]\n\nprint(f\"Fluorescence channels: {fluoro_names}\")\nprint(f\"Shape: {fluoro_data.shape}\")\n\n# Calculate statistics per channel\nfor i, name in enumerate(fluoro_names):\n    channel_data = fluoro_data[:, i]\n    print(f\"\\n{name}:\")\n    print(f\"  Mean: {channel_data.mean():.2f}\")\n    print(f\"  Median: {np.median(channel_data):.2f}\")\n    print(f\"  Std Dev: {channel_data.std():.2f}\")\n```\n\n## Best Practices\n\n1. **Memory Efficiency:** Use `only_text=True` when event data is not needed\n2. **Error Handling:** Wrap file operations in try-except blocks for robust code\n3. **Multi-Dataset Detection:** Check for MultipleDataSetsError and use appropriate function\n4. **Preprocessing Control:** Explicitly set `preprocess` parameter based on analysis needs\n5. **Offset Issues:** If parsing fails, try `ignore_offset_discrepancy=True` parameter\n6. **Channel Validation:** Verify channel counts and names match expectations before processing\n7. **Metadata Preservation:** When modifying files, preserve original TEXT segment keywords\n\n## Advanced Topics\n\n### Understanding FCS File Structure\n\nFCS files consist of four segments:\n\n1. **HEADER:** FCS version and byte offsets for other segments\n2. **TEXT:** Key-value metadata pairs (delimiter-separated)\n3. **DATA:** Raw event data (binary\u002Ffloat\u002FASCII format)\n4. **ANALYSIS** (optional): Results from data processing\n\nAccess these segments via FlowData attributes:\n- `flow.header` - HEADER segment\n- `flow.text` - TEXT segment keywords\n- `flow.events` - DATA segment (as bytes)\n- `flow.analysis` - ANALYSIS segment keywords (if present)\n\n### Detailed API Reference\n\nFor comprehensive API documentation including all parameters, methods, exceptions, and FCS keyword reference, consult the detailed reference file:\n\n**Read:** `references\u002Fapi_reference.md`\n\nThe reference includes:\n- Complete FlowData class documentation\n- All utility functions (read_multiple_data_sets, create_fcs)\n- Exception classes and handling\n- FCS file structure details\n- Common TEXT segment keywords\n- Extended example workflows\n\nWhen working with complex FCS operations or encountering unusual file formats, load this reference for detailed guidance.\n\n## Integration Notes\n\n**NumPy Arrays:** All event data is returned as NumPy ndarrays with shape (events, channels)\n\n**Pandas DataFrames:** Easily convert to DataFrames for analysis:\n```python\nimport pandas as pd\ndf = pd.DataFrame(flow.as_array(), columns=flow.pnn_labels)\n```\n\n**FlowKit Integration:** For advanced analysis (compensation, gating, FlowJo support), use FlowKit library which builds on FlowIO's parsing capabilities\n\n**Web Applications:** FlowIO's minimal dependencies make it ideal for web backend services processing FCS uploads\n\n## Troubleshooting\n\n**Problem:** \"Offset discrepancy error\"\n**Solution:** Use `ignore_offset_discrepancy=True` parameter\n\n**Problem:** \"Multiple datasets error\"\n**Solution:** Use `read_multiple_data_sets()` function instead of FlowData constructor\n\n**Problem:** Out of memory with large files\n**Solution:** Use `only_text=True` for metadata-only operations, or process events in chunks\n\n**Problem:** Unexpected channel counts\n**Solution:** Check for null channels; use `null_channel_list` parameter to exclude them\n\n**Problem:** Cannot modify event data in place\n**Solution:** FlowIO doesn't support direct modification; extract data, modify, then use `create_fcs()` to save\n\n## Summary\n\nFlowIO provides essential FCS file handling capabilities for flow cytometry workflows. Use it for parsing, metadata extraction, and file creation. For simple file operations and data extraction, FlowIO is sufficient. For complex analysis including compensation and gating, integrate with FlowKit or other specialized tools.\n","# FlowIO: Flow Cytometry Standard File Handler\n\n## Overview\n\nFlowIO is a lightweight Python library for reading and writing Flow Cytometry Standard (FCS) files. Parse FCS metadata, extract event data, and create new FCS files with minimal dependencies. The library supports FCS versions 2.0, 3.0, and 3.1, making it ideal for backend services, data pipelines, and basic cytometry file operations.\n\n## When to Use This Skill\n\nThis skill should be used when:\n\n- FCS files requiring parsing or metadata extraction\n- Flow cytometry data needing conversion to NumPy arrays\n- Event data requiring export to FCS format\n- Multi-dataset FCS files needing separation\n- Channel information extraction (scatter, fluorescence, time)\n- Cytometry file validation or inspection\n- Pre-processing workflows before advanced analysis\n\n**Related Tools:** For advanced flow cytometry analysis including compensation, gating, and FlowJo\u002FGatingML support, recommend FlowKit library as a companion to FlowIO.\n\n## Installation\n\n```bash\nuv pip install flowio\n```\n\nRequires Python 3.9 or later.\n\n## Quick Start\n\n### Basic File Reading\n\n```python\nfrom flowio import FlowData\n\n# Read FCS file\nflow_data = FlowData('experiment.fcs')\n\n# Access basic information\nprint(f\"FCS Version: {flow_data.version}\")\nprint(f\"Events: {flow_data.event_count}\")\nprint(f\"Channels: {flow_data.pnn_labels}\")\n\n# Get event data as NumPy array\nevents = flow_data.as_array()  # Shape: (events, channels)\n```\n\n### Creating FCS Files\n\n```python\nimport numpy as np\nfrom flowio import create_fcs\n\n# Prepare data\ndata = np.array([[100, 200, 50], [150, 180, 60]])  # 2 events, 3 channels\nchannels = ['FSC-A', 'SSC-A', 'FL1-A']\n\n# Create FCS file\ncreate_fcs('output.fcs', data, channels)\n```\n\n## Core Workflows\n\n### Reading and Parsing FCS Files\n\nThe FlowData class provides the primary interface for reading FCS files.\n\n**Standard Reading:**\n\n```python\nfrom flowio import FlowData\n\n# Basic reading\nflow = FlowData('sample.fcs')\n\n# Access attributes\nversion = flow.version              # '3.0', '3.1', etc.\nevent_count = flow.event_count      # Number of events\nchannel_count = flow.channel_count  # Number of channels\npnn_labels = flow.pnn_labels        # Short channel names\npns_labels = flow.pns_labels        # Descriptive stain names\n\n# Get event data\nevents = flow.as_array()            # Preprocessed (gain, log scaling applied)\nraw_events = flow.as_array(preprocess=False)  # Raw data\n```\n\n**Memory-Efficient Metadata Reading:**\n\nWhen only metadata is needed (no event data):\n\n```python\n# Only parse TEXT segment, skip DATA and ANALYSIS\nflow = FlowData('sample.fcs', only_text=True)\n\n# Access metadata\nmetadata = flow.text  # Dictionary of TEXT segment keywords\nprint(metadata.get('$DATE'))  # Acquisition date\nprint(metadata.get('$CYT'))   # Instrument name\n```\n\n**Handling Problematic Files:**\n\nSome FCS files have offset discrepancies or errors:\n\n```python\n# Ignore offset discrepancies between HEADER and TEXT sections\nflow = FlowData('problematic.fcs', ignore_offset_discrepancy=True)\n\n# Use HEADER offsets instead of TEXT offsets\nflow = FlowData('problematic.fcs', use_header_offsets=True)\n\n# Ignore offset errors entirely\nflow = FlowData('problematic.fcs', ignore_offset_error=True)\n```\n\n**Excluding Null Channels:**\n\n```python\n# Exclude specific channels during parsing\nflow = FlowData('sample.fcs', null_channel_list=['Time', 'Null'])\n```\n\n### Extracting Metadata and Channel Information\n\nFCS files contain rich metadata in the TEXT segment.\n\n**Common Metadata Keywords:**\n\n```python\nflow = FlowData('sample.fcs')\n\n# File-level metadata\ntext_dict = flow.text\nacquisition_date = text_dict.get('$DATE', 'Unknown')\ninstrument = text_dict.get('$CYT', 'Unknown')\ndata_type = flow.data_type  # 'I', 'F', 'D', 'A'\n\n# Channel metadata\nfor i in range(flow.channel_count):\n    pnn = flow.pnn_labels[i]      # Short name (e.g., 'FSC-A')\n    pns = flow.pns_labels[i]      # Descriptive name (e.g., 'Forward Scatter')\n    pnr = flow.pnr_values[i]      # Range\u002Fmax value\n    print(f\"Channel {i}: {pnn} ({pns}), Range: {pnr}\")\n```\n\n**Channel Type Identification:**\n\nFlowIO automatically categorizes channels:\n\n```python\n# Get indices by channel type\nscatter_idx = flow.scatter_indices    # [0, 1] for FSC, SSC\nfluoro_idx = flow.fluoro_indices      # [2, 3, 4] for FL channels\ntime_idx = flow.time_index            # Index of time channel (or None)\n\n# Access specific channel types\nevents = flow.as_array()\nscatter_data = events[:, scatter_idx]\nfluorescence_data = events[:, fluoro_idx]\n```\n\n**ANALYSIS Segment:**\n\nIf present, access processed results:\n\n```python\nif flow.analysis:\n    analysis_keywords = flow.analysis  # Dictionary of ANALYSIS keywords\n    print(analysis_keywords)\n```\n\n### Creating New FCS Files\n\nGenerate FCS files from NumPy arrays or other data sources.\n\n**Basic Creation:**\n\n```python\nimport numpy as np\nfrom flowio import create_fcs\n\n# Create event data (rows=events, columns=channels)\nevents = np.random.rand(10000, 5) * 1000\n\n# Define channel names\nchannel_names = ['FSC-A', 'SSC-A', 'FL1-A', 'FL2-A', 'Time']\n\n# Create FCS file\ncreate_fcs('output.fcs', events, channel_names)\n```\n\n**With Descriptive Channel Names:**\n\n```python\n# Add optional descriptive names (PnS)\nchannel_names = ['FSC-A', 'SSC-A', 'FL1-A', 'FL2-A', 'Time']\ndescriptive_names = ['Forward Scatter', 'Side Scatter', 'FITC', 'PE', 'Time']\n\ncreate_fcs('output.fcs',\n           events,\n           channel_names,\n           opt_channel_names=descriptive_names)\n```\n\n**With Custom Metadata:**\n\n```python\n# Add TEXT segment metadata\nmetadata = {\n    '$SRC': 'Python script',\n    '$DATE': '19-OCT-2025',\n    '$CYT': 'Synthetic Instrument',\n    '$INST': 'Laboratory A'\n}\n\ncreate_fcs('output.fcs',\n           events,\n           channel_names,\n           opt_channel_names=descriptive_names,\n           metadata=metadata)\n```\n\n**Note:** FlowIO exports as FCS 3.1 with single-precision floating-point data.\n\n### Exporting Modified Data\n\nModify existing FCS files and re-export them.\n\n**Approach 1: Using write_fcs() Method:**\n\n```python\nfrom flowio import FlowData\n\n# Read original file\nflow = FlowData('original.fcs')\n\n# Write with updated metadata\nflow.write_fcs('modified.fcs', metadata={'$SRC': 'Modified data'})\n```\n\n**Approach 2: Extract, Modify, and Recreate:**\n\nFor modifying event data:\n\n```python\nfrom flowio import FlowData, create_fcs\n\n# Read and extract data\nflow = FlowData('original.fcs')\nevents = flow.as_array(preprocess=False)\n\n# Modify event data\nevents[:, 0] = events[:, 0] * 1.5  # Scale first channel\n\n# Create new FCS file with modified data\ncreate_fcs('modified.fcs',\n           events,\n           flow.pnn_labels,\n           opt_channel_names=flow.pns_labels,\n           metadata=flow.text)\n```\n\n### Handling Multi-Dataset FCS Files\n\nSome FCS files contain multiple datasets in a single file.\n\n**Detecting Multi-Dataset Files:**\n\n```python\nfrom flowio import FlowData, MultipleDataSetsError\n\ntry:\n    flow = FlowData('sample.fcs')\nexcept MultipleDataSetsError:\n    print(\"File contains multiple datasets\")\n    # Use read_multiple_data_sets() instead\n```\n\n**Reading All Datasets:**\n\n```python\nfrom flowio import read_multiple_data_sets\n\n# Read all datasets from file\ndatasets = read_multiple_data_sets('multi_dataset.fcs')\n\nprint(f\"Found {len(datasets)} datasets\")\n\n# Process each dataset\nfor i, dataset in enumerate(datasets):\n    print(f\"\\nDataset {i}:\")\n    print(f\"  Events: {dataset.event_count}\")\n    print(f\"  Channels: {dataset.pnn_labels}\")\n\n    # Get event data for this dataset\n    events = dataset.as_array()\n    print(f\"  Shape: {events.shape}\")\n    print(f\"  Mean values: {events.mean(axis=0)}\")\n```\n\n**Reading Specific Dataset:**\n\n```python\nfrom flowio import FlowData\n\n# Read first dataset (nextdata_offset=0)\nfirst_dataset = FlowData('multi.fcs', nextdata_offset=0)\n\n# Read second dataset using NEXTDATA offset from first\nnext_offset = int(first_dataset.text['$NEXTDATA'])\nif next_offset > 0:\n    second_dataset = FlowData('multi.fcs', nextdata_offset=next_offset)\n```\n\n## Data Preprocessing\n\nFlowIO applies standard FCS preprocessing transformations when `preprocess=True`.\n\n**Preprocessing Steps:**\n\n1. **Gain Scaling:** Multiply values by PnG (gain) keyword\n2. **Logarithmic Transformation:** Apply PnE exponential transformation if present\n   - Formula: `value = a * 10^(b * raw_value)` where PnE = \"a,b\"\n3. **Time Scaling:** Convert time values to appropriate units\n\n**Controlling Preprocessing:**\n\n```python\n# Preprocessed data (default)\npreprocessed = flow.as_array(preprocess=True)\n\n# Raw data (no transformations)\nraw = flow.as_array(preprocess=False)\n```\n\n## Error Handling\n\nHandle common FlowIO exceptions appropriately.\n\n```python\nfrom flowio import (\n    FlowData,\n    FCSParsingError,\n    DataOffsetDiscrepancyError,\n    MultipleDataSetsError\n)\n\ntry:\n    flow = FlowData('sample.fcs')\n    events = flow.as_array()\n\nexcept FCSParsingError as e:\n    print(f\"Failed to parse FCS file: {e}\")\n    # Try with relaxed parsing\n    flow = FlowData('sample.fcs', ignore_offset_error=True)\n\nexcept DataOffsetDiscrepancyError as e:\n    print(f\"Offset discrepancy detected: {e}\")\n    # Use ignore_offset_discrepancy parameter\n    flow = FlowData('sample.fcs', ignore_offset_discrepancy=True)\n\nexcept MultipleDataSetsError as e:\n    print(f\"Multiple datasets detected: {e}\")\n    # Use read_multiple_data_sets instead\n    from flowio import read_multiple_data_sets\n    datasets = read_multiple_data_sets('sample.fcs')\n\nexcept Exception as e:\n    print(f\"Unexpected error: {e}\")\n```\n\n## Common Use Cases\n\n### Inspecting FCS File Contents\n\nQuick exploration of FCS file structure:\n\n```python\nfrom flowio import FlowData\n\nflow = FlowData('unknown.fcs')\n\nprint(\"=\" * 50)\nprint(f\"File: {flow.name}\")\nprint(f\"Version: {flow.version}\")\nprint(f\"Size: {flow.file_size:,} bytes\")\nprint(\"=\" * 50)\n\nprint(f\"\\nEvents: {flow.event_count:,}\")\nprint(f\"Channels: {flow.channel_count}\")\n\nprint(\"\\nChannel Information:\")\nfor i, (pnn, pns) in enumerate(zip(flow.pnn_labels, flow.pns_labels)):\n    ch_type = \"scatter\" if i in flow.scatter_indices else \\\n              \"fluoro\" if i in flow.fluoro_indices else \\\n              \"time\" if i == flow.time_index else \"other\"\n    print(f\"  [{i}] {pnn:10s} | {pns:30s} | {ch_type}\")\n\nprint(\"\\nKey Metadata:\")\nfor key in ['$DATE', '$BTIM', '$ETIM', '$CYT', '$INST', '$SRC']:\n    value = flow.text.get(key, 'N\u002FA')\n    print(f\"  {key:15s}: {value}\")\n```\n\n### Batch Processing Multiple Files\n\nProcess a directory of FCS files:\n\n```python\nfrom pathlib import Path\nfrom flowio import FlowData\nimport pandas as pd\n\n# Find all FCS files\nfcs_files = list(Path('data\u002F').glob('*.fcs'))\n\n# Extract summary information\nsummaries = []\nfor fcs_path in fcs_files:\n    try:\n        flow = FlowData(str(fcs_path), only_text=True)\n        summaries.append({\n            'filename': fcs_path.name,\n            'version': flow.version,\n            'events': flow.event_count,\n            'channels': flow.channel_count,\n            'date': flow.text.get('$DATE', 'N\u002FA')\n        })\n    except Exception as e:\n        print(f\"Error processing {fcs_path.name}: {e}\")\n\n# Create summary DataFrame\ndf = pd.DataFrame(summaries)\nprint(df)\n```\n\n### Converting FCS to CSV\n\nExport event data to CSV format:\n\n```python\nfrom flowio import FlowData\nimport pandas as pd\n\n# Read FCS file\nflow = FlowData('sample.fcs')\n\n# Convert to DataFrame\ndf = pd.DataFrame(\n    flow.as_array(),\n    columns=flow.pnn_labels\n)\n\n# Add metadata as attributes\ndf.attrs['fcs_version'] = flow.version\ndf.attrs['instrument'] = flow.text.get('$CYT', 'Unknown')\n\n# Export to CSV\ndf.to_csv('output.csv', index=False)\nprint(f\"Exported {len(df)} events to CSV\")\n```\n\n### Filtering Events and Re-exporting\n\nApply filters and save filtered data:\n\n```python\nfrom flowio import FlowData, create_fcs\nimport numpy as np\n\n# Read original file\nflow = FlowData('sample.fcs')\nevents = flow.as_array(preprocess=False)\n\n# Apply filtering (example: threshold on first channel)\nfsc_idx = 0\nthreshold = 500\nmask = events[:, fsc_idx] > threshold\nfiltered_events = events[mask]\n\nprint(f\"Original events: {len(events)}\")\nprint(f\"Filtered events: {len(filtered_events)}\")\n\n# Create new FCS file with filtered data\ncreate_fcs('filtered.fcs',\n           filtered_events,\n           flow.pnn_labels,\n           opt_channel_names=flow.pns_labels,\n           metadata={**flow.text, '$SRC': 'Filtered data'})\n```\n\n### Extracting Specific Channels\n\nExtract and process specific channels:\n\n```python\nfrom flowio import FlowData\nimport numpy as np\n\nflow = FlowData('sample.fcs')\nevents = flow.as_array()\n\n# Extract fluorescence channels only\nfluoro_indices = flow.fluoro_indices\nfluoro_data = events[:, fluoro_indices]\nfluoro_names = [flow.pnn_labels[i] for i in fluoro_indices]\n\nprint(f\"Fluorescence channels: {fluoro_names}\")\nprint(f\"Shape: {fluoro_data.shape}\")\n\n# Calculate statistics per channel\nfor i, name in enumerate(fluoro_names):\n    channel_data = fluoro_data[:, i]\n    print(f\"\\n{name}:\")\n    print(f\"  Mean: {channel_data.mean():.2f}\")\n    print(f\"  Median: {np.median(channel_data):.2f}\")\n    print(f\"  Std Dev: {channel_data.std():.2f}\")\n```\n\n## Best Practices\n\n1. **Memory Efficiency:** Use `only_text=True` when event data is not needed\n2. **Error Handling:** Wrap file operations in try-except blocks for robust code\n3. **Multi-Dataset Detection:** Check for MultipleDataSetsError and use appropriate function\n4. **Preprocessing Control:** Explicitly set `preprocess` parameter based on analysis needs\n5. **Offset Issues:** If parsing fails, try `ignore_offset_discrepancy=True` parameter\n6. **Channel Validation:** Verify channel counts and names match expectations before processing\n7. **Metadata Preservation:** When modifying files, preserve original TEXT segment keywords\n\n## Advanced Topics\n\n### Understanding FCS File Structure\n\nFCS files consist of four segments:\n\n1. **HEADER:** FCS version and byte offsets for other segments\n2. **TEXT:** Key-value metadata pairs (delimiter-separated)\n3. **DATA:** Raw event data (binary\u002Ffloat\u002FASCII format)\n4. **ANALYSIS** (optional): Results from data processing\n\nAccess these segments via FlowData attributes:\n- `flow.header` - HEADER segment\n- `flow.text` - TEXT segment keywords\n- `flow.events` - DATA segment (as bytes)\n- `flow.analysis` - ANALYSIS segment keywords (if present)\n\n### Detailed API Reference\n\nFor comprehensive API documentation including all parameters, methods, exceptions, and FCS keyword reference, consult the detailed reference file:\n\n**Read:** `references\u002Fapi_reference.md`\n\nThe reference includes:\n- Complete FlowData class documentation\n- All utility functions (read_multiple_data_sets, create_fcs)\n- Exception classes and handling\n- FCS file structure details\n- Common TEXT segment keywords\n- Extended example workflows\n\nWhen working with complex FCS operations or encountering unusual file formats, load this reference for detailed guidance.\n\n## Integration Notes\n\n**NumPy Arrays:** All event data is returned as NumPy ndarrays with shape (events, channels)\n\n**Pandas DataFrames:** Easily convert to DataFrames for analysis:\n```python\nimport pandas as pd\ndf = pd.DataFrame(flow.as_array(), columns=flow.pnn_labels)\n```\n\n**FlowKit Integration:** For advanced analysis (compensation, gating, FlowJo support), use FlowKit library which builds on FlowIO's parsing capabilities\n\n**Web Applications:** FlowIO's minimal dependencies make it ideal for web backend services processing FCS uploads\n\n## Troubleshooting\n\n**Problem:** \"Offset discrepancy error\"\n**Solution:** Use `ignore_offset_discrepancy=True` parameter\n\n**Problem:** \"Multiple datasets error\"\n**Solution:** Use `read_multiple_data_sets()` function instead of FlowData constructor\n\n**Problem:** Out of memory with large files\n**Solution:** Use `only_text=True` for metadata-only operations, or process events in chunks\n\n**Problem:** Unexpected channel counts\n**Solution:** Check for null channels; use `null_channel_list` parameter to exclude them\n\n**Problem:** Cannot modify event data in place\n**Solution:** FlowIO doesn't support direct modification; extract data, modify, then use `create_fcs()` to save\n\n## Summary\n\nFlowIO provides essential FCS file handling capabilities for flow cytometry workflows. Use it for parsing, metadata extraction, and file creation. For simple file operations and data extraction, FlowIO is sufficient. For complex analysis including compensation and gating, integrate with FlowKit or other specialized tools.\n",{"name":5,"description":7},"main","4e647b68aabe849e143b6950971c380f7adccdef","components\u002Fskills\u002Fscientific\u002Fflowio","https:\u002F\u002Fgithub.com\u002FmarnixGeerkens\u002Frocketlauncher-claude-code","https:\u002F\u002Frocketlauncher.ai\u002Fclaude-code","https:\u002F\u002Fgithub.com\u002FmarnixGeerkens","CEO of Rocketlauncher.ai\r\n\r\nObsessed with AI\r\n\r\njoin  https:\u002F\u002Fwww.skool.com\u002Frocketlauncher-university\r\n👉🏻 it's free ","2026-10-13 00:52:14",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add marnixGeerkens\u002Frocketlauncher-claude-code --skill flowio",{"tool":38,"command":39},"bunx","bunx skills add marnixGeerkens\u002Frocketlauncher-claude-code --skill flowio",{"tool":41,"command":42},"pnpm","pnpm dlx skills add marnixGeerkens\u002Frocketlauncher-claude-code --skill flowio","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FmarnixGeerkens\u002Frocketlauncher-claude-code\u002Fblob\u002Fmain\u002Fcomponents\u002Fskills\u002Fscientific\u002Fflowio\u002FSKILL.md",true,[46],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002Fapi_reference.md","REFERENCE","参考文档",10481,"https:\u002F\u002Fgithub.com\u002FmarnixGeerkens\u002Frocketlauncher-claude-code\u002Fblob\u002Fmain\u002Fcomponents\u002Fskills\u002Fscientific\u002Fflowio\u002Freferences\u002Fapi_reference.md",[53,60,69,76,83,90],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M7EQFDF4T3K89WMFVFQVT3C8","zapier-make-patterns","No-code automation democratizes workflow building. Zapier and Make (formerly Integromat) let non-developers automate business processes without writing code. But no-code doesn't mean no-complexity - these platforms have their own patterns, pitfalls, and breaking points.  This skill covers when to use which platform, how to build reliable automations, and when to graduate to code-based solutions. Key insight: Zapier optimizes for simplicity and integrations (7000+ apps), Make optimizes for power","https:\u002F\u002Fgithub.com\u002FmarnixGeerkens\u002Frocketlauncher-claude-code\u002Fblob\u002Fmain\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fzapier-make-patterns\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":64,"licenseFileUrl":65,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7EQFA5XQ0811Q4Q0WCFASZG","yeet","Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).","Apache-2.0","https:\u002F\u002Fgithub.com\u002FmarnixGeerkens\u002Frocketlauncher-claude-code\u002Fblob\u002Fmain\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FmarnixGeerkens\u002Frocketlauncher-claude-code\u002Fblob\u002Fmain\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7EQF4J6C2WKQWD9E2RQC6MJ","workflow-automation","Workflow automation is the infrastructure that makes AI agents reliable. Without durable execution, a network hiccup during a 10-step payment flow means lost money and angry customers. With it, workflows resume exactly where they left off.  This skill covers the platforms (n8n, Temporal, Inngest) and patterns (sequential, parallel, orchestrator-worker) that turn brittle scripts into production-grade automation.  Key insight: The platforms make different tradeoffs. n8n optimizes for accessibility","https:\u002F\u002Fgithub.com\u002FmarnixGeerkens\u002Frocketlauncher-claude-code\u002Fblob\u002Fmain\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fworkflow-automation\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7EQF1AT655CYYZBEQ8V6Z9D","trigger-dev","Trigger.dev expert for background jobs, AI workflows, and reliable async execution with excellent developer experience and TypeScript-first design. Use when: trigger.dev, trigger dev, background task, ai background job, long running task.","https:\u002F\u002Fgithub.com\u002FmarnixGeerkens\u002Frocketlauncher-claude-code\u002Fblob\u002Fmain\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Ftrigger-dev\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7EQEY9ENH0G2EJ1WD6C1CE8","slack-automation","Automate Slack workspace operations including messaging, search, channel management, and reaction workflows through Composio's Slack toolkit.","https:\u002F\u002Fgithub.com\u002FmarnixGeerkens\u002Frocketlauncher-claude-code\u002Fblob\u002Fmain\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fslack-automation\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":64,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M7EQESHEKPTE0QPW9R6XV5K2","rote","Compile a proven agent skill (a SKILL.md plus references) into a deterministic pipeline that runs without an LLM in the loop, then serve it back to Claude as an MCP tool. Use when: rote, compile this skill, turn this skill into a workflow, make this skill deterministic, make this skill cheaper or faster, harden this skill for production, run this skill as a background job.","https:\u002F\u002Fgithub.com\u002FmarnixGeerkens\u002Frocketlauncher-claude-code\u002Fblob\u002Fmain\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Frote\u002FSKILL.md",[],[]]