check this: build stats CLI that will report pairtools-like stats: nnz per region (cis);…
- User
check this:
build stats CLI that will report pairtools-like stats:
nnz per region (cis); per pair of regions ("trans"); in total fraction of contacts per region; per pair of regions ("trans"); in total distance decay: % of contacts by distance ranges cis2trans, cis and trans per region and in total I put "trans" in quotation marks because it can be in cis (in terms of chromosomes) but between different regions. User can provide a single region to get its properties of only this one.
Suggested API:
cooltools stats input.cool --view regions.txt --nproc 10 Additional options:
--chrom-subset --yaml/--no-yaml Maybe also:
--cis2trans-only --nnz-only --decay-only --fraction-only --cis-only to remove the stats between regions (may reduce computations) --trans-only to calculate only trans stats and ignore all the cis ones
and also this:
Implementation idea: go through pixel chunks and collect stats per chunk - perhaps some code from PairCounter in pairtools can be reused!
this is the code the are referring to as pairtools-like:
@cli.command() @click.argument("input_path", type=str, nargs=-1, required=False) @click.option("-o", "--output", type=str, default="", help="output stats tsv file.") @click.option( "--merge", is_flag=True, help="If specified, merge multiple input stats files instead of calculating" " statistics of a .pairs/.pairsam file. Merging is performed via summation of" " all overlapping statistics. Non-overlapping statistics are appended to" " the end of the file. Supported for tsv stats with single filter.", ) @click.option( "--with-chromsizes/--no-chromsizes", is_flag=True, default=True, help="If enabled, will store sizes of chromosomes from the header of the pairs file" " in the stats file.", ) @click.option( "--yaml/--no-yaml", is_flag=True, default=False, help="Output stats in yaml format instead of table. ", ) @click.option( "--bytile-dups/--no-bytile-dups", default=False, help="If enabled, will analyse by-tile duplication statistics to estimate" " library complexity more accurately." " Requires parent_readID column to be saved by dedup (will be ignored otherwise)" " Saves by-tile stats into --output_bytile-stats stream, or regular output if --output_bytile-stats is not provided.", ) @click.option( "--output-bytile-stats", default="", required=False, help="output file for tile duplicate statistics." " If file exists, it will be open in the append mode." " If the path ends with .gz or .lz4, the output is bgzip-/lz4c-compressed." " By default, by-tile duplicate statistics are not printed." " Note that the readID and parent_readID should be provided and contain tile information for this option.", )
Filtering options:
@click.option( "--filter", default=None, required=False, multiple=True, help="Filters with conditions to apply to the data (similar to
pairtools select). " "For non-YAML output only the first filter will be reported. " """Example: pairtools stats --yaml --filter 'unique:(pair_type=="UU")' --filter 'close:(pair_type=="UU") and (abs(pos1-pos2)<10)' test.pairs """, ) @click.option( "--engine", default="pandas", required=False, help="Engine for regular expression parsing. " "Python will provide you regex functionality, while pandas does not accept custom funtctions and works faster. ", ) @click.option( "--chrom-subset", type=str, default=None, required=False, help="A path to a chromosomes file (tab-separated, 1st column contains " "chromosome names) containing a chromosome subset of interest. " "If provided, additionally filter pairs with both sides originating from " "the provided subset of chromosomes. This operation modifies the #chromosomes: " "and #chromsize: header fields accordingly.", ) @click.option( "--startup-code", type=str, default=None, required=False, help="An auxiliary code to execute before filtering. " "Use to define functions that can be evaluated in the CONDITION statement", ) @click.option( "-t", "--type-cast", type=(str, str), default=(), multiple=True, help="Cast a given column to a given type. By default, only pos and mapq " "are cast to int, other columns are kept as str. Provide as " "-t <column_name> , e.g. -t read_len1 int. Multiple entries are allowed.", ) @common_io_options def stats( input_path, output, merge, bytile_dups, output_bytile_stats, filter, **kwargs ): """Calculate pairs statistics. - Assistant
- User
write a single paragraph with all this information. Be sure to make it concise and clear to understand.
- Assistant
The project aims to develop an advanced command-line interface (CLI) tool for analyzing chromosomal contact data, specifically designed to process .cool files and extract detailed statistics about genomic interactions both within regions (cis) and between regions (trans). Key features include computing non-zero contacts (nnz), the fraction of contacts per region, distance-dependent contact analysis, and cis-trans ratios, with flexibility for users to focus analyses on specific genomic regions or subsets of chromosomes. Proposed usage involves commands like
cooltools stats input.cool --view regions.txt --nproc 10, supported by additional options such as output format selection (--yaml/--no-yaml), analysis focus (--cis2trans-only,--nnz-only, etc.), and the choice to limit calculations to either cis or trans interactions. The tool's implementation is inspired by techniques used in PairCounter from pairtools, utilizing chunk-wise processing for efficiency. Additionally, a pairtools-like CLI offers functionalities for merging, filtering, and customizing outputs, enhancing usability for genomic researchers. This project facilitates an in-depth exploration of spatial genome organization by providing comprehensive interaction statistics, tailored to specialized research interests.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.