Git Product home page Git Product logo

Comments (7)

JcGKitten avatar JcGKitten commented on August 28, 2024 1

@SamGG sry I didn't mean to affront the authors, I can imagine how hard it is to write documentation, especially when it's such a scientific topic. Next time I try to be more precise about what could be improved or even provide a pull request.

from flowutils.

whitews avatar whitews commented on August 28, 2024

Hi Max,

FlowIO returns the events exactly as they are saved in the FCS file. This does not take into account the channel gain values typically present in the FCS metadata. For analysis, these gain factors should be applied prior to any pre-processing (such as transformation).

The FlowKit Sample class will do this automatically for you. Can you install FlowKit and try applying the transform to see if you get equivalent results?

The FlowKit code to do this would look something like:

import flowkit as fk

# create Sample from file path
fcs_path = 'path/to/fcs/file/example.fcs'
sample = fk.Sample(fcs_path)

# define a transform
xform = fk.transforms.LogicleTransform(
    'some_xform_id', 
    param_t=262144, 
    param_w=0.5, 
    param_m=4.5, 
    param_a=0
)

sample.apply_transform(xform)

xform_events = sample.get_events(source='xform')

By default, the apply_transform method will apply the given transform to only the fluorescent channels. The scatter channels are usually not transformed usin a "bi-ex" style transform, but are sometimes linearly transformed.

You can find more info in the FlowKit docs about this, but for now let's see if the fluoro channel values are reasonably close to flowCore using this above code.

-Scott

from flowutils.

JcGKitten avatar JcGKitten commented on August 28, 2024

Hey Scott,
thanks for the fast reply. I used your code above and got the following result:
flowkit_transform

As you can see, the events for the fluorescent channels are the same as with the flowio + flowutils approach.
I'm not sure if the flowCore function applies something else before the transformation, but the input events are the same in R and Python. Till now i wasn't able to find out which code flowCore uses for the bi-ex transformation and didn't find a graph of this transformation. I thought a graph would show which value the events should have after the transformation.

from flowutils.

whitews avatar whitews commented on August 28, 2024

Ok, we can use the LUT from the GatingML 2.0 specification. I've taken a screenshot of those input / output values and pasted below for reference, but we can test the first set of logicle parameters. What does the flowCore logicle function output for the following input values & the parameter values T = 1000, W = 1, M = 4 and A = 0 ?

Input values:
−10
−5
−1
0
0.3
1
3
10
100
1000

For parameter values T = 1000, W = 1, M = 4 and A = 0, the output should be:

≈ 0.067574
≈ 0.147986
≈ 0.228752
0.25
≈ 0.256384
≈ 0.271248
≈ 0.312897
≈ 0.432426
≈ 0.739548
1

image

from flowutils.

whitews avatar whitews commented on August 28, 2024

Max,

I see what flowCore is doing! They are giving you the results in the number of decades. Since you specify 4.5 as the number of decades in your example, if you multiple the FlowKit values by 4.5 you get the same as flowCore. Just my opinion, but they should be more transparent in their documentation about that.

Well, at least that mystery is solved!

-Scott

from flowutils.

JcGKitten avatar JcGKitten commented on August 28, 2024

Hey Scott,
thank you very much, I would have needed much more time to find that. Yes the documentation of flowCore isn't exactly great ...
I hope I didn't steal to much from your time with that bug request, but maybe others will wonder about it as well and have the explanation documented here.
Best wishes and a have a great weekend
Max

from flowutils.

SamGG avatar SamGG commented on August 28, 2024

If you feel flowCore's documentation needs to be improved, don't hesitate to provide a PR.
Best.

from flowutils.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.