Skip to content

Commit

Permalink
bumping to 1.5.1; adding the name column back to the PeakCalling.ye…
Browse files Browse the repository at this point in the history
…ast.call_peaks output; updating docs API section
  • Loading branch information
cmatKhan committed Mar 14, 2024
1 parent d4a7b9b commit 07b4378
Show file tree
Hide file tree
Showing 42 changed files with 179 additions and 17 deletions.
23 changes: 13 additions & 10 deletions callingcardstools/PeakCalling/yeast/call_peaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def call_peaks(
background_data_path: str,
background_orig_chr_convention: str,
chrmap_data_path: str,
deduplicate_experiment: bool = True,
unified_chr_convention: str = "ucsc",
deduplicate_experiment: bool = True,
) -> pd.DataFrame:
"""
Call peaks for the given Calling Cards data.
Expand Down Expand Up @@ -190,7 +190,9 @@ def call_peaks(
).set_index("name", drop=True)

promoter_hops_df = (
promoter_df.set_index("name", drop=True)
promoter_df
.drop("score", axis=1)
.set_index("name")
.join(
[experiment_hops_df, background_hops_df],
how="left",
Expand All @@ -209,6 +211,7 @@ def call_peaks(
"experiment_total_hops": "int64",
}
)
.reset_index()
)

start_time = time.time()
Expand Down Expand Up @@ -333,6 +336,13 @@ def parse_args(
"something else, eg 'mitochondrial' or 'plasmid'.",
required=True,
)
parser.add_argument(
"--unified_chr_convention",
type=str,
help="the chromosome naming convention to use in the output " "DataFrame.",
required=False,
default="ucsc",
)
parser.add_argument(
"--deduplicate_experiment",
action="store_true",
Expand All @@ -341,13 +351,6 @@ def parse_args(
"coordinate on different strands, only one of those records will be "
"retained.",
)
parser.add_argument(
"--unified_chr_convention",
type=str,
help="the chromosome naming convention to use in the output " "DataFrame.",
required=False,
default="ucsc",
)
parser.add_argument(
"--output_path",
default="sig_results.csv",
Expand Down Expand Up @@ -395,8 +398,8 @@ def main(args: argparse.Namespace) -> None:
args.background_data_path,
args.background_orig_chr_convention,
args.chrmap_data_path,
args.deduplicate_experiment,
args.unified_chr_convention,
args.deduplicate_experiment
)

result_df.to_csv(
Expand Down
3 changes: 3 additions & 0 deletions callingcardstools/PeakCalling/yeast/enrichment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import warnings

logger = logging.getLogger(__name__)

Expand All @@ -25,6 +26,8 @@ def enrichment(total_background_hops: int,
:return: The Calling Cards effect (enrichment) value.
:rtype: float
"""
warnings.warn("This function is deprecated and will be removed in a future release. "
"use the vectorized function instead")

numerator = (experiment_hops / (total_experiment_hops + pseudocount))
denominator = (background_hops / (total_background_hops + pseudocount))
Expand Down
5 changes: 5 additions & 0 deletions callingcardstools/PeakCalling/yeast/hypergeom_pval.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import logging
import warnings

from scipy.stats import hypergeom

logger = logging.getLogger(__name__)


def hypergeom_pval(total_background_hops: int,
total_experiment_hops: int,
background_hops: int,
Expand All @@ -21,6 +24,8 @@ def hypergeom_pval(total_background_hops: int,
:return: The hypergeometric p-value.
:rtype: float
"""
warnings.warn("This function is deprecated and will be removed in a future release. "
"use the vectorized function instead")
# check input
if total_background_hops < 0 or not isinstance(total_background_hops, int):
raise ValueError(('total_background_hops must '
Expand Down
3 changes: 3 additions & 0 deletions callingcardstools/PeakCalling/yeast/poisson_pval.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import warnings

from scipy.stats import poisson

Expand Down Expand Up @@ -27,6 +28,8 @@ def poisson_pval(total_background_hops: int,
:return: The Poisson p-value.
:rtype: float
"""
warnings.warn("This function is deprecated and will be removed in a future release. "
"use the vectorized function instead")
# check input
if total_background_hops < 0 or not isinstance(total_background_hops, int):
raise ValueError(('total_background_hops must '
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.chipexo_promoter_sig.chipexo_promoter_sig
handler: python
2 changes: 2 additions & 0 deletions docs/API/Analysis/yeast/chipexo_promoter_sig/main.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.chipexo_promoter_sig.main
handler: python
2 changes: 2 additions & 0 deletions docs/API/Analysis/yeast/chipexo_promoter_sig/parse_args.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.chipexo_promoter_sig.parse_args
handler: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.chipexo_promoter_sig.read_in_chipexo_data
handler: python
2 changes: 2 additions & 0 deletions docs/API/Analysis/yeast/rank_response/bin_by_binding_rank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.rank_response.bin_by_binding_rank.bin_by_binding_rank
handler: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.rank_response.calculate_random_expectation.calculate_random_expectation
handler: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.rank_response.compute_rank_response.compute_rank_response
handler: python
2 changes: 2 additions & 0 deletions docs/API/Analysis/yeast/rank_response/create_partitions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.rank_response.create_partitions.create_partitions
handler: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.rank_response.create_rank_response_table.create_rank_response_table
handler: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.rank_response.find_min_responsive.find_min_responsive
handler: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.rank_response.find_min_responsive_main.main
handler: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.rank_response.find_min_responsive_main.parse_args
handler: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.rank_response.label_responsive_genes.label_responsive_genes
handler: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.rank_response.parse_binomtest_results.parse_binomtest_results
handler: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.rank_response.rank_response_main.main
handler: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.rank_response.rank_response_main.parse_args
handler: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.rank_response.rank_response_ratio_summarize.rank_response_ratio_summarize
handler: python
2 changes: 2 additions & 0 deletions docs/API/Analysis/yeast/rank_response/read_in_data.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.rank_response.read_in_data.read_in_data
handler: python
2 changes: 2 additions & 0 deletions docs/API/Analysis/yeast/rank_response/set_none_str_to_none.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.rank_response.set_none_str_to_none.set_none_str_to_none
handler: python
2 changes: 2 additions & 0 deletions docs/API/Analysis/yeast/rank_response/validate_config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.Analysis.yeast.rank_response.validate_config.validate_config
handler: python
2 changes: 2 additions & 0 deletions docs/API/PeakCalling/yeast/call_peaks/add_metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.PeakCalling.yeast.call_peaks.add_metrics
handler: python
2 changes: 2 additions & 0 deletions docs/API/PeakCalling/yeast/call_peaks/call_peaks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.PeakCalling.yeast.call_peaks.call_peaks
handler: python
2 changes: 2 additions & 0 deletions docs/API/PeakCalling/yeast/call_peaks/count_hops.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.PeakCalling.yeast.call_peaks.count_hops
handler: python
2 changes: 2 additions & 0 deletions docs/API/PeakCalling/yeast/call_peaks/main.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.PeakCalling.yeast.call_peaks.main
handler: python
2 changes: 2 additions & 0 deletions docs/API/PeakCalling/yeast/call_peaks/parse_args.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.PeakCalling.yeast.call_peaks.parse_args
handler: python
2 changes: 2 additions & 0 deletions docs/API/PeakCalling/yeast/enrichment_vectorized.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.PeakCalling.yeast.enrichment_vectorized.enrichment_vectorized
handler: python
2 changes: 2 additions & 0 deletions docs/API/PeakCalling/yeast/hypergeom_pval_vectorized.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.PeakCalling.yeast.hypergeom_pval_vectorized.hypergeom_pval_vectorized
handler: python
2 changes: 2 additions & 0 deletions docs/API/PeakCalling/yeast/poisson_pval_vectorized.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.PeakCalling.yeast.poisson_pval_vectorized.poisson_pval_vectorized
handler: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.PeakCalling.yeast.read_in_data.qbed_df_to_pyranges
handler: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.PeakCalling.yeast.read_in_data.read_in_background_data
handler: python
3 changes: 3 additions & 0 deletions docs/API/PeakCalling/yeast/read_in_data/read_in_chrmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
::: callingcardstools.PeakCalling.yeast.read_in_data.read_in_chrmap

handler: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.PeakCalling.yeast.read_in_data.read_in_experiment_data
handler: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.PeakCalling.yeast.read_in_data.read_in_promoter_data
handler: python
2 changes: 2 additions & 0 deletions docs/API/PeakCalling/yeast/read_in_data/relabel_chr_column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
::: callingcardstools.PeakCalling.yeast.read_in_data.relabel_chr_column
handler: python
7 changes: 7 additions & 0 deletions docs/home/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

### Changes

- Needed to keep `name` in the output of PeakCalling.yeast.call_peaks
- adding Analysis and PeakCalling modules to the documentation API section

## Version 1.5.0

### Changes

- overhaul of the PeakCalling/yeast module to address memory usage.
adding pyranges as a depedency as a result. removed `consider_strand`
and added a argument to deduplicate the experiment qbeds based on
Expand Down
41 changes: 41 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,52 @@ nav:
- SummaryParser: 'API/Alignment/SummaryParser.md'
- mammals:
- Qbed: 'API/Alignment/mammals/Qbed.md'
- Analysis:
- yeast:
- rank_response:
- bin_by_binding_rank: 'API/Analysis/yeast/rank_response/bin_by_binding_rank.md'
- calculate_random_expectation: 'API/Analysis/yeast/rank_response/calculate_random_expectation.md'
- compute_rank_response: 'API/Analysis/yeast/rank_response/compute_rank_response.md'
- create_partitions: 'API/Analysis/yeast/rank_response/create_partitions.md'
- create_rank_response_table: 'API/Analysis/yeast/rank_response/create_rank_response_table.md'
- label_responsive_genes: 'API/Analysis/yeast/rank_response/label_responsive_genes.md'
- parse_binomtest_results: 'API/Analysis/yeast/rank_response/parse_binomtest_results.md'
- rank_response_ratio_summarize: 'API/Analysis/yeast/rank_response/rank_response_ratio_summarize.md'
- read_in_data: 'API/Analysis/yeast/rank_response/read_in_data.md'
- set_none_str_to_none: 'API/Analysis/yeast/rank_response/set_none_str_to_none.md'
- validate_config: 'API/Analysis/yeast/rank_response/validate_config.md'
- find_min_responsive:
- find_min_responsive: 'API/Analysis/yeast/rank_response/find_min_responsive/find_min_responsive.md'
- parse_args: 'API/Analysis/yeast/rank_response/find_min_responsive/parse_args.md'
- main: 'API/Analysis/yeast/rank_response/find_min_responsive/main.md'
- chipexo_promoter_sig:
- read_in_chipexo_data: 'API/Analysis/yeast/chipexo_promoter_sig/read_in_chipexo_data.md'
- chipexo_promoter_sig: 'API/Analysis/yeast/chipexo_promoter_sig/chipexo_promoter_sig.md'
- parse_args: 'API/Analysis/yeast/chipexo_promoter_sig/parse_args.md'
- main: 'API/Analysis/yeast/chipexo_promoter_sig/main.md'
- BarcodeParser:
- mammals:
- BarcodeCounterQc: 'API/BarcodeParser/mammals/BarcodeCounterQc.md'
- yeast:
- BarcodeCounterQc: 'API/BarcodeParser/yeast/BarcodeCounterQc.md'
- PeakCalling:
- yeast:
- read_in_data:
- qbed_df_to_pyranges: "API/PeakCalling/yeast/read_in_data/qbed_df_to_pyranges.md"
- read_in_background_data: "API/PeakCalling/yeast/read_in_data/read_in_background_data.md"
- read_in_chrmap: "API/PeakCalling/yeast/read_in_data/read_in_chrmap.md"
- read_in_experiment_data: "API/PeakCalling/yeast/read_in_data/read_in_experiment_data.md"
- read_in_promoter_data: "API/PeakCalling/yeast/read_in_data/read_in_promoter_data.md"
- relabel_chr_column: "API/PeakCalling/yeast/read_in_data/relabel_chr_column.md"
- enrichment_vectorized: "API/PeakCalling/yeast/enrichment_vectorized.md"
- hypergeom_pval_vectorized: "API/PeakCalling/yeast/hypergeom_pval_vectorized.md"
- poisson_pval_vectorized: "API/PeakCalling/yeast/poisson_pval_vectorized.md"
- call_peaks:
- count_hops: 'API/PeakCalling/yeast/call_peaks/count_hops.md'
- add_metrics: 'API/PeakCalling/yeast/call_peaks/add_metrics.md'
- call_peaks: 'API/PeakCalling/yeast/call_peaks/call_peaks.md'
- parse_args: 'API/PeakCalling/yeast/call_peaks/parse_args.md'
- main: 'API/PeakCalling/yeast/call_peaks/main.md'
- QC:
- create_status_coder: 'API/QC/create_status_coder.md'
- StatusFlags: 'API/QC/StatusFlags.md'
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "callingCardsTools"
version = "1.5.0"
version = "1.5.1"
description = "A collection of objects and functions to work with calling cards sequencing tools"
authors = ["chase mateusiak <[email protected]>"]
license = "MIT"
Expand Down
Loading

0 comments on commit 07b4378

Please sign in to comment.