Skip to content

Commit

Permalink
DOC: causal_sites
Browse files Browse the repository at this point in the history
Add documentation for causal_sites input
  • Loading branch information
daikitag committed Feb 2, 2024
1 parent 2909b1c commit 32a0de5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
19 changes: 19 additions & 0 deletions docs/effect-size.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,22 @@ plt.show()

We see that rarer variants have increased effect sizes, as expected from
the mathematical expression given in [](eq:freq-dep).

(trait_causal_sites)=

## Specifying Causal Sites

Instead of specifying the number of causal sites, users can directly provide the
causal sites as an input of {py:func}`sim_phenotype` and {py:func}`sim_trait`.
When `causal_sites` argument of these functions are provided, tstrait will use
the inputted site IDs as causal sites, instead of randomly selecting causal
site IDs.

Example:

```{code-cell}
trait_df = tstrait.sim_trait(ts, causal_sites=[0, 3, 4], model=model,
alpha=-1/2, random_seed=1)
trait_df
```
9 changes: 0 additions & 9 deletions tstrait/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,3 @@ def _check_non_decreasing(array, array_name):
diff = np.diff(array)
if np.min(diff) < 0:
raise ValueError(f"{array_name} must be non-decreasing")


def _check_no_repeat(array, array_name):
"""Check that there are no repeated values in the array."""
array = np.sort(array)
if len(array) > 1:
diff = np.diff(array)
if np.min(diff) == 0:
raise ValueError(f"There must not be repeated values in {array_name}")
1 change: 0 additions & 1 deletion tstrait/simulate_effect_size.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import numbers
from dataclasses import dataclass

import numpy as np
Expand Down

0 comments on commit 32a0de5

Please sign in to comment.