I'm completely new to R loops, so I would appreciate any help that is offered.
I have a huge main data frame with multiple samples and replicates of samples. I also have a data frame with combinations of those samples. I need to run t-tests per row of the huge data frame, while checking their combinations and output the t-test p-value in a new list.
Samples have replicates (e.g., a.1-a.3) which can be up to 5 replicates. Based on the combinations_df, sample "S" is a combination of "a" and "b".
I need to check the main_df, find the next sample, check what was combined in this, in the combinations_df, then gather all replicates of and run a t.test against all replicates of & . Combination samples range from 2 to 5, named as "member" in the combinations_df. This has to go through all the "Feature"s of main_df, as rows, and give the p.value of the t.test as a new list.
main_df
Feature a.1 a.2 a.3 b.1 b.2 b.3 c.1 c.2 c.3 S.1 S.2 S.3 T.1 T.2 T.3 W.1 W.2 W.3 X.1 X.2 X.3
3 0.63 0.29 0.34 0.39 0.45 0.09 0.95 0.34 0.29 0.58 0.41 0.54 0.52 0.13 0.47 0.34 0.46 0.97 0.24 0.15 0.66
12 0.72 0.07 0.23 0.88 0.95 0.12 0.59 0.01 0.27 0.62 0.84 0.12 0.55 0.47 0.98 0.40 0.01 0.44 0.25 0.96 0.72
65 0.57 0.29 0.61 0.62 0.01 0.58 0.52 0.83 0.60 0.22 0.90 0.62 0.83 0.55 0.51 0.79 0.13 0.93 0.89 0.54 0.21
89 0.64 0.35 0.70 0.21 0.62 0.84 0.18 0.76 0.88 0.13 0.05 0.87 0.81 0.81 0.39 0.89 0.47 0.56 0.64 0.81 0.39
96 0.32 0.78 0.74 0.08 0.42 0.39 0.95 0.80 0.90 0.83 0.63 0.46 0.17 0.14 0.52 0.50 0.55 0.43 0.12 0.69 0.74
combinations_df
Sample member1 member2 member3 member4 member5
S a b na na na
T a c na na na
W b c na na na
X a b c na na
Aucun commentaire:
Enregistrer un commentaire