raphael-group / MERLIN

7 stars 0 forks source link

Value error while running example data #4

Closed teng-gao closed 3 months ago

teng-gao commented 3 months ago
(myenv) ~/MERLIN$ python3 src/merlin.py -t data/example/total_matrix.csv -v data/example/variant_matrix.csv -o data/example/
/Users/tgao/MERLIN/src/merlin.py:76: RuntimeWarning: invalid value encountered in scalar divide
  slope = np.dot(vaf1, vaf2) / np.dot(vaf1, vaf1)
Set parameter WLSAccessID
Set parameter WLSSecret
Set parameter LicenseID to value 2546583
Academic license 2546583 - for non-commercial use only - registered to tg___@broadinstitute.org
Set parameter TimeLimit to value 7200
Set parameter Threads to value 1
Set parameter Method to value 4
Gurobi Optimizer version 11.0.3 build v11.0.3rc0 (mac64[arm] - Darwin 23.6.0 23G93)

CPU model: Apple M2 Pro
Thread count: 10 physical cores, 10 logical processors, using up to 1 threads

Academic license 2546583 - for non-commercial use only - registered to tg___@broadinstitute.org
Optimize a model with 4505 rows, 1407 columns and 12057 nonzeros
Model fingerprint: 0xe5430a83
Variable types: 1150 continuous, 257 integer (257 binary)
Coefficient statistics:
  Matrix range     [5e-02, 1e+00]
  Objective range  [1e+00, 1e+00]
  Bounds range     [1e+00, 1e+00]
  RHS range        [5e-02, 2e+00]
Found heuristic solution: objective 74.8544702
Presolve removed 2276 rows and 775 columns
Presolve time: 0.02s
Presolved: 2229 rows, 632 columns, 6172 nonzeros
Variable types: 406 continuous, 226 integer (226 binary)

Root relaxation: objective -7.105427e-15, 448 iterations, 0.01 seconds (0.01 work units)

    Nodes    |    Current Node    |     Objective Bounds      |     Work
 Expl Unexpl |  Obj  Depth IntInf | Incumbent    BestBd   Gap | It/Node Time

     0     0   -0.00000    0    1   74.85447   -0.00000   100%     -    0s
H    0     0                       0.1175378   -0.00000   100%     -    0s
     0     0     cutoff    0         0.11754    0.11754  0.00%     -    0s

Cutting planes:
  Learned: 5
  Gomory: 1
  RLT: 3

Explored 1 nodes (590 simplex iterations) in 0.04 seconds (0.06 work units)
Thread count was 1 (of 10 available processors)

Solution count 2: 0.117538 74.8545 

Optimal solution found (tolerance 1.00e-04)
Best objective 1.175377692060e-01, best bound 1.175377692060e-01, gap 0.0000%
Traceback (most recent call last):
  File "/Users/tgao/MERLIN/src/merlin.py", line 269, in <module>
    main()
  File "/Users/tgao/MERLIN/src/merlin.py", line 267, in main
    set_ILP_formuation(G_ancestry, cell2group, df_variant, df_total, args.out)
  File "/Users/tgao/MERLIN/src/merlin.py", line 240, in set_ILP_formuation
    df_a = pd.DataFrame(np.reshape(model.getAttr('x', a).values(), (ngroups, nmutations)).astype(int),
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tgao/MERLIN/myenv/lib/python3.12/site-packages/numpy/_core/fromnumeric.py", line 328, in reshape
    return _wrapfunc(a, 'reshape', shape, order=order)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tgao/MERLIN/myenv/lib/python3.12/site-packages/numpy/_core/fromnumeric.py", line 54, in _wrapfunc
    return _wrapit(obj, method, *args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tgao/MERLIN/myenv/lib/python3.12/site-packages/numpy/_core/fromnumeric.py", line 46, in _wrapit
    result = getattr(arr, method)(*args, **kwds)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: cannot reshape array of size 1 into shape (50,5)
Warning: environment still referenced so free is deferred (Continue to use WLS)
ViolaChenYT commented 3 months ago

would you mind trying again? It should be fixed but let me know if you still run into issues! thanks