Closed Arts-of-coding closed 1 year ago
Can you install the latest version and run with -n 1
? This should fix it:
pip install git+https://github.com/vanheeringen-lab/ANANSE.git@develop
Dear @simonvh,
It indeed seems to work now, I do not get the recursion error anymore. Many thanks!
Dear @simonvh,
The develop version works very well for many of my samples. However, for a very limited amount of transcription factors I get an Valueerror. The issue seems to be indeed SOX7, because when I delete SOX7 from the DEG file, the program runs just fine. Additionally, for a limited amount of factors it can not calculate the p-value, despite the fact that it is present in the DEG file (see HES1).
How can I solve these two problems without omitting the factors?
Console command
(ananse030) julian@cn45:/ceph/rimlsfnwi/data/moldevbio/zhou/jarts/jupyter_notebooks$ nice -15 ananse influence -s /ceph/rimlsfnwi/data/moldevbio/zhou/jsmits/Ananse_test_data/analysis/peakpred_V4/only_ATAC/ESCs/full_network_include-promoter.txt -t /ceph/rimlsfnwi/data/moldevbio/zhou/jarts/data/lako2021/ANANSE/outs3/CSB/full_network_includeprom.txt -d /ceph/rimlsfnwi/data/moldevbio/zhou/jarts/R/scRNA-seq/20210710CSBESCpseudobulkpadj.tsv --plot -o /ceph/rimlsfnwi/data/moldevbio/zhou/jarts/data/lako2021/ANANSE/outs3/CSB/ESCCSB_influence_100000_V3/influence.txt -n 1
2021-07-30 13:36:31 | INFO | Reading network(s), using top 100000 edges.
2021-07-30 13:38:23 | INFO | Differential network has 91045 edges.
2021-07-30 13:38:24 | INFO | Saving differential network.
2021-07-30 13:38:24 | INFO | Calculating target scores.
2021-07-30 13:38:24 | INFO | Differential network contains 115 transcription factors.
2021-07-30 13:38:24 | INFO | Out of these, 68 are differentially expressed.
0%| | 0/68 [00:00<?, ?it/s]2021-07-30 13:38:24 | WARNING | Could not calculate p-val (target vs non-target fold-change) for NR2F6.
1%|█▋ | 1/68 [00:00<00:09, 6.80it/s]2021-07-30 13:38:24 | WARNING | Could not calculate p-val (target vs non-target fold-change) for SREBF1.
12%|█████████████ | 8/68 [02:47<23:16, 23.28s/it]2021-07-30 13:41:12 | WARNING | Could not calculate p-val (target vs non-target fold-change) for CUX1.
25%|███████████████████████████▌ | 17/68 [04:18<08:48, 10.36s/it]2021-07-30 13:42:43 | WARNING | Could not calculate p-val (target vs non-target fold-change) for CREB3L2.
31%|█████████████████████████████████▉ | 21/68 [05:09<12:17, 15.69s/it]2021-07-30 13:43:33 | WARNING | Could not calculate p-val (target vs non-target fold-change) for HES1.
41%|█████████████████████████████████████████████▎ | 28/68 [11:25<28:41, 43.04s/it]2021-07-30 13:49:49 | WARNING | Could not calculate p-val (target vs non-target fold-change) for FOXC1.
74%|████████████████████████████████████████████████████████████████████████████████▉ | 50/68 [21:39<09:32, 31.78s/it]2021-07-30 14:00:04 | WARNING | Could not calculate p-val (target vs non-target fold-change) for ZNF628.
81%|████████████████████████████████████████████████████████████████████████████████████████▉ | 55/68 [23:52<05:38, 26.05s/it]
2021-07-30 14:02:16 | ERROR | An error has been caught in function '<module>', process 'MainProcess' (9295), thread 'MainThread' (22877091034944):
Traceback (most recent call last):
> File "/vol/mbconda/julian/envs/ananse030/bin/ananse", line 370, in <module>
args.func(args)
│ │ └ Namespace(Gaf='/ceph/rimlsfnwi/data/moldevbio/zhou/jarts/data/lako2021/ANANSE/outs3/CSB/full_network_includeprom.txt', expres...
│ └ <function influence at 0x14ce6133b1f0>
└ Namespace(Gaf='/ceph/rimlsfnwi/data/moldevbio/zhou/jarts/data/lako2021/ANANSE/outs3/CSB/full_network_includeprom.txt', expres...
File "/vol/mbconda/julian/envs/ananse030/lib/python3.9/site-packages/ananse/commands/influence.py", line 28, in influence
a.run_influence(args.plot) # -p
│ │ │ └ True
│ │ └ Namespace(Gaf='/ceph/rimlsfnwi/data/moldevbio/zhou/jarts/data/lako2021/ANANSE/outs3/CSB/full_network_includeprom.txt', expres...
│ └ <function Influence.run_influence at 0x14ce6133b4c0>
└ <ananse.influence.Influence object at 0x14ce608c8a90>
File "/vol/mbconda/julian/envs/ananse030/lib/python3.9/site-packages/ananse/influence.py", line 440, in run_influence
influence_file = self.run_target_score()
│ └ <function Influence.run_target_score at 0x14ce6133b3a0>
└ <ananse.influence.Influence object at 0x14ce608c8a90>
File "/vol/mbconda/julian/envs/ananse030/lib/python3.9/site-packages/ananse/influence.py", line 353, in run_target_score
targetScore(tf, self.G, self.expression_change, max_degree)
│ │ │ │ │ │ └ 3
│ │ │ │ │ └ {'A1BG-AS1': Expression(score=5.95559564232664, absfc=5.95559564232664, realfc=-5.95559564232664), 'A2M-AS1': Expression(scor...
│ │ │ │ └ <ananse.influence.Influence object at 0x14ce608c8a90>
│ │ │ └ <networkx.classes.digraph.DiGraph object at 0x14ce79c546a0>
│ │ └ <ananse.influence.Influence object at 0x14ce608c8a90>
│ └ 'SOX7'
└ <function targetScore at 0x14ce6133b040>
File "/vol/mbconda/julian/envs/ananse030/lib/python3.9/site-packages/ananse/influence.py", line 181, in targetScore
pval = mannwhitneyu(target_fc, non_target_fc)[1]
│ │ └ [1.39823554111491, 4.1683099187238, 1.5175785156745, 0.992809527831118, 0.748845700863607, 2.57403113993767, 0.12003824843831...
│ └ []
└ <function mannwhitneyu at 0x14ce738894c0>
File "/vol/mbconda/julian/envs/ananse030/lib/python3.9/site-packages/scipy/stats/_mannwhitneyu.py", line 391, in mannwhitneyu
_mwu_input_validation(x, y, use_continuity, alternative, axis, method))
│ │ │ │ │ │ └ 'auto'
│ │ │ │ │ └ 0
│ │ │ │ └ 'two-sided'
│ │ │ └ True
│ │ └ [1.39823554111491, 4.1683099187238, 1.5175785156745, 0.992809527831118, 0.748845700863607, 2.57403113993767, 0.12003824843831...
│ └ []
└ <function _mwu_input_validation at 0x14ce73881ee0>
File "/vol/mbconda/julian/envs/ananse030/lib/python3.9/site-packages/scipy/stats/_mannwhitneyu.py", line 135, in _mwu_input_validation
raise ValueError('`x` and `y` must be of nonzero size.')
ValueError: `x` and `y` must be of nonzero size.
Within the network files the TFs are found both as TF1 and TF2 specified below. Additionally the values within the DEG file look fine to me
tf_target prob
TF1_TF2 value
resid log2FoldChange padj
SOX7 2.09843119005866 1.59385870438176e-09
HES1 4.36895985967573 1.47232140608283e-83
Many thanks in advance again!
I fixed it myself. If other people are having trouble, here is the solution:
Inside the influence.py file in your conda environment (~/lib/python3.9/site-packages/ananse/) change:
try:
pval = mannwhitneyu(target_fc, non_target_fc)[1]
except RecursionError:
to
try:
pval = mannwhitneyu(target_fc, non_target_fc)[1]
except (RecursionError, ValueError) as e:
This way it will skip the ValueError as well.
Re-open as a reminder to fix this in the new release.
Hi,
When running ananse influence (ananse newest version) I get a recursion error. I initially thought that I got the error, because of some of the new changes that were made in the influence.py file could perhaps account for it. That is not the case (see below). I still get the error (at the same stages) when I manually adjusted the recursion limit (form 3000 to 10000 or 100000). Running it on one or multiple cores does not matter. Additionally, all networks files that I use are generated with the new binding.h5 files.
As can be seen, the differential network file is generate perfectly, but it seems that with generating the influence.txt file the error occurs. My question is: is there a version of influence.py that uses a more iterative approach instead of a recursive one that I can use or are you are perhaps developing the influence command in a non-recursive dependent way?
Error log influence.py version 0.3.0:
Error log influence.py version 0.2.2:
Error log influence.py version 0.3.0 in bash:
Heads of all data files used in the bash command:
I'm hoping it can be fixed soon, many thanks in advance!
Kind regards,
Julian