Skip to content

Commit

Permalink
Add full inference test and remove mutation model ignore_ualabel call (
Browse files Browse the repository at this point in the history
…#97)

* Add full inference test and fix mut model ualabel call

* add criteria combinations to smalltest

* fix abundance filepath
  • Loading branch information
willdumm authored Jun 7, 2022
1 parent efd4fb0 commit dff3119
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 5 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ install:
pip install -e .

test:
bash tests/smalltest.sh
pytest
gctree test

Expand Down
10 changes: 5 additions & 5 deletions gctree/mutation_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,11 @@ def _mutability_dagfuncs(
mutation_model = MutationModel(*args, **kwargs)
dist = _mutability_distance(mutation_model, splits=splits)

@hdag.utils.access_field("label")
@hdag.utils.ignore_ualabel(0)
@hdag.utils.access_field("sequence")
def distance(seq1, seq2):
return dist(seq1, seq2)
def distance(node1, node2):
if node1.is_root():
return 0
else:
return dist(node1.label.sequence, node2.label.sequence)

return hdag.utils.AddFuncDict(
{"start_func": lambda n: 0, "edge_weight_func": distance, "accum_func": sum},
Expand Down
43 changes: 43 additions & 0 deletions tests/idmap.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
GL,
seq1,VIBM1S4A05
seq2,VIBM1S4A06
seq3,VIBM1S4A09
seq4,VIBM1S4B02
seq5,VIBM1S4B03
seq6,VIBM1S4B04
seq7,VIBM1S4B06
seq8,VIBM1S4B09
seq9,VIBM1S4B10:VIBM1S4C09:VIBM1S4H12
seq10,VIBM1S4B12
seq11,VIBM1S4C03
seq12,VIBM1S4C04
seq13,VIBM1S4C05
seq14,VIBM1S4C07:VIBM1S4E04:VIBM1S4F07
seq15,VIBM1S4C08:VIBM1S4F04:VIBM1S4F05
seq16,VIBM1S4C11
seq17,VIBM1S4D02
seq18,VIBM1S4D04
seq19,VIBM1S4D05
seq20,VIBM1S4D06
seq21,VIBM1S4D07
seq22,VIBM1S4D08
seq23,VIBM1S4D09
seq24,VIBM1S4D10
seq25,VIBM1S4D11
seq26,VIBM1S4D12
seq27,VIBM1S4E02
seq28,VIBM1S4E03
seq29,VIBM1S4E05:VIBM1S4F02
seq30,VIBM1S4E06
seq31,VIBM1S4E08
seq32,VIBM1S4E09
seq33,VIBM1S4E12
seq34,VIBM1S4F09
seq35,VIBM1S4F10
seq36,VIBM1S4F11
seq37,VIBM1S4G03
seq38,VIBM1S4G04
seq39,VIBM1S4H07
seq40,VIBM1S4H08
seq41,VIBM1S4H09
seq42,VIBM1S4HHH:VIBM1S4HHJ:VIBM1S4HHK:VIBM1S4HHL:VIBM1S4HHM:VIBM1S4HHA:VIBM1S4HHB:VIBM1S4HHC:VIBM1S4HHD:VIBM1S4HKH:VIBM1S4HLJ:VIBM1S4HMJ:VIBM1S4HAJ:VIBM1S4HBJ:VIBM1S4HKJ:VIBM1S4HDJ:VIBM1S4HCJ
65 changes: 65 additions & 0 deletions tests/isotypemap.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
VIBM1S4A05, IgG2
VIBM1S4A06, IgG2
VIBM1S4A09, IgG2
VIBM1S4B02, IgG2
VIBM1S4B03, IgG2
VIBM1S4B04, IgG2
VIBM1S4B06, IgG2
VIBM1S4B09, IgG2
VIBM1S4B10, IgG2
VIBM1S4C09, IgG2
VIBM1S4H12, IgG2
VIBM1S4B12, IgG2
VIBM1S4C03, IgG2
VIBM1S4C04, IgA
VIBM1S4C05, IgG2
VIBM1S4C07, IgG2
VIBM1S4E04, IgG2
VIBM1S4F07, IgG2
VIBM1S4C08, IgG2
VIBM1S4F04, IgG2
VIBM1S4F05, IgG2
VIBM1S4C11, IgG2
VIBM1S4D02, IgG2
VIBM1S4D04, IgG3
VIBM1S4D05, IgG2
VIBM1S4D06, IgA
VIBM1S4D07, IgG2
VIBM1S4D08, IgG2
VIBM1S4D09, IgG2
VIBM1S4D10, IgG2
VIBM1S4D11, IgG2
VIBM1S4D12, IgG2
VIBM1S4E02, IgG2
VIBM1S4E03, IgG2
VIBM1S4E05, IgG2
VIBM1S4F02, IgG2
VIBM1S4E06, IgG2
VIBM1S4E08, IgG2
VIBM1S4E09, IgG2
VIBM1S4E12, IgG2
VIBM1S4F09, IgG2
VIBM1S4F10, IgG2
VIBM1S4F11, IgG2
VIBM1S4G03, IgE
VIBM1S4G04, IgG2
VIBM1S4H07, IgG2
VIBM1S4H08, IgG2
VIBM1S4H09, IgG2
VIBM1S4HHH, IgG2
VIBM1S4HHJ, IgE
VIBM1S4HHK, IgE
VIBM1S4HHL, IgE
VIBM1S4HHM, IgE
VIBM1S4HHA, IgE
VIBM1S4HHB, IgE
VIBM1S4HHC, IgG3
VIBM1S4HHD, IgG3
VIBM1S4HKH, IgG3
VIBM1S4HLJ, IgG3
VIBM1S4HMJ, IgG3
VIBM1S4HAJ, IgG3
VIBM1S4HBJ, IgG3
VIBM1S4HKJ, IgG3
VIBM1S4HDJ, IgG3
VIBM1S4HCJ, IgG3
9 changes: 9 additions & 0 deletions tests/smalltest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

export QT_QPA_PLATFORM=offscreen
export XDG_RUNTIME_DIR=/tmp/runtime-runner
export MPLBACKEND=agg
gctree infer tests/small_outfile tests/abundances.csv --root GL --frame 1 --verbose --idlabel
gctree infer tests/small_outfile tests/abundances.csv --root GL --frame 1 --verbose --idlabel --idmapfile tests/idmap.txt --isotype_mapfile tests/isotypemap.txt
gctree infer tests/small_outfile tests/abundances.csv --root GL --frame 1 --verbose --idlabel --mutability S5F/Mutability.csv --substitution S5F/Substitution.csv
gctree infer tests/small_outfile tests/abundances.csv --root GL --frame 1 --verbose --idlabel --idmapfile tests/idmap.txt --isotype_mapfile tests/isotypemap.txt --mutability S5F/Mutability.csv --substitution S5F/Substitution.csv

0 comments on commit dff3119

Please sign in to comment.