Debian Codegraph @

src/dr/evomodel/alloppnet/operators/MulTreeSequenceReassignment.java

raw symbols SCIP
1
2 /*
3 * MulTreeSequenceReassignment.java
4 *
5 * Copyright (c) 2002-2017 Alexei Drummond, Andrew Rambaut and Marc Suchard
6 *
7 * This file is part of BEAST.
8 * See the NOTICE file distributed with this work for additional
9 * information regarding copyright ownership and licensing.
10 *
11 * BEAST is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as
13 * published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * BEAST is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with BEAST; if not, write to the
23 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
24 * Boston, MA 02110-1301 USA
25 */
26
27 package dr.evomodel.alloppnet.operators;
28
29 import dr.evomodel.alloppnet.speciation.MulSpeciesBindings;
30 import dr.evomodel.alloppnet.speciation.MulSpeciesTreeModel;
31 import dr.evomodel.alloppnet.parsers.MulTreeSequenceReassignmentParser;
32 import dr.inference.operators.SimpleMCMCOperator;
33 import dr.math.MathUtils;
34
35
36 /**
37 * Changes sequence assignments for one gene, one or more individuals.
38 * Very similar to AlloppSequenceReassignment.
39 *
40 * @author Graham Jones
41 * Date: 20/12/2011
42 */
43 public class MulTreeSequenceReassignment extends SimpleMCMCOperator {
44
45 private final MulSpeciesTreeModel multree;
46 private final MulSpeciesBindings mulspb;
47
48
49 public MulTreeSequenceReassignment(MulSpeciesTreeModel multree, MulSpeciesBindings mulspb, double weight) {
50 this.multree = multree;
51 this.mulspb = mulspb;
52 setWeight(weight);
53 }
54
55
56 public String getPerformanceSuggestion() {
57 return "None";
58 }
59
60 @Override
61 public String getOperatorName() {
62 return MulTreeSequenceReassignmentParser.MULTREE_SEQUENCE_REASSIGNMENT + "(" + multree.getId() +
63 "," + mulspb.getId() + ")";
64 }
65
66 @Override
67 public double doOperation() {
68 multree.beginTreeEdit();
69 if (MathUtils.nextInt(2) == 0) {
70 mulspb.permuteOneSpeciesOneIndivForOneGene();
71 } else {
72 mulspb.permuteSetOfIndivsForOneGene();
73 }
74
75 multree.endTreeEdit();
76 return 0;
77 }
78
79 }
80
81