[R] How to calculate p value and correlation coefficient for Spearman’s correlation of differential expression data with 40000 permutations?

2019-10-31 Thread Ana Marija
Hello, I have 3 groups,let's call them g1, g2, g3. Each of them is a result of analysis in between groups of conditions, and g1 looks like this geneSymbol logFC t P.Value adj.P.Val Beta EXykpF1BRREdXnv9Xk MKI67 -0.3115880 -5.521186

Re: [R] how to calculate multiple meta p values

2019-10-31 Thread Ana Marija
Can you please get back to me about this, I need this meta p values for manuscript I have to submit next week On Wed, Oct 30, 2019 at 5:35 PM Ana Marija wrote: > > I also tried to do it this way: > > d$META <- sapply(seq_len(nrow(d)), function(rn) { > unlist(sumz(as.matr

Re: [R] how to calculate multiple meta p values

2019-10-30 Thread Ana Marija
wr "numeric" > sum(is.na(d$LCL)) [1] 0 > sum(is.na(d$Retina)) [1] 0 > sum(is.na(d$wl)) [1] 0 > sum(is.na(d$wr)) [1] 0 > dim(d) [1] 1668837 7 On Wed, Oct 30, 2019 at 4:52 PM Ana Marija wrote: > > Hi Michael, > > this still doesn't work, by data fra

Re: [R] how to calculate multiple meta p values

2019-10-30 Thread Ana Marija
rry about that, I > should have thought of it before. > > When I next update metap I will try to get it to degrade more gracefully > when it finds an error. > > Michael > > On 28/10/2019 19:06, Ana Marija wrote: > > Hi Michael, > > > > I tried what you pr

Re: [R] Error when using qvalue function

2019-10-29 Thread Ana Marija
415e-01, >> 2.459322e-02,2.873351e-01,8.477168e-01,1.351068e-02, >> 1.053550e-01,4.812686e-01,1.404957e-01,9.835912e-02,4.373995e-01, >> 8.803856e-02) >> qval_obj=qvalue(pvals) >> qval_obj$pi0 >> [1] 0.1981095 >> pi1=1-qval_obj$pi0 >> pi1 >&g

Re: [R] negative vector length when merging data frames

2019-10-28 Thread Ana Marija
hr) & (l4join$X2 %in% ajoin$pos) > i2 <- (ajoin$chr %in% l4join$X1) & (ajoin$pos %in% l4join$X2) > > rm(l4join, ajoin) # don't need this any more, remove them > > # now the real fread's > l4 <- data.table::fread(l4_file) > asign <- data.table::fread(asign_file) >

Re: [R] Error when using qvalue function

2019-10-28 Thread Ana Marija
fer not to install packages in my > script but just to use `library` and manually get each of the packages that > `library` complains about onto my machine. Once done, the script runs just > fine after that. > > On October 28, 2019 4:08:03 PM PDT, Ana Marija > wrote: >

Re: [R] Error when using qvalue function

2019-10-28 Thread Ana Marija
f) : missing or infinite values in inputs are not allowed On Mon, Oct 28, 2019 at 6:02 PM Ana Marija wrote: > > can you please send me command you used to install it? > > On Mon, Oct 28, 2019 at 5:12 PM Jim Lemon wrote: > > > > Hi Ana, > > Seems to work without er

Re: [R] Error when using qvalue function

2019-10-28 Thread Ana Marija
1.053550e-01,4.812686e-01,1.404957e-01,9.835912e-02,4.373995e-01, > 8.803856e-02) > qval_obj=qvalue(pvals) > qval_obj$pi0 > [1] 0.1981095 > pi1=1-qval_obj$pi0 > pi1 > [1] 0.8018905 > > Jiim > > On Tue, Oct 29, 2019 at 8:45 AM Ana Marija > wrote: &g

[R] Error when using qvalue function

2019-10-28 Thread Ana Marija
Hello, I am trying to calculate True Positive Rate, TPR with this procedure: pvals=q$METAge qval_obj=qvalue(pvals) #is false discovery rate pi1=1-qval_obj$pi0 #TPR pi1 #TPR But I am getting this error: Error in smooth.spline(lambda, pi0, df = smooth.df) : missing or

Re: [R] how to calculate multiple meta p values

2019-10-28 Thread Ana Marija
gt; There must be several ways of doing this but see below for an idea with > comments in-line. > > On 26/10/2019 00:31, Ana Marija wrote: > > Hello, > > > > I would like to use this package metap > > to calculate multiple o values > > > > I have

Re: [R] how to calculate multiple meta p values

2019-10-25 Thread Ana Marija
this is the function I was referring to: https://www.rdocumentation.org/packages/metap/versions/1.1/topics/sumz On Fri, Oct 25, 2019 at 6:31 PM Ana Marija wrote: > > Hello, > > I would like to use this package metap > to calculate multiple o values > > I have my data

[R] how to calculate multiple meta p values

2019-10-25 Thread Ana Marija
Hello, I would like to use this package metap to calculate multiple o values I have my data frame with 3 p values > head(tt) RSG E B 1: rs2089177 0.9986 0.7153 0.604716 2: rs4360974 0.9738 0.7838 0.430228 3: rs6502526 0.9744 0.7839

Re: [R] negative vector length when merging data frames

2019-10-23 Thread Ana Marija
I am using R-3.6.1 and these libraries: library(data.table) library(dplyr) On Wed, Oct 23, 2019 at 6:54 PM Duncan Murdoch wrote: > > On 23/10/2019 7:04 p.m., Ana Marija wrote: > > I also tried left_join but I got: Error: std::bad_alloc > > > >> df3 <- left_joi

Re: [R] negative vector length when merging data frames

2019-10-23 Thread Ana Marija
no can you please send me an example how the command would look like in my case? On Wed, Oct 23, 2019 at 6:16 PM Jim Lemon wrote: > > Yes. Have you tried the bigmemory package? > > Jim > > On Thu, Oct 24, 2019 at 10:08 AM Ana Marija > wrote: > > > > Hi Jim,

Re: [R] negative vector length when merging data frames

2019-10-23 Thread Ana Marija
tly the best way to do it if you > have a database manager is to read the two datasets into tables and do > the join via SQL or whatever language is available. > > Jim > > On Thu, Oct 24, 2019 at 10:17 AM Ana Marija > wrote: > > > > no can you please send me an

Re: [R] negative vector length when merging data frames

2019-10-23 Thread Ana Marija
X2 X3 X4 X5 > [6] variant_id pval_nominal gene_id.LCL gene chr_pos > [11] p.val.Retina > <0 rows> (or 0-length row.names) > > It works okay, but there are no matches in the join. So I can't even > guess what the problem is.

Re: [R] negative vector length when merging data frames

2019-10-23 Thread Ana Marija
I also tried left_join but I got: Error: std::bad_alloc > df3 <- left_join(l4, asign, by = c("chr","pos")) Error: std::bad_alloc > dim(l4) [1] 166941635 8 > dim(asign) [1] 107371528 5 On Wed, Oct 23, 2019 at 5:32 PM Ana Marija wrote: > >

[R] negative vector length when merging data frames

2019-10-23 Thread Ana Marija
Hello, I have two data frames like this: > head(l4) X1X2 X3 X4 X5 variant_id pval_nominal gene_id.LCL 1 chr1 13550 G A b38 1:13550:G:A 0.375614 ENSG0227232 2 chr1 14671 G C b38 1:14671:G:C 0.474708 ENSG0227232 3 chr1 14677 G A b38 1:14677:G:A 0.699887

Re: [R] how to compare two distributions and calculate p value?

2019-10-22 Thread Ana Marija
er > > "The trouble with having an open mind is that people keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Tue, Oct 22, 2019 at 6:18 PM Ana Marija > wrote: >> >

[R] how to compare two distributions and calculate p value?

2019-10-22 Thread Ana Marija
Hello, I would like to calculate a p value from two distributions, one looks like this: > head(b) gene_id number_of_eqtles_per_gene 1: ENSG0237683.5 5 2: ENSG0225972.1 267 3: ENSG0225630.197 4:

Re: [R] how to select all columns that contain in any of their rows a partial match for a string?

2019-10-05 Thread Ana Marija
tot$newcol <- -9 > tot$newcol[e10] <- 1 > tot$newcol[e11] <- 2 > > > On both cases the 2 lines sapply/rowSums can be made one with > > rowSums(sapply(...)) > 0 > > > Hope this helps, > > Rui Barradas > > Às 20:52 de 05/10/19, Ana Marija escreveu: >

[R] how to select all columns that contain in any of their rows a partial match for a string?

2019-10-05 Thread Ana Marija
Hello, I have a data frame tot which has many columns and many rows. I am trying to find all columns that have say a value in any of their rows that STARTS WITH: "E94" for example there are columns like this: > unique(tot$diagnoses_icd9_f41271_0_44) [1] NA "E9420" I tried:

[R] can not extract rows which match a string

2019-10-03 Thread Ana Marija
Hello, I have a dataframe (t1) with many columns, but the one I care about it this: > unique(t1$sex_chromosome_aneuploidy_f22019_0_0) [1] NA"Yes" it has these two values. I would like to remove from my dataframe t1 all rows which have "Yes" in t1$sex_chromosome_aneuploidy_f22019_0_0 I

Re: [R] how to add p values to bar plot?

2019-09-27 Thread Ana Marija
een > 70.42-7.75 or fold change 70.42/7.75. If they are absolute value you can > also scale them in log scale and do the same. Hope this helps. Good luck. > > Vivek > > On Fri, Sep 27, 2019 at 9:32 PM Ana Marija > wrote: > >> Hi Vivek, >> >> Thanks for getting back

[R] how to add p values to bar plot?

2019-09-27 Thread Ana Marija
Hi, I created a bar plot with this code: library(ggplot2) df <- data.frame("prop" = c(7.75,70.42), "Name" = c("All Genes","RG Genes")) p<-ggplot(data=df, aes(x=Name, y=prop,fill=Name)) + geom_bar(stat="identity")+ labs(x="", y = "Proportion of cis EQTLs")+ scale_fill_brewer(palette="Greens") +

[R] how to calculate True Positive Rate in R?

2019-09-24 Thread Ana Marija
Hello, I tried using qvalue function: library(qvalue) qval_obj=qvalue(pvalR) pi1=1-qval_obj$pi0 but after running: qval_obj=qvalue(pvalR) Error in smooth.spline(lambda, pi0, df = smooth.df) : missing or infinite values in inputs are not allowed or

[R] how to reverse colors on boxplot

2019-08-08 Thread Ana Marija
Hello, I made plot in attach using: boxplot(flcn_M~subject,data=dx,col = c("royalblue1","palevioletred1"),xlab="subjects",ylab="Expression estimate in delta (log2)",boxwex = 0.2,frame.plot = FALSE) stripchart(flcn_M~subject, vertical = TRUE, data = dx,method = "jitter", add = TRUE,pch = 20,

Re: [R] Help with if else statement

2019-08-07 Thread Ana Marija
does this look ok: pt$pheno=ifelse(pt$phenoQ==-9 & pt$phenoH==-9,-9,ifelse(pt$phenoH==2 | pt$phenoQ==2,2,1)) On Wed, Aug 7, 2019 at 1:40 PM Ana Marija wrote: > > Hello, > > I have a data frame which looks like this: > > > head(pt) > eidQ phenoQ phenoH > 1 10

[R] Help with if else statement

2019-08-07 Thread Ana Marija
Hello, I have a data frame which looks like this: > head(pt) eidQ phenoQ phenoH 1 117 -9 -9 2 125 -9 -9 3 138 -9 1 4 142 -9 -9 5 156 -9 -9 6 174 -9 -9 7 138 -9 1 8 1000127 2 1 9 1000690

Re: [R] filter and add a column

2019-08-06 Thread Ana Marija
tor of 1s to controls before joining the datasets. > > On Tue, Aug 6, 2019 at 3:01 PM Ana Marija > wrote: > > > > I really don't know how I would implement this > > > > On Tue, Aug 6, 2019 at 1:42 PM Patrick (Malone Quantitative) < > mal...@malonequantitat

Re: [R] filter and add a column

2019-08-06 Thread Ana Marija
e. > > > On Tue, Aug 6, 2019 at 2:38 PM Ana Marija > wrote: > > > > Hi Patrick, > > > > yes both controls and tot have "eid" column, please see attached > > > > Can you please tell em what means to post in "plain text" ? > &g

Re: [R] filter and add a column

2019-08-06 Thread Ana Marija
have some kind of ID variable? If so, it should be > straightforward with the appropriate joining function. > > What have you tried? > > Also, please post in plain text. > > > On Tue, Aug 6, 2019 at 2:16 PM Ana Marija > wrote: > > > > Hello, > > > > I am

[R] filter and add a column

2019-08-06 Thread Ana Marija
Hello, I am filtering my data frame "tot" via: controls=tot %>% filter_all(any_vars(. %in% c("E109", "E119","E149"))) %>% filter_all(any_vars(. %in% c("Caucasian"))) %>% filter_all(any_vars(. %in% c("No kinship found","Ten or more third-degree relatives identified"))) > dim(controls) [1] 15381

Re: [R] How to create a new column based on the values from multiple columns which are matching a particular string?

2019-07-29 Thread Ana Marija
Thank you so much! Just to confirm here MARGIN=1 indicates that "A" should appear at least once per row? On Mon, Jul 29, 2019 at 1:53 PM Eric Berger wrote: > df$case <- apply(df,MARGIN = 1,function(v) { as.integer("A" %in% v) }) > > > On Mon, Jul 29,

Re: [R] How to create a new column based on the values from multiple columns which are matching a particular string?

2019-07-29 Thread Ana Marija
which would be named "case" and values inside would be: 1,1,0,1,1,1,0,0,1,1 so "case" column is where value "A" can be found in any column. On Mon, Jul 29, 2019 at 12:53 PM Eric Berger wrote: > You may have a typo/misstatement in your question. > You define a

[R] How to create a new column based on the values from multiple columns which are matching a particular string?

2019-07-29 Thread Ana Marija
I have data frame which looks like this: df=data.frame( eye_problemsdisorders_f6148_0_1=c(A,C,D,NA,D,A,C,NA,B,A), eye_problemsdisorders_f6148_0_2=c(B,C,NA,A,C,B,NA,NA,A,D), eye_problemsdisorders_f6148_0_3=c(C,A,D,D,B,A,NA,NA,A,B), eye_problemsdisorders_f6148_0_4=c(D,D,NA,B,A,C,NA,C,A,B),

Re: [R] Call `rlang::last_error()` to see a backtrace

2019-07-10 Thread Ana Marija
; > > Sent from my iPhone > > > > > On Jul 10, 2019, at 1:09 PM, Patrick (Malone Quantitative) < > mal...@malonequantitative.com> wrote: > > > > > > First response: The ID column in your data is labeled "eid" but your > > > function call re

Re: [R] Call `rlang::last_error()` to see a backtrace

2019-07-10 Thread Ana Marija
y to list. > > On Wed, Jul 10, 2019, 6:08 PM Ana Marija > wrote: > > > Hi Patrick, > > > > thanks for getting back to me, I tried that: > > > > > ukb_icd_diagnosis(my_ukb_data, eid = "117", icd.version = 10) > > Error in ukb_icd_diagnosi

[R] Call `rlang::last_error()` to see a backtrace

2019-07-10 Thread Ana Marija
Hello, I am trying to use this program: https://github.com/kenhanscombe/ukbtools > my_ukb_data[1:3,1:3] eid sex_f31_0_0 year_of_birth_f34_0_0 1 117 Female 1938 2 125 Female 1951 3 138Male 1961 >

[R] Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection

2019-07-09 Thread Ana Marija
Hello, I am trying to run this program FUSION.assoc_test.R from : http://gusevlab.org/projects/fusion/#typical-analysis-and-output [t.cri.asokovic@cri16in002 fusion_twas-master]$ Rscript FUSION.assoc_test.R \ > --sumstats /gpfs/data/stranger-lab/anamaria/meta_gwas/META_CHR22_1.txt \ > --weights

<    1   2   3