This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How I can compute Pearson or Spearman correlation in R?

I have 2 data file in bed format ( chr22.fna.S15-30_L0-10_M5.bed & GSM669971_BI.Brain_Hippocampus_Middle.Input.112.bed ).

How I can find the correlation between 2 bed files in R language. I used "Jaccard Statistic" tools to find similarity and plot a heatmap. but I don't know how I can find Pearson or Spearman correlation in bed format files in R!?

chip-seq rna-seq r genome

1 answer

The correlation function in R is called cor(). The help page for it is accessed with "?cor" and it will tell you how to easily compute Spearman and Pearson by using the "method=" parameter.

Before any of that can make sense, you need to realize that correlation is a function of sets of numbers, not 'bed files'

If you meant to compute correlations of a particular column of the BED, after perhaps merging the two on genomic coordinates, that's another question entirely. try "bedtools".

Log in to answer this question.