Skip to content

Simulated replicates from real data #4

Description

@Chuang1118

Dear seqgendiff team,

Thanks for your excellent work and build such useful package!

DE analysis tools generally recommend a minimum of 3 biological replicates per group for robust analysis.
In my case, 2 replicates per group. I would like use seqgendiff to generated 1 simulated replicates from real data.

I have a question for how to use the function thin_2group() or thin_diff() in practices.

Regarding to Applying Different Thinning Functions and Simulate RNA-seq Data from Real Data section in the tutorial, I'm not sure, I understood the parameters.

It's possible to generated 1 simulated replicate by permuting the expression levels e.g. 20%, adding a standard deviation of 0.25 ?

Which function can do the task ? thin_2group() or thin_diff()

thout <- thin_2group(mat = assay(airway), 
                     prop_null = 0.9,   # I mis-understand this parameter.
                     group_prop = 0.5, # mis-understand
                     signal_fun = stats::rnorm,
                     signal_params = list(mean = 0, sd = 0.8))

I have processed by thin_diff, but I am not sure the parameters.
input: 18789*4

                mock_1 mock_2 znf_1 znf_2
ENSG00000000419    355    263   586   284
ENSG00000000457     39     34    88    44
ENSG00000000460    118     60   198   108
ENSG00000000938      1      2     7     1
ENSG00000000971      7      2    40    12
ENSG00000001036      3      6     8     7

my code

n <- ncol(assay(dds)) 
p <- nrow(assay(dds))

## Choose simulation parameters
design_perm <- cbind(0:(n-1),rep(0.2, n)) # 20% permuting the expression levels
coef_perm <- matrix(rnorm(p * ncol(design_perm), sd = 0.25), nrow = p) # st == 0.25

## Thin
thout <- thin_diff(mat = assay(dds),
                   design_perm = design_perm,
                   coef_perm = coef_perm)

output: df

                mock_1 mock_2 znf_1 znf_2 sim_mock_1 sim_mock_2 sim_znf_1 sim_znf_2
ENSG00000000419    355    263   586   284        355        212       549       215
ENSG00000000457     39     34    88    44         33         31        72        44
ENSG00000000460    118     60   198   108        101         56       168       108
ENSG00000000938      1      2     7     1          1          1         7         1
ENSG00000000971      7      2    40    12          7          1        35        11
ENSG00000001036      3      6     8     7          2          6         7         7

I have checked there are 33.75379 % values motified by sim_mock_1.

sum(df[[1]] != df[[5]])/length(df[[1]])

I have used set.seed(1234), but I got the non-reproducible results.

Thanks for your help!
Chuang

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions