Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions pysequila/sequila.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,30 @@ def pileup(self, path: str, refPath: str, qual: bool) -> DataFrame:
"""
jdf = self._jsparkSession.pileup(path, refPath, qual)
return DataFrame(jdf, self._wrapped)

def feature_counts(self, reads: str, genes: str) -> DataFrame:
"""
Create a :class:`DataFrame` with genes counted in reads bam file

Parameters
----------
reads : str
the alignment file in BAM format
genes : str
genes in BED format
Returns
-------
:class:`DataFrame`
Examples
--------
>>> ss.feature_counts(reads, genes).show(1)
+---------+------+---------+-------+------+------+--------+
|sample_id|contig|pos_start|pos_end|strand|Length|countRef|
+---------+------+---------+-------+------+------+--------+
| 1| chr1| 11| 99| +| 88| 7|
+---------+------+---------+-------+------+------+--------+
only showing top 1 row

"""
jdf = self._jsparkSession.featureCounts(reads, genes)
return DataFrame(jdf, self._wrapped)