pachterlab / sleuth

Differential analysis of RNA-Seq
http://pachterlab.github.io/sleuth
GNU General Public License v3.0
305 stars 95 forks source link

transformation_function not working #200

Closed dominik-handler closed 6 years ago

dominik-handler commented 6 years ago

Hi,

I tried to change the transformation function, but no matter what function I supply the results stay the same. This is the code I use:

 so <- sleuth_prep(s2c, ~condition, target_mapping = t2g, aggregation_column = 'ens_gene',
                    extra_bootstrap_summary = TRUE,
                    transformation_function = function(x) log2(x + 0.5),
                    read_bootstrap_tpm = TRUE,  ## required if sleuth_fit uses which_var = "obs_tpm"
                    gene_mode = TRUE) ##use old method and not p-value aggregation

Thank you, Dominik

warrenmcg commented 6 years ago

Hi @dominik-handler, what version are you using (stable, devel, or a specific patch (commit would be helpful))? In the stable version, the TPMs were not transformed, so changing the transformation_function argument only changes how the counts are transformed.

dominik-handler commented 6 years ago

Yes, it was the latest release version. Is there another version in ehich the TPMs would get transformed?

Thank you.

Am 21.09.2018 12:26 Vorm. schrieb Warren McGee notifications@github.com:

What version are using (stable, devel, or a specific patch (commit would be helpful))? In the stable version, the TPMs were not transformed, so changing the transformation_function argument only changes how the counts are transformed.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/pachterlab/sleuth/issues/200#issuecomment-423354234, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AL6cuST6V2uKm__NDbnSMKTdDUlK37yFks5udBX-gaJpZM4WzBcn.

warrenmcg commented 6 years ago

The latest commit on the master branch has the expected functionality, so you can just re-run devtools::install_github('pachterlab/sleuth', ref = 'master') to get the latest version. Or if you are comfortable running a patched devel version, you could install the latest devel `devtools::install_github('warrenmcg/sleuth', ref = 'd73306').

In both, the transformation_function has now become two separate options: transform_fun_counts and transform_fun_tpm. The new documentation for sleuth_prep (accessed by ?sleuth_prep) is hopefully clear on this and on other new options.

Since I think we've answered your problem, I'm going to close this issue. If you have a new error that comes up as a result of using either the latest master or the devel, feel free to reopen this issue or open a new one.

dominik-handler commented 6 years ago

Hi,

I tried your suggestsions, but it did not work out. I installed the version from the master branch and ran the analysis using this command:

  so <- sleuth_prep(s2c, ~condition, target_mapping = t2g, aggregation_column = 'ens_gene',
                    extra_bootstrap_summary = TRUE,
                    transformation_function_reads=function(x) log2(x + 0.5),
                    transformation_function_tpm=function(x) log2(x + 0.5),
                    read_bootstrap_tpm = TRUE,  ## required if sleuth_fit uses which_var = "obs_tpm"
                    gene_mode = TRUE) ##use old method and not p-value aggregation

Still I got back b-values in natural log. I also tried it using only the function for reads or tpm. I then tested something and forked sleuth and changed the function manually to log2 and the tpm-function from identity to the function. Then it works. Does sleuth still not use my supplied function, or do I supply it in a wrong format.

Thank you, Dominik

warrenmcg commented 6 years ago

Hi @dominik-handler,

You used transformation_function_reads and transformation_function_tpm. These are not the correct arguments; please use transform_fun_counts and transform_fun_tpm. Let me know if you continue to have problems after that.

Also, I should note that if you simply care about getting log2 fold changes for b, as an alternative, you can simply do what DESeq2 does and do a post-hoc conversion: log2(e) * b (see this line of code in DESeq2's internal methods).

dominik-handler commented 6 years ago

A, damn. Missed that completely. Did not pay attention to the exact wording. Copied it from somewhere.

Thank you, Now it works perfectly fine.

Dominik

From: Warren McGee notifications@github.com Reply-To: pachterlab/sleuth reply@reply.github.com Date: Friday, September 21, 2018 at 3:36 PM To: pachterlab/sleuth sleuth@noreply.github.com Cc: "Handler,Dominik" dominik.handler@imba.oeaw.ac.at, Mention mention@noreply.github.com Subject: Re: [pachterlab/sleuth] transformation_function not working (#200)

Hi @dominik-handlerhttps://github.com/dominik-handler,

You used transformation_function_reads and transformation_function_tpm. These are not the correct arguments; please use transform_fun_counts and transform_fun_tpm. Let me know if you continue to have problems after that.

Also, I should note that if you simply care about getting log2 fold changes for b, as an alternative, you can simply do what DESeq2 does and do a post-hoc conversion: log2(e) * b (see this line of code in DESeq2's internal methodshttps://github.com/mikelove/DESeq2/blob/600c6c20fca6c2d54148bea17ac31c424ac69336/R/fitNbinomGLMs.R#L177).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/pachterlab/sleuth/issues/200#issuecomment-423533215, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AL6cuct8VDJXj9ubb8FTCfXqBNwOqor-ks5udOtagaJpZM4WzBcn.