Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to BEAST 2.7 operators #128

Open
walterxie opened this issue Jan 17, 2024 · 2 comments
Open

Migrate to BEAST 2.7 operators #128

walterxie opened this issue Jan 17, 2024 · 2 comments
Labels
critical change the bug fix or new feature will significant change the code enhancement New feature or request

Comments

@walterxie
Copy link
Collaborator

walterxie commented Jan 17, 2024

TODO:

  1. AVMNNoperator for frequencies, site and substitution models, and trees;
  2. Strict clock UpDownOperator with AVMNNoperators;
  3. relax clock ?
  4. replace tree scale operator with more efficient BICESPS operators.
@walterxie walterxie added the enhancement New feature or request label Jan 17, 2024
@walterxie walterxie changed the title AdaptableOperatorSampler and AdaptableVarianceMultivariateNormalOperator Migrate to BEAST 2.7 operators Aug 6, 2024
@walterxie
Copy link
Collaborator Author

It is very complex. Each AdaptableVarianceMultivariateNormalOperator will map to each beast partition.

The code needs a Map to store the idref of parameters in an AVMN operator, which has be partially implemented in the branch AVMNNoperator. Check TODO in lphybeast.tobeast.operators.DefaultOperatorStrategy

walterxie added a commit that referenced this issue Aug 7, 2024
walterxie added a commit that referenced this issue Sep 3, 2024
walterxie added a commit that referenced this issue Sep 3, 2024
@walterxie
Copy link
Collaborator Author

walterxie commented Sep 3, 2024

The proposed implementation is to add AVMNNoperator separately, after adding all default operators but before adding extra operators. So it needs:

  1. guess partition from index added in ID, e.g. *_0, *_1, ...
  2. link the required operators in the same partition
  3. create XML.

Here is the BEAST template for guide:

            <operator id="AVMNOperator.$(n)" spec="beast.base.evolution.operator.kernel.AdaptableVarianceMultivariateNormalOperator" weight="0.1" 
                coefficient="1.0"
                scaleFactor="1"
                beta="0.05"
                initial="800"
                burnin="400"
                every="1" allowNonsense="true">
            	<transformations id="AVMNSumTransform.$(n)" spec="beast.base.inference.operator.kernel.Transform$LogConstrainedSumTransform" sum="1.0">
            		<!-- frequencies -->
            	</transformations>
            	<transformations id="AVMNLogTransform.$(n)" spec="beast.base.inference.operator.kernel.Transform$LogTransform">
             		<!-- site and substitution model parameters -->
            	</transformations>
            	<transformations id="AVMNNoTransform.$(n)" spec="beast.base.inference.operator.kernel.Transform$NoTransform">
             		<!-- tree -->
            	</transformations>
            </operator>

	        <operator id="StrictClockRateScaler.c:$(n)" spec="beast.base.evolution.operator.AdaptableOperatorSampler" weight="1.5">
                <parameter idref="clockRate.c:$(n)"/>
    	        <operator idref="AVMNOperator.$(n)"/>
        	    <operator id='StrictClockRateScalerX.c:$(n)' spec='kernel.BactrianScaleOperator' scaleFactor="0.75" weight="3" parameter='@clockRate.c:$(n)'/>
	        </operator>

        	<operator id="strictClockUpDownOperator.c:$(n)" spec="beast.base.evolution.operator.AdaptableOperatorSampler" weight="1.5">
                <parameter idref="clockRate.c:$(n)"/>
                <tree idref="Tree.t:$(n)"/>
	            <operator idref="AVMNOperator.$(n)"/>
				<operator id='strictClockUpDownOperatorX.c:$(n)' spec='kernel.BactrianUpDownOperator' scaleFactor="0.75" weight="3">
					<up idref="clockRate.c:$(n)"/>
					<down idref="Tree.t:$(n)"/>
				</operator>
    	    </operator>

        	<operator id="proportionInvariantScaler.s:$(n)" spec="beast.base.evolution.operator.AdaptableOperatorSampler" weight="0.05">
                <parameter idref="proportionInvariant.s:$(n)"/>
            	<operator idref="AVMNOperator.$(n)"/>
            	<operator id='proportionInvariantScalerX.s:$(n)' spec='kernel.BactrianScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@proportionInvariant.s:$(n)"/>
        	</operator>

        	<operator id="mutationRateScaler.s:$(n)" spec="beast.base.evolution.operator.AdaptableOperatorSampler" weight="0.05">
                <parameter idref="mutationRate.s:$(n)"/>
            	<operator idref="AVMNOperator.$(n)"/>
	            <operator id='mutationRateScalerX.s:$(n)' spec='kernel.BactrianScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@mutationRate.s:$(n)"/>
        	</operator>

        	<operator id="gammaShapeScaler.s:$(n)" spec="beast.base.evolution.operator.AdaptableOperatorSampler" weight="0.05">
                <parameter idref="gammaShape.s:$(n)"/>
            	<operator idref="AVMNOperator.$(n)"/>
	            <operator id='gammaShapeScalerX.s:$(n)' spec='kernel.BactrianScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@gammaShape.s:$(n)"/>
        	</operator>

@walterxie walterxie added the critical change the bug fix or new feature will significant change the code label Sep 4, 2024
walterxie added a commit that referenced this issue Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
critical change the bug fix or new feature will significant change the code enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant