| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
package dr.evomodel.operators; |
| 27 |
|
| 28 |
import dr.evolution.util.Taxon; |
| 29 |
import dr.evomodel.tree.HiddenLinkageModel; |
| 30 |
import dr.evomodelxml.operators.MoveLinkageGroupParser; |
| 31 |
import dr.inference.operators.SimpleMCMCOperator; |
| 32 |
import dr.math.MathUtils; |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
public class MoveLinkageGroup extends SimpleMCMCOperator { |
| 38 |
|
| 39 |
HiddenLinkageModel hlm; |
| 40 |
int readCount; |
| 41 |
int groupCount; |
| 42 |
|
| 43 |
public MoveLinkageGroup(HiddenLinkageModel hlm, double weight){ |
| 44 |
this.hlm = hlm; |
| 45 |
readCount = hlm.getData().getReadsTaxa().getTaxonCount(); |
| 46 |
groupCount = hlm.getLinkageGroupCount(); |
| 47 |
setWeight(weight); |
| 48 |
} |
| 49 |
|
| 50 |
public double doOperation() { |
| 51 |
|
| 52 |
int r = MathUtils.nextInt(readCount); |
| 53 |
Taxon read = hlm.getData().getReadsTaxa().getTaxon(r); |
| 54 |
int g=hlm.getLinkageGroupId(read); |
| 55 |
|
| 56 |
int newGroup = MathUtils.nextInt(groupCount); |
| 57 |
hlm.moveReadGroup(read, g, newGroup); |
| 58 |
|
| 59 |
|
| 60 |
double logHastings = 0.0; |
| 61 |
return logHastings; |
| 62 |
} |
| 63 |
|
| 64 |
public String getOperatorName() { |
| 65 |
return MoveLinkageGroupParser.MOVE_LINKAGE_GROUP + "(" + hlm.getId() + ")"; |
| 66 |
} |
| 67 |
|
| 68 |
public String getPerformanceSuggestion() { |
| 69 |
return "Ask Aaron Darling to write a better operator"; |
| 70 |
} |
| 71 |
|
| 72 |
} |