Skip to content

mariavica/plottingFunctions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

---
title: "PlottingFunctions package"
output:
  html_document:
    df_print: paged
    toc: true
   # theme: paper
  pdf_document: default
---

# Package installation


The package can be installed via github:

```{r, message=FALSE}
library(devtools)
if(!require(plottingFunctions)) {
  devtools::install_github("mariavica/plottingFunctions", ref="master", build_vignettes = FALSE)
}
library(plottingFunctions)
```

# HiC related functions:

## map.plot
This is how variables are: ``map`` variable refers to the (missing values are allowed) and ``ref`` is a bedfile with the regions that you want to plot.

```{r include=FALSE}
data(map)
data(ref)
```

```{r}
map[1000:1004,]
```

```{r}
head(ref)
```

The plot should look like this:
```{r}
data(map)
data(ref)
map.plot(ref=ref,map=map, expand=5, show.orig = TRUE)
```


## plotTwoTrends

This function plots two trends in the same plot.

```{r}

a <- matrix(rnorm(1000), ncol=10, nrow=100)
b <- matrix(rnorm(1000, mean = 1, sd = 0.5), ncol=10, nrow=100)

plotTwoTrends(x1=a, x2=b, name.1='a', name.2 ='b', fix.ylim=c(-3,3))

```



## plotTwoSamples

This function plots two samples in the same plot.

```{r}

a <- matrix(rnorm(1000), ncol=10, nrow=100)
b <- matrix(rnorm(1000, mean = 1, sd = 0.5), ncol=10, nrow=100)

plotTwoSamples(a,b,xlab="A",ylab="B")

```




## selectAB

Select the appropiate Vector on the HiC analysis.

! The function will use the combination of chr:start:end as rownames to make sure that we're comparing the same regions. So the resolution of both matrices should be the same.

```{r}
set.seed(12345)
hicpca <- data.frame(chr=c("chr1","chr1","chr1","chr1","chr1","chr2","chr2","chr2","chr2"),
                    start=c(0,10000,20000,30000,40000,0,10000,20000,30000),
                    end=c(9999,19999,29999,39999,49999,9999,19999,29999,39999),
                    PC1=rnorm(9),
                    PC2=rnorm(9,sd=2))
hicpca <- list(hicpca)  #input must be a list

at_content <- data.frame(chr=c("chr1","chr1","chr1","chr1","chr1","chr2","chr2","chr2","chr2"),
                    start=c(0,10000,20000,30000,40000,0,10000,20000,30000),
                    end=c(9999,19999,29999,39999,49999,9999,19999,29999,39999),
                    at=runif(9,min = 0,max = 1))
hicpca
at_content

finpca<-selectAB(x.list=hicpca, ref.at=at_content) 

finpca

```




## correctAB


# Miscellania

## get.chr

Select the desired character

```{r}
get.chr(c('a-b-c-d'), sep='-', pos=2)
```


## GOheatmap


```{r, message=FALSE}

genes <-list( a=c('Fgfr3'), b=c('Dyrk1a','Ctcf'))

genes <-c('Fgfr3','Dyrk1a','Ctcf')
cluster <- c(1,2,2)

#results <- GOheatmap(genes=genes , cluster=cluster, organism="mouse", fdr.cutoff = 0.05)

```


About

Miscellania code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages