Git Product home page Git Product logo

Comments (3)

KatrionaGoldmann avatar KatrionaGoldmann commented on July 24, 2024

Hi @bmplaw! Thanks for your message. The fc_cutoff works on the overall radial fold change, r, where:

Screen Shot 2021-04-30 at 17 14 32

Screen Shot 2021-04-30 at 17 14 38

In this case Z is the Fold change for each comparison. You can check out this parameter using: NK_polar_limma@polar$r_fc

If you want to add a fold-change cutoff for your pairwise comparisons a quick workaround would be to intercept the polar_coords output. Does it work if you try something like this:

# check the original groups
table(NK_polar_limma@polar$sig)

# Set up the FC values and cut-off
fc_cutoff <- 5
fc_df <- NK_polar_limma@pvalues[, grepl("FC", colnames(NK_polar_limma@pvalues))]

# Find which genes do not pass the fold change cut-off. 
#-- I used !any() to change the genes to non-sig if NO pairwise comparisons 
#-- reach the FC cutoff. You can easily change the condition. 
non_sig <- unlist(apply(fc_df, 1, function(x) ! any(x > fc_cutoff) ))
NK_polar_limma@polar$sig[non_sig] <- NK_polar_limma@non_sig_name

# check the new group breakdown - you should have more non-significant
table(NK_polar_limma@polar$sig)

volcano3D(NK_polar_limma)

I will look into adding pairwise cut-offs to the functions when I have more time.

from volcano3d.

bmplaw avatar bmplaw commented on July 24, 2024

Hi @KatrionaGoldmann

Thank you so much! You are right, the numbers of non-significant genes have increased a lot. However, does this code also make genes non-significant if the fold-change is less than 5?

To demonstrate this, in the below example, I set the fc_cutoff using your method to 4. Wouldn't we consider B3GAT1 a significant gene even when we set the fc_cutoff to 4?

I adjusted your code to:

non_sig <- unlist(apply(fc_df, 1, function(x) ! any(x > fc_cutoff) ))

and it seems to do that job? I'm fairly new to R and your input is much appreciated.

#Original
NK_polar_limma <- polar_coords(sampledata = z_meta,
                               contrast = "group",
                               pvalues = Pvals_limma_NK2,
                               expression = z_count,
                               p_col_suffix = "pvalue",
                               padj_col_suffix = "padj",
                               multi_group_prefix = "Overall",
                               non_sig_name = "Not Significant",
                               fc_col_suffix = 'log2FoldChange',
                               significance_cutoff = 0.05,
                               label_column = NULL,                        
                               cutoff_criteria = "padj")

radial_plotly(polar = NK_polar_limma,
              hover=hovertext)

image

#KatrionaGoldmann's code; fc_cutoff = 4 
#Set up the FC values and cut-off
fc_cutoff <- 4
fc_df <- NK_polar_limma@pvalues[, grepl("FC", colnames(NK_polar_limma@pvalues))]
non_sig <- unlist(apply(fc_df, 1, function(x) ! any(x > fc_cutoff) ))
NK_polar_limma@polar$sig[non_sig] <- NK_polar_limma@non_sig_name

radial_plotly(polar = NK_polar_limma,
              hover=hovertext)

image

#KatrionaGoldmann's code; fc_cutoff = 4: adjusted
#Set up the FC values and cut-off
fc_cutoff <- 4
fc_df <- NK_polar_limma@pvalues[, grepl("FC", colnames(NK_polar_limma@pvalues))]
non_sig <- unlist(apply(fc_df, 1, function(x) ! any(abs(x) > fc_cutoff) ))
NK_polar_limma@polar$sig[non_sig] <- NK_polar_limma@non_sig_name

radial_plotly(polar = NK_polar_limma,
              hover=hovertext)

image

from volcano3d.

KatrionaGoldmann avatar KatrionaGoldmann commented on July 24, 2024

Hi, so if I understand correctly you want B3GAT1 to be considered significant as in your last plot? You are completely correct to add the abs() since we are considering negative FC as well!

In more detail...

The command I wrote classes genes as non significant if there are not any FC comparisons greater than the cutoff (! any(abs(x) > fc_cutoff)), but in your case there would be since abs(CD56DimCD57Neg vs CD56DimCD57Pos logFC) > 4. So if, for example, you were more interesting in saying genes should be treated as non-significant if there are any comparisons below the cutoff you would want something more like :

# treated as non-significant if any comparisons are below fc_cutoff:
non_sig <- unlist(apply(fc_df, 1, function(x) any(abs(x) < fc_cutoff) ))

# treated as non-significant if there are not any comparisons above fc_cutoff:
# non_sig <- unlist(apply(fc_df, 1, function(x) ! any(abs(x) > fc_cutoff) ))

Hope this helps.

from volcano3d.

Related Issues (20)

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.