-
Notifications
You must be signed in to change notification settings - Fork 0
/
subset.Rmd
73 lines (39 loc) · 876 Bytes
/
subset.Rmd
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
title: "Subsetting PyRanges"
---
# Subsetting PyRanges
There are many ways to subset a PyRanges object. Each returns a new PyRanges object and does not change the old one.
```{python}
import pyranges as pr
gr = pr.load_dataset("chipseq")
print(gr)
```
Chromosome only
```{python tidy=FALSE}
print(gr["chrX"])
```
Chromosome and Strand
```{python tidy=FALSE}
print(gr["chrX", "-"])
```
Chromosome and Slice
```{python tidy=FALSE}
print(gr["chrX", 150000000:160000000])
```
Chromosome, Strand and Slice
```{python tidy=FALSE}
print(gr["chrX", "-", 150000000:160000000])
```
Slice
Only using slices returns all ranges from all chromosomes and strands within those coordinates.
```{python tidy=FALSE}
print(gr[0:100000])
```
Strand
```{python tidy=FALSE}
print(gr["+"])
```
Slice and Strand
```{python tidy=FALSE}
print(gr["+", 0:100000])
```