Skip to content

Commit

Permalink
Update README and tutorial for execution of snippets (#76).
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Mokrejs <[email protected]>
  • Loading branch information
jkanche and mmokrejs committed Apr 10, 2024
1 parent e3f76d7 commit d20ec60
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@

GenomicRanges provides container classes designed to represent genomic locations and support genomic analysis. It is similar to Bioconductor's [GenomicRanges](https://bioconductor.org/packages/release/bioc/html/GenomicRanges.html). **_Intervals are inclusive on both ends and starts at 1._**

**Note: V0.4.0 is a complete overhaul of the package, as such the constructor to GenomicRanges has changed!**
**Note: V0.4.0 is a complete overhaul of the package, as such the constructor to GenomicRanges has changed. Please refer the documentation for updated usage of the classes and the methods.**

To get started, install the package from [PyPI](https://pypi.org/project/genomicranges/)

```shell
pip install genomicranges
```

Some of the methods like `read_ucsc` require optional packages to be installed, e.g. joblib` and can be installed by:

```sh
pip install genomicranges[optional]
```

## `GenomicRanges`

`GenomicRanges` is the base class to represent and operate over genomic regions and annotations.
Expand Down Expand Up @@ -83,8 +89,9 @@ print(gr)
A common representation in Python is a pandas `DataFrame` for all tabular datasets. `DataFrame` must contain columns "seqnames", "starts", and "ends" to represent genomic intervals. Here's an example:

```python
import genomicranges import GenomicRanges
from genomicranges import GenomicRanges
import pandas as pd
from random import random

df = pd.DataFrame(
{
Expand Down Expand Up @@ -118,7 +125,7 @@ print(gr)
`GenomicRanges` supports most [interval based operations](https://bioconductor.org/packages/release/bioc/html/GenomicRanges.html).

```python
subject = genomicranges.from_ucsc(genome="hg38")
subject = genomicranges.read_ucsc(genome="hg38")

query = genomicranges.from_pandas(
pd.DataFrame(
Expand Down Expand Up @@ -146,6 +153,10 @@ Just as it sounds, a `GenomicRangesList` is a named-list like object. If you are
To construct a GenomicRangesList

```python
from genomicranges import GenomicRanges, GenomicRangesList
from iranges import IRanges
from biocframe import BiocFrame

gr1 = GenomicRanges(
seqnames=["chr1", "chr2", "chr1", "chr3"],
ranges=IRanges([1, 3, 2, 4], [10, 30, 50, 60]),
Expand Down
1 change: 1 addition & 0 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ gr = GenomicRanges(
The package also provides a `SeqInfo` class to update or modify sequence information stored in the object. Read more about this class in [GenomeInfoDb package](https://bioconductor.org/packages/release/bioc/html/GenomeInfoDb.html).

```python
from genomicranges import SeqInfo
seq_obj = {
"seqnames": ["chr1", "chr2", "chr3",],
"seqlengths": range(100, 103),
Expand Down

0 comments on commit d20ec60

Please sign in to comment.