Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to save single mapped counts by side #248

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
33 changes: 28 additions & 5 deletions pairtools/cli/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
" all overlapping statistics. Non-overlapping statistics are appended to"
" the end of the file. Supported for tsv stats with single filter.",
)
@click.option(
"--single-mapped-by-side",
is_flag=True,
help="If specified, count single-mapped reads separately for read1 and read2.",
)
@click.option(
"--n-dist-bins-decade",
type=int,
Expand Down Expand Up @@ -115,7 +120,15 @@
)
@common_io_options
def stats(
input_path, output, merge, n_dist_bins_decade, bytile_dups, output_bytile_stats, filter, **kwargs
input_path,
output,
merge,
single_mapped_by_side,
n_dist_bins_decade,
bytile_dups,
output_bytile_stats,
filter,
**kwargs,
):
"""Calculate pairs statistics.

Expand All @@ -131,6 +144,7 @@ def stats(
input_path,
output,
merge,
single_mapped_by_side,
n_dist_bins_decade,
bytile_dups,
output_bytile_stats,
Expand All @@ -140,7 +154,15 @@ def stats(


def stats_py(
input_path, output, merge, n_dist_bins_decade, bytile_dups, output_bytile_stats, filter, **kwargs
input_path,
output,
merge,
single_mapped_by_side,
n_dist_bins_decade,
bytile_dups,
output_bytile_stats,
filter,
**kwargs,
):
if merge:
do_merge(output, input_path, n_dist_bins_decade=n_dist_bins_decade, **kwargs)
Expand Down Expand Up @@ -190,6 +212,7 @@ def stats_py(
filter = None

stats = PairCounter(
single_mapped_by_side=single_mapped_by_side,
n_dist_bins_decade=n_dist_bins_decade,
bytile_dups=bytile_dups,
filters=filter,
Expand All @@ -213,9 +236,9 @@ def stats_py(
stats.save(
outstream,
yaml=kwargs.get("yaml", False), # format as yaml
filter=first_filter_name
if not kwargs.get("yaml", False)
else None, # output only the first filter if non-YAML output
filter=(
first_filter_name if not kwargs.get("yaml", False) else None
), # output only the first filter if non-YAML output
)

if instream != sys.stdin:
Expand Down
Loading
Loading