forked from rbcan/binning
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgbtools.Rmd
More file actions
56 lines (38 loc) · 1.82 KB
/
Copy pathgbtools.Rmd
File metadata and controls
56 lines (38 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
title: "gbtools.binning"
output: html_document
---
```{r}
install.packages("/home/ransorge/teaching/R_packages/Rcpp_0.12.15.tar.gz",repos=NULL,type="source")
install.packages("/home/ransorge/teaching/R_packages/sp_1.2-7.tar.gz",repos=NULL,type="source")
install.packages("/home/ransorge/teaching/R_packages/plyr_1.8.4.tar.gz",repos=NULL,type="source")
install.packages("/home/ransorge/programs/genome-bin-tools/R_source_package/gbtools_2.5.8.tar.gz",repos=NULL,type="source")
```
```{r}
library(plyr)
library(sp)
library(gbtools)
```
```{r}
# make sure to remove "#" from covstats file!
# If you have a single coverage table, give the filename at the covstats= option
d <- gbt(covstats="/home/ransore/teaching/909_A.covstats.txt")
```
```{r plot coverage-GC plot}
plot(d) # simple plot
#plot(d,cutoff=2000) # Do not show scaffolds shorter than 2000 bp
```
```{r highlight saved bin created with other binning tool}
plot(d,marker=FALSE,slice=1) # The underlying GC-coverage plot, with coloring turned off
# import external bin (e.g. from metabat)
bin5.contigNames <- scan(file="/home/ransore/teaching/909_A.metabat.1.contigNames",what=character())
d.bin5 <- gbtbin(shortlist=bin5.contigNames,x=d,slice=NA)
points(d.bin5,col="green",slice=1)
```
```{r save bin from coverage-GC plot}
# save a bin manually from coverage-gc plot
bin1 <- choosebin(d, slice=1, save=TRUE, file="bin1.909_A.list")
#bin2 <- winnow(d,slice=1, covmin=150, covmax=500) # Return the subset of contigs in d which have coverage above 200 in sample 1
#bin3 <- winnow(d,gc=c(0.5,0.7),len=c(1000,Inf)) # Return the subset of scaffolds in d that have GC between 20-50%, and length above 1000
#bin4 <- winnow(d,slice=c(1,2),covmin=c(200,300),covmax=c(Inf,5000)) # Subset of contigs that have coverage above 200 in sample 1, and between 300-5000 in sample 2.
```