Skip to content

Commit

Permalink
Bug fix in event series parsing
Browse files Browse the repository at this point in the history
Fixed nasty bug related to providing an empty mutable as the default argument to an __init__ method. Also fixed stochastic map example file for two regions, as well as the paleogeographic data for that same example.

Added a new barrier appearance and disappearance classes that are now included in the event series. The barrier event is probably not necessary, but the barrier disappearance one is, because it tells us if the range became stable again.

Need to next write unit tests for the simple 2 region stochastic map / event series parsing. Then write a new method for truncation of that.
  • Loading branch information
binho authored and binho committed Mar 23, 2024
1 parent edae058 commit c54cf8a
Show file tree
Hide file tree
Showing 5 changed files with 346 additions and 77 deletions.
14 changes: 10 additions & 4 deletions NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

The first thing you must do before you can start coding within the `PhyloJunction` framework
is to set it up within an integrated development environment (IDE).
The IDE of choice here is VSCode, a very popular, clean and fast IDE.
The IDEs of choice here are VSCode or PyCharm, which arevery popular, clean and fast IDEs.

### VS Code

The first step is to go under "File" > "Open Folder..." and choose `PhyloJunction/`, the git repository root folder.
If you click around for a bit, you will notice that the module files (`.py` files) are inside
Expand Down Expand Up @@ -54,7 +56,7 @@ Now inside `settings.json`, add this:
}
```

## Configuring unit tests (using unittest) on VSCode
**Configuring unit tests (using unittest) on VSCode**

If you have an Apple machine, the shortcut on VSCode is "CMD + Shift + P", "Python: Configure Tests".
This will add to your `settings.json` file inside hidden folder `.vscode`.
Expand All @@ -80,6 +82,10 @@ Your `settings.json` will look like this:
If VSCode refuses to find the tests, one thing that might be set up wrong is the Python interpreter VSCode is using.
Unit tests usually have many dependencies -- if those dependencies are not found because the wrong interpreter is used (the native one that comes with the machine, say, instead of an interpreter installed with Homebrew), then the tests will not be found.

### PyCharm

Once you Open Project, you must tell PyCharm where the source files are: PyCharm > Settings > Project: PhyloJunction > Project Structure, the click on `src/` and click on the folder "Sources" icon.

## Type checking

`mypy`'s documentation suggests calling mypy on entire packages, e.g.,
Expand Down Expand Up @@ -150,7 +156,7 @@ If you are on an Apple machine that obstrusively curtails file system access, ru

```
cd PhyloJunction/
python3 -m pip install --user -e .
python3.11 -m pip install --user -e .
```

The `--user` flag is the way around said restrictions.
Expand All @@ -159,7 +165,7 @@ Remember to add this path to the PATH system variable if you want to call the ex
Another option is to run the following command:

```
python3 -m pip install --prefix ~/.local -e .
python3.11 -m pip install --prefix ~/.local -e .
```

Which creates (or writes inside) directories `bin/` (placing the executables therein) and `lib/python3.X/site-packages/` (placing the egg-link therein) inside `~/.local`.
Expand Down
12 changes: 6 additions & 6 deletions examples/trees_maps_files/geosse_dummy_tree2_maps.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ iteration node_index branch_start_time branch_end_time start_state end_state tra
1 4 1 0 1 1 NA no_change 7 NA NA
1 5 3 0 0 0 NA no_change 8 NA NA
1 6 5 4 0 2 4.75 anagenetic 9 1 2
1 6 4 4 2 2 NA no_change 9 1 2
1 6 4 4 2 0 4 cladogenetic 9 1 2
1 6 4 4 2 1 4 cladogenetic 9 1 2
1 6 5 4 2 2 NA no_change 9 1 2
1 6 5 4 2 0 4 cladogenetic 9 1 2
1 6 5 4 2 1 4 cladogenetic 9 1 2
1 7 3 1 1 2 2.75 anagenetic 8 3 4
1 7 1 1 2 2 NA no_change 8 3 4
1 7 1 1 2 0 1 cladogenetic 8 3 4
1 7 1 1 2 1 1 cladogenetic 8 3 4
1 8 5 3 0 2 3.25 anagenetic 9 5 7
1 8 3 3 2 2 NA no_change 9 5 7
1 8 3 3 2 0 3 cladogenetic 9 5 7
1 8 3 3 2 1 3 cladogenetic 9 5 7
1 8 5 3 2 2 NA no_change 9 5 7
1 8 5 3 2 0 3 cladogenetic 9 5 7
1 8 5 3 2 1 3 cladogenetic 9 5 7
Loading

0 comments on commit c54cf8a

Please sign in to comment.