psathyrella / partis

B- and T-cell receptor sequence annotation, simulation, clonal family and germline inference, and affinity prediction
GNU General Public License v3.0
54 stars 34 forks source link

Can't simulate naive sequences? #247

Closed scharch closed 6 years ago

scharch commented 6 years ago

Presumably I'm just using the wrong flags for doing this, but --flate-mute-freq 0 causes an error:

partis simulate --outfname partis_simulate.csv --n-sim-events 10 --n-leaves 1 --constant-number-of-leaves --mutate-from-scratch --same-mute-freq-for-all-seqs --flat-mute-freq 0 --only-genes IGHV1-69*10:IGHD3-10*01:IGHJ6*02 --rearrange-from-scratch
simulating
Traceback (most recent call last):
  File "/home/schrammca/bin/partis", line 423, in <module>
    args.func(args)
  File "/home/schrammca/bin/partis", line 130, in run_simulation
    make_events(n_per_proc, 0, args.workdir, args.outfname, all_random_ints[0])
  File "/home/schrammca/bin/partis", line 107, in make_events
    reco = Recombinator(args, glfo, seed=args.seed+iproc, workdir=workdir, outfname=outfname)
  File "/home/schrammca/partis/partis/python/recombinator.py", line 70, in __init__
    treegen.generate_trees(seed, self.treefname)  # NOTE not really a newick file, since I hack on the per-region branch length info at the end of each line
  File "/home/schrammca/partis/partis/python/treegenerator.py", line 267, in generate_trees
    self.post_process_trees(outfname, lonely_leaves, ages)
  File "/home/schrammca/partis/partis/python/treegenerator.py", line 170, in post_process_trees
    treestrs[itree] = rescale_tree(treestrs[itree], ages[itree])
  File "/home/schrammca/partis/partis/python/treegenerator.py", line 76, in rescale_tree
    ln.length *= new_height / mean_height  # rescale every branch length in the tree by the ratio of desired to existing height (everybody's heights should be the same... but they never quite were when I was using Bio.Phylo, so, uh. yeah, uh. not sure what to do, but this is fine. It's checked below, anyway)
ZeroDivisionError: float division by zero
Exception OSError: (39, 'Directory not empty', '/tmp/tmpBy3D_7') in <bound method Recombinator.__del__ of <recombinator.Recombinator object at 0x7f46654a7c10>> ignored
psathyrella commented 6 years ago

still thinking about your other issue, but this is --mutation-multiplier you want.

psathyrella commented 6 years ago

and it looks like it needs to be like 0.000000001 (or whatever small) instead of 0.

I should probably fix that, but it still gives you essenitally zero shm.

scharch commented 6 years ago

Yeah, I did the same thing with --flat-mute-rate 0.000001