Skip to main content

A package for processing FCS files

Project description

fcsy

<image src=https://img.shields.io/pypi/dm/fcsy?style=flat-square>

A package for processing FCS files.

  • Free software: MIT license

Installation

$ pip install fcsy

Usage

Use the pandas flavor api fcsy.DataFrame which has all the features of pandas DataFrame plus the fcs io (New in v0.5.0).

API (ver >= 0.5.0)

DataFrame.from_fcs(path, channel_type='short')

Read fcs file to dataframe

path path to the input fcs
channel_type "short" | "long" | "multi".
Read short or long channels to the dataframe columns. In "multi" mode both channels are read as a pandas MultiIndex
return DataFrame

Example:

from fcsy import DataFrame

df = DataFrame.from_fcs('sample1.fcs', channel_type='multi')

DataFrame.to_fcs(path)

Write dataframe to fcs file. 'short' and 'long' channels will be written separately if pandas MultiIndex is used as the columns. Otherwise 'short' and 'long' channels will be the same writen from the columns.

Example:

import numpy as np
from fcsy import DataFrame

df = DataFrame(np.random.rand(10, 4)), columns=list('ABCD'))
df.to_fcs('sample1.fcs')

Old API

Write a data frame to fcs. df.columns is written to both short and long names of the fcs.

from fcsy import write_fcs

write_fcs(df, 'output_file')

Write to fcs with "long name". df.columns and long_names are written to short and long names of the fcs.

write_fcs(df, 'output_file', long_names=['a','b','c'])

Read a fcs file to pandas DataFrame.

from fcsy import read_fcs

df = read_fcs('input_file')

Read a fcs file with "long name"

df = read_fcs('input_file', name_type='long')

# or only read the names
from fcsy import read_fcs_names

long_names = read_fcs_names('input_file', name_type='long')

Write a data frame to fcs. df.columns is written to both short and long names of the fcs.

from fcsy import write_fcs

write_fcs(df, 'output_file')

Write to fcs with "long name". df.columns and long_names are written to short and long names of the fcs.

write_fcs(df, 'output_file', long_names=['a','b','c'])

Credits

This package was created with Cookiecutter* and the audreyr/cookiecutter-pypackage* project template.

Cookiecutter: https://github.com/audreyr/cookiecutter audreyr/cookiecutter-pypackage: https://github.com/audreyr/cookiecutter-pypackage

======= History

0.1.0 (2018-12-18)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fcsy-0.5.0.tar.gz (16.2 kB view hashes)

Uploaded source

Built Distribution

fcsy-0.5.0-py2.py3-none-any.whl (7.7 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page