OptiType throwing error: Invalid constraint expression
alexanderwhatley opened this issue · comments
I'm getting the following error message. Any idea what is causing it?
mapping with 8 threads...
0:01:18.24 Mapping filtered_fished.fastq to GEN reference...
0:01:45.95 Generating binary hit matrix.
0:01:45.97 Loading optitype_outdir/2017_04_25_02_50_30/2017_04_25_02_50_30_1.bam started. Number of HLA reads loaded (updated every thousand):
0:01:46.04 672 reads loaded. Creating dataframe...
0:01:46.12 Dataframes created. Shape: 672 x 11179, hits: 6952 (11622), sparsity: 1 in 646.39
0:01:51.76 temporary pruning of identical rows and columns
0:01:52.06 Size of mtx with unique rows and columns: (43, 54)
0:01:52.06 determining minimal set of non-overshadowed alleles
0:01:52.19 Keeping only the minimal number of required alleles (4,)
0:01:52.19 Creating compact model...
starting ilp solver with 1 threads...
0:01:52.20 Initializing OptiType model...
Welcome to the CBC MILP Solver
Version: 2.9
Build Date: Mar 7 2017
command line - /n/sw/fasrcsw/apps/Core/Cbc/2.9-fasrc01/bin/cbc -printingOptions all -import /tmp/tmpm4vfz6ss.pyomo.lp -import -stat=1 -solve -solu /tmp/tmpm4vfz6ss.pyomo.soln (default strategy 1)
Option for printingOptions changed from normal to all
CoinLpIO::readLp(): Maximization problem reformulated as minimization
Current default (if $ as parameter) for import is /tmp/tmpm4vfz6ss.pyomo.lp
Presolve 16 (-8) rows, 11 (-3) columns and 37 (-13) elements
Statistics for presolved model
Original problem has 8 integers (8 of which binary)
Presolved problem has 6 integers (6 of which binary)
==== 3 zero objective 7 different
1 variables have objective of -116
1 variables have objective of -101
2 variables have objective of -5
3 variables have objective of 0
2 variables have objective of 0.045
1 variables have objective of 0.909
1 variables have objective of 1.044
==== absolute objective values 7 different
3 variables have objective of 0
2 variables have objective of 0.045
1 variables have objective of 0.909
1 variables have objective of 1.044
2 variables have objective of 5
1 variables have objective of 101
1 variables have objective of 116
==== for integers 2 zero objective 4 different
1 variables have objective of -116
1 variables have objective of -101
2 variables have objective of -5
2 variables have objective of 0
==== for integers absolute objective values 4 different
2 variables have objective of 0
2 variables have objective of 5
1 variables have objective of 101
1 variables have objective of 116
===== end objective counts
Problem has 16 rows, 11 columns (8 with objective) and 37 elements
Column breakdown:
4 of type 0.0->inf, 1 of type 0.0->up, 0 of type lo->inf,
0 of type lo->up, 0 of type free, 0 of type fixed,
0 of type -inf->0.0, 0 of type -inf->up, 6 of type 0.0->1.0
Row breakdown:
0 of type E 0.0, 0 of type E 1.0, 0 of type E -1.0,
0 of type E other, 0 of type G 0.0, 1 of type G 1.0,
0 of type G other, 10 of type L 0.0, 1 of type L 1.0,
4 of type L other, 0 of type Range 0.0->1.0, 0 of type Range other,
0 of type Free
Continuous objective value is -224.957 - 0.00 seconds
Cgl0004I processed model has 16 rows, 11 columns (6 integer (6 of which binary)) and 37 elements
Cbc0038I Initial state - 0 integers unsatisfied sum - 0
Cbc0038I Solution found of -224.957
Cbc0038I Relaxing continuous gives -224.957
Cbc0038I Before mini branch and bound, 6 integers at bound fixed and 0 continuous
Cbc0038I Mini branch and bound did not improve solution (0.00 seconds)
Cbc0038I After 0.00 seconds - Feasibility pump exiting with objective of -224.957 - took 0.00 seconds
Cbc0012I Integer solution of -224.957 found by feasibility pump after 0 iterations and 0 nodes (0.00 seconds)
Cbc0001I Search completed - best objective -224.957, took 0 iterations and 0 nodes (0.00 seconds)
Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost
Cuts at root node changed objective from -224.957 to -224.957
Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Result - Optimal solution found
Objective value: -224.95700000
Enumerated nodes: 0
Total iterations: 0
Time (CPU seconds): 0.00
Time (Wallclock seconds): 0.01
Total time (CPU seconds): 0.00 (Wallclock seconds): 0.01
Traceback (most recent call last):
File "/n/regal/nowak_lab/immunotherapy/OptiType/OptiTypePipeline.py", line 405, in <module>
result = op.solve(args.enumerate)
File "/n/regal/nowak_lab/immunotherapy/OptiType/model.py", line 188, in solve
self.__instance.c.add(expr >= 1)
File "/n/scrb152/Software/Python/py35/lib/python3.5/site-packages/pyomo/core/base/constraint.py", line 1188, in add
cdata = self._check_skip_add(self._nconstraints + 1, expr)
File "/n/scrb152/Software/Python/py35/lib/python3.5/site-packages/pyomo/core/base/constraint.py", line 895, in _check_skip_add
self._data[index].name))
ValueError: Invalid constraint expression. The constraint expression resolved to a trivial Boolean (False) instead of a Pyomo object. Please modify your rule to return Constraint.Infeasible instead of False.
I haven't encountered this one before, I'd have to take a look at the intermediate bam file to see what causes it.
I emailed the files to you.
I am trying to run OptiType from git but I came across the same error originally reported by @alexanderwhatley. Can you help me?
same here. do you know what causes it?
I am having the same error
I included optitype into snakemake pipleline, And also got the same error(Invalid constraint expression), Any solution for this problem? @andras86 , thank you!
R2-2-N Error:
Building DAG of jobs...
Using shell: /bin/bash
Provided cores: 64
Rules claiming more threads will be scaled down.
Job counts:
count jobs
1 optitype_all
1 optitype_hlatyping
2
[Wed Sep 11 21:54:59 2019]
rule optitype_hlatyping:
input: analysis/optitype/R2-2-N/R2-2-N.sorted.chr6.end1.fastq, analysis/optitype/R2-2-N/R2-2-N.sorted.chr6.end2.fastq
output: analysis/optitype/R2-2-N/R2-2-N_result.tsv, analysis/optitype/R2-2-N/R2-2-N_coverage_plot.pdf
jobid: 4
benchmark: benchmarks/optitype/R2-2-N/R2-2-N.optitype_hlatyping.txt
wildcards: sample=R2-2-N
/home/taing/miniconda3/envs/optitype/share/optitype-1.3.2-3/hlatyper.py:239: FutureWarning: from_items is deprecated. Please use DataFrame.from_dict(dict(items), ...) instead. DataFrame.from_dict(OrderedDict(items)) may be used to preserve the key order.
pos_df = pd.DataFrame.from_items(iter(hits.items())).T
Traceback (most recent call last):
File "/home/taing/miniconda3/envs/optitype/bin/OptiTypePipeline.py", line 421, in <module>
result = op.solve(args.enumerate)
File "/home/taing/miniconda3/envs/optitype/share/optitype-1.3.2-3/model.py", line 188, in solve
self.__instance.c.add(expr >= 1)
File "/home/taing/miniconda3/envs/optitype/lib/python2.7/site-packages/pyomo/core/base/constraint.py", line 800, in add
return Constraint.add(self, self._nconstraints, expr)
File "/home/taing/miniconda3/envs/optitype/lib/python2.7/site-packages/pyomo/core/base/constraint.py", line 413, in add
""" % ( expr, expr and "Feasible" or "Infeasible", expr, self.cname(True) ) )
ValueError:
Invalid constraint expression. The constraint expression resolved to a
trivial Boolean (False) instead of a Pyomo object. Please modify your rule
to return Constraint.Infeasible instead of False.
Error thrown for Constraint "c"
[Wed Sep 11 21:55:11 2019]
Error in rule optitype_hlatyping:
jobid: 4
output: analysis/optitype/R2-2-N/R2-2-N_result.tsv, analysis/optitype/R2-2-N/R2-2-N_coverage_plot.pdf
shell:
source activate /home/taing/miniconda3/envs/optitype/; OptiTypePipeline.py -i analysis/optitype/R2-2-N/R2-2-N.sorted.chr6.end1.fastq analysis/optitype/R2-2-N/R2-2-N.sorted.chr6.end2.fastq --dna -v -o analysis/optitype/R2-2-N/ -p R2-2-N --config cidc_wes/static/optitype/config.ini
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: /mnt/ssd/wes/.snakemake/log/2019-09-11T215459.181918.snakemake.log
I'm afraid this kind of error can only occur if there are no HLA-A, B, or C reads in the sample whatsoever, and hence nothing to type either. Is this from a batch of samples that ran through successfully otherwise?