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

create_beast2_input_file() ignores tipdates_filename argument #108

Open
WJH58 opened this issue Jan 4, 2025 · 12 comments
Open

create_beast2_input_file() ignores tipdates_filename argument #108

WJH58 opened this issue Jan 4, 2025 · 12 comments

Comments

@WJH58
Copy link

WJH58 commented Jan 4, 2025

Describe the bug
Whatever tipdates filename I specify or even when the tipdates file does not exist, create_beast2_input_file() keeps running smoothly and generate a xml file that does not contain any tip dates information.

To Reproduce

## generate beast2 input xml file with tip dates 
create_beast2_input_file(
    fasta_filename,
    output_filename,
    tipdates_filename = "temp_date.txt",
    clock_model = create_rln_clock_model(),
    site_model = create_gtr_site_model(),
    mcmc = create_mcmc(),
    tree_prior = create_cbs_tree_prior(),
    beauti_options = create_beauti_options_v2_6()
)
run_beast2(
  input_filename = output_filename,
  output_state_filename = create_temp_state_filename(),
  use_beagle = TRUE
)

## treeannotator
cmd <- glue("treeannotator -burnin 1000 -heights mean test.trees test.nex")
system(cmd)

## ggtree plot time-scaled tree
tree <- read.beast('test.nex')
ggtree(tree, mrsd = "2013-01-01") + theme_tree2()

Expected behavior

  1. I hope when my tip dates file format is not accepted or when the file path does not exist, the function create_beast2_input_file() would report error and stop.
  2. I hope the output xml file would contain tip dates value. Otherwise run_beast2() does not produce time-scaled trees and ggtree does not plot correct ladder-like time-scaled tree.

Screenshots
image

My files if you would like to test

## This is my temp_date.txt. The dates are written in decimal numeric format. 
##Apart from decimal dates, I tried "m%-d%-Y%" in the 2nd column as well but create_beast2_input_file() simply ignores the tipdates_filename argument.

A/Goose/Guangdong/1/1996_H5N1_EPI_ISL_1254_0	1996.5
A/Environment/Hong_Kong/437-4/1999_H5N1_EPI_ISL_1459_0	1999.5
A/Environment/Hong_Kong/437-6/1999_H5N1_EPI_ISL_1460_0	1999.5
A/Environment/Hong_Kong/437-8/1999_H5N1_EPI_ISL_1461_0	1999.5
A/Environment/Hong_Kong/437-10/1999_H5N1_EPI_ISL_1462_0	1999.5
A/goose/Guangdong/3/1997_H5N1_EPI_ISL_1909_0	1997.5
A/chicken/Hubei/wh/1997_H5N1_EPI_ISL_68662_0	1997.5
A/chicken/Hubei/wj/1997_H5N1_EPI_ISL_68664_0	1997.5
A/chicken/Hubei/wl/1997_H5N1_EPI_ISL_68666_0	1997.5
A/duck/Guangxi/07/1999_H5N1_EPI_ISL_3895_0	1999.5
A/goose/Guangdong/1/1996-01-01_H5N1_EPI_ISL_17767104_0	1996

## This is my fasta file.
>A/Goose/Guangdong/1/1996_H5N1_EPI_ISL_1254_0
ATGGAGAAAATAGTGCTTCTTCTTGCAATAGTCAGTCTTGTCAAAAGTGATCAGATTTGCATTGGTTACCATGCAAACAA
CTCGACAGAGCAGGTTGACACAATAATGGAAAAGAACGTTACTGTTACACATGCCCAAGACATACTGGAAAAGACACACA
ATGGGAAGCTCTGCGATCTAAATGGAGTGAAGCCTCTCATTTTGAGAGATTGTAGTGTAGCTGGATGGCTCCTCGGAAAC
CCTATGTGTGACGAATTCATCAATGTGCCGGAATGGTCTTACATAGTGGAGAAGGCCAGTCCAGCCAATGACCTCTGTTA
CCCAGGGGATTTCAACGACTATGAAGAACTGAAACACCTATTGAGCAGAACAAACCATTTTGAGAAAATTCAGATCATCC
CCAAAAGTTCTTGGTCCAATCATGATGCCTCATCAGGGGTGAGCTCAGCA---TGTCCATACCATGGGAGGTCCTCCTTT
TTCAGAAATGTGGTATGGCTTATCAAAAAGAACAGTGCATACCCAACAATAAAGAGGAGCTACAATAATACCAACCAAGA
AGATCTTTTAGTACTGTGGGGGATTCACCATCCTAATGATGCGGCAGAGCAGACAAAGCTCTATCAAAACCCAACCACTT
ACATTTCCGTTGGAACATCAACACTGAACCAGAGATTGGTTCCAGAAATAGCTACTAGACCCAAAGTAAACGGGCAAAGT
GGAAGAATGGAGTTCTTCTGGACAATTTTAAAGCCGAATGATGCCATCAATTTCGAGAGTAATGGAAATTTCATTGCTCC
AGAATATGCATACAAAATTGTCAAGAAAGGGGACTCAGCAATTATGAAAAGTGAATTGGAATATGGTAACTGCAACACCA
AGTGTCAAACTCCAATGGGGGCGATAAACTCTAGTATGCCATTCCACAACATACACCCCCTCACCATCGGGGAATGCCCC
AAATATGTGAAATCAAACAGATTAGTCCTTGCGACTGGACTCAGAAATACCCCTCAGAGAGAGAGA---------AGAAG
AAAAAAGAGAGGACTATTTGGAGCTATAGCAGGTTTTATAGAGGGAGGATGGCAGGGAATGGTAGATGGTTGGTATGGGT
ACCACCATAGCAATGAGCAGGGGAGTGGATACGCTGCAGACAAAGAATCCACTCAAAAGGCAATAGATGGAGTCACCAAT
AAGGTCAACTCGATCATTGACAAAATGAACACTCAGTTTGAGGCCGTTGGAAGGGAATTTAATAACTTGGAAAGGAGGAT
AGAGAATTTAAACAAGCAGATGGAAGACGGATTCCTAGATGTCTGGACTTATAATGCTGAACTTCTGGTTCTCATGGAAA
ATGAGAGAACTCTAGACTTTCATGACTCAAATGTCAAGAACCTTTATGACAAGGTCCGACTACAGCTTAGGGATAATGCA
AAGGAGCTGGGTAATGGTTGTTTCGAGTTCTATCACAAATGTGATAATGAATGTATGGAAAGTGTAAAAAACGGAACGTA
TGACTACCCGCAGTATTCAGAAGAAGCAAGACTAAACAGAGAGGAAATAAGTGGAGTAAAATTGGAATCAATGGGAACTT
ACCAAATACTGTCAATTTATTCAACAGTGGCGAGTTCCCTAGCACTGGCAATCATGGTAGCTGGT---CTATCTTTATGG
ATGTGCTCCAATGGATCGTTACAATGCAGAATTTGCATT
>A/goose/Guangdong/1/1996-01-01_H5N1_EPI_ISL_17767104_0
ATGGAGAAAATAGTGCTTCTTCTTGCAATAGTCAGTCTTGTCAAAAGTGATCAGATTTGCATTGGTTACCATGCAAACAA
CTCGACAGAGCAGGTTGACACAATAATGGAAAAGAACGTTACTGTTACACATGCCCAAGACATACTGGAAAAGACACACA
ATGGGAAGCTCTGCGATCTAAATGGAGTGAAGCCTCTCATTTTGAGAGATTGTAGTGTAGCTGGATGGCTCCTCGGAAAC
CCTATGTGTGACGAATTCATCAATGTGCCGGAATGGTCTTACATAGTGGAGAAGGCCAGTCCAGCCAATGACCTCTGTTA
CCCAGGGGATTTCAACGACTATGAAGAACTGAAACACCTATTGAGCAGAACAAACCATTTTGAGAAAATTCAGATCATCC
CCAAAAGTTCTTGGTCCAATCATGATGCCTCATCAGGGGTGAGCTCAGCA---TGTCCATACCATGGGAGGTCCTCCTTT
TTCAGAAATGTGGTATGGCTTATCAAAAAGAACAGTGCATACCCAACAATAAAGAGGAGCTACAATAATACCAACCAAGA
AGATCTTTTAGTACTGTGGGGGATTCACCATCCTAATGATGCGGCAGAGCAGACAAAGCTCTATCAAAACCCAACCACTT
ACATTTCCGTTGGAACATCAACACTGAACCAGAGATTGGTTCCAGAAATAGCTACTAGACCCAAAGTAAACGGGCAAAGT
GGAAGAATGGAGTTCTTCTGGACAATTTTAAAGCCGAATGATGCCATCAATTTCGAGAGTAATGGAAATTTCATTGCTCC
AGAATATGCATACAAAATTGTCAAGAAAGGGGACTCAGCAATTATGAAAAGTGAATTGGAATATGGTAACTGCAACACCA
AGTGTCAAACTCCAATGGGGGCGATAAACTCTAGTATGCCATTCCACAACATACACCCCCTCACCATCGGGGAATGCCCC
AAATATGTGAAATCAAACAGATTAGTCCTTGCGACTGGACTCAGAAATACCCCTCAGAGAGAGAGA---------AGAAG
AAAAAAGAGAGGACTATTTGGAGCTATAGCAGGTTTTATAGAGGGAGGATGGCAGGGAATGGTAGATGGTTGGTATGGGT
ACCACCATAGCAATGAGCAGGGGAGTGGATACGCTGCAGACAAAGAATCCACTCAAAAGGCAATAGATGGAGTCACCAAT
AAGGTCAACTCGATCATTGACAAAATGAACACTCAGTTTGAGGCCGTTGGAAGGGAATTTAATAACTTGGAAAGGAGGAT
AGAGAATTTAAACAAGCAGATGGAAGACGGATTCCTAGATGTCTGGACTTATAATGCTGAACTTCTGGTTCTCATGGAAA
ATGAGAGAACTCTAGACTTTCATGACTCAAATGTCAAGAACCTTTATGACAAGGTCCGACTACAGCTTAGGGATAATGCA
AAGGAGCTGGGTAATGGTTGTTTCGAGTTCTATCACAAATGTGATAATGAATGTATGGAAAGTGTAAAAAACGGAACGTA
TGACTACCCGCAGTATTCAGAAGAAGCAAGACTAAACAGAGAGGAAATAAGTGGAGTAAAATTGGAATCAATGGGAACTT
ACCAAATACTGTCAATTTATTCAACAGTGGCGAGTTCCCTAGCACTGGCAATCATGGTAGCTGGT---CTATCTTTATGG
ATGTGCTCCAATGGATCGTTACAATGCAGAATTTGCATT
>A/goose/Guangdong/3/1997_H5N1_EPI_ISL_1909_0
ATGGAGAAAATAGTGCTTCTTCTTGCAATAGTCAGTCTTGTCAAAAGTGATCAGATTTGCATTGGTTACCATGCAAACAA
CTCGACAGAGCAGGTTGACACAATAATGGAAAAGAACGTTACTGTTACACATGCCCAAGACATACTGGAAAAGACACACA
ATGGGAAGCTCTGCGATCTAAATGGAGTGAAGCCTCTCATTTTGAGAGATTGTAGTGTAGCTGGATGGCTCCTCGGAAAC
CCTATGTGTGACGAATTCATCAATGTGCCGGAATGGTCTTACATAGTGGAGAAGGCCAGTCCAGCCAATGACCTCTGTTA
CCCAGGGGATTTCAACGACTATGAAGAACTGAAACACCTATTGAGCAGAACAAACCATTTTGAGAAAATTCAGATCATCC
CCAAAAGTTCTTGGTCCAATCATGATGCCTCATCAGGGGTGAGCTCAGCA---TGTCCATACCATGGGAGGTCCTCCTTT
TTCAGAAATGTGGTATGGCTTATCAAAAAGAACAGTGCATACCCAACAATAAAGAGGAGCTACAATAATACCAACCAAGA
AGATCTTTTAGTACTGTGGGGGATTCACCATCCTAATGATGCGGCAGAGCAGACAAAGCTCTATCAAAACCCAACCACTT
ACATTTCCGTTGGAACATCAACACTGAACCAGAGATTGGTTCCAGAAATAGCTACTAGACCCAAAGTAAACGGGCAAAGT
GGAAGAATGGAGTTCTTCTGGACAATTTTAAAGCCGAATGATGCCATCAATTTCGAGAGTAATGGAAATTTCATTGCTCC
AGAATATGCATACAAAATTGTCAAGAAAGGGGACTCAGCAATTATGAAAAGTGAATTGGAATATGGTAACTGCAACACCA
AGTGTCAAACTCCAATGGGGGCGATAAACTCTAGTATGCCATTCCACAACATACACCCCCTCACCATCGGGGAATGCCCC
AAATATGTGAAATCAAACAGATTAGTCCTTGCGACTGGACTCAGAAATACCCCTCAAAGAGAGAGA---------AGAAG
AAAAAAGAGAGGACTATTTGGAGCTATAGCAGGTTTTATAGAGGGAGGATGGCAGGGAATGGTAGATGGTTGGTATGGGT
ACCGCCATAGCAATGAGCAGGGGAGTGGATACGCTGCAGACAAAGAATCCACCCAAAAGGCAATAGATGGAGTCACCAAT
AAGGTCAACTCGATCATTGACAAAATGAACACTCAGTTTGAGGCCGTTGGAAGGGAATTTAATAACTTGGAAAGGAGGAT
AGAGAATTTAAACAAGCAGATGGAAGACGGACTCCTAGATGTCTGGACTTATAATGCTGAACTTCTGGTTCTCATGGAAA
ATGAGAGAACTCTAGACTTTCATGACTCAAATGTCAAGAACCTTTATGACAAGGTCCGACTACAGCTTAGGGATAATGCA
AAGGAGCTGGGTAATGGTTGTTTCGAGTTCTATCACAAATGTGATAATGAATGTATGGAAAGTGTAAAAAACGGAACGTA
TGACTACCCGCAGTATTCAGAAGAAGCAAGACTAAACAGAGAGGAAATAAGTGGAGTAAAATTGGAATCAATGGGAACTT
ACCAAATACTGTCAATTTATTCAACAGTGGCGAGTTCCCTAGCACTGGCAATCATGGTAGCTGGT---CTATCTTTATGG
ATGTGCTCCAATGGATCGTTACAATGCAGAATTTGCATT
>A/Environment/Hong_Kong/437-4/1999_H5N1_EPI_ISL_1459_0
ATGGAGAAAATAGTGCTTCTTCTTGCAATAGTCAGTCTTGTTAAAAGTGATCAGATTTGCATTGGTTACCATGCAAATAA
CTCGACAGAGCAGGTTGACACAATAATGGAAAAGAACGTTACTGTTACACATGCCCAAGACATACTGGAAAAGACACACA
ACGGGAAGCTCTGCGATCTAGATGGAGTGAAGCCTCTAATTTTGAGAGATTGTAGTGTAGCTGGATGGCTCCTCGGAAAC
CCTATGTGTGACGAATTCATCAATGTGCCGGAATGGTCTTACATAGTGGAGAAGGCCAGTCCAGCCAATGACCTCTGTTA
CCCAGGGGATTTCAACAACTATGAAGAACTGAAACACCTATTGAGCAGAACAAACCATTTTGAGAAAATTCAGATCATCC
CCAAAAGTTCTTGGTCCAATCATGATGCCTCATCAGGGGTGAGCTCAGCA---TGTCCATACCATGGGAAGTCCTCCTTT
TTCAGAAATGTGGTATGGCTTATCAAAAAGAACAGTGCATACCCAACAATAAAGAGGAGCTACAATAATACCAACCAAGA
AGATCTTTTGGTACTGTGGGGGATTCACCATCCTAATGATGCGGCAGAGCAGACAAAGCTCTATCAAAACCCAACCACCT
ATATTTCCGTTGGAACATCAACACTGAACCAGAGATTGGTTCCAGAAATAGCTACTAGACCCAAAGTAAACGGGCAAAGT
GGAAGAATGGAGTTCTTCTGGACAATTTTAAAGCCGAATGATGCCATCAATTTCGAGAGTAATGGAAATTTCATTGCTCC
AGAATATGCATACAAAATTGTCAAGAAAGGGGACTCAGCAATTATGAAAAGTGAATTGGAATATGGTAACTGCAACACCA
AGTGTCAAACTCCAATGGGGGCGATAAACTCTAGTATGCCATTCCACAACATACACCCTCTCACCATCGGGGAATGCCCC
AAATATGTGAAATCAAACAGATTAGTCCTTGCGACTGGACTCAGAAATACCCCTCAAAGAGAGAGA---------AGAAG
AAAAAAGAGAGGACTATTTGGGGCTATAGCAGGTTTTATAGAGGGAGGATGGCAGGGAATGGTAGATGGTTGGTATGGGT
ACCACCATAGCAATGAGCAGGGGAGTGGATACGCTGCAGACAAAGAATCCACTCAAAAGGCAATAGATGGAGTCACCAAT
AAGGTCAACTCGATCATTGACAAAATGAACACTCAGTTTGAGGCCGTTGGAAGGGAATTTAATAACTTAGAAAGGAGGAT
AGAAAATTTGAACAAGAAGATGGAAGACGGATTCCTAGATGTCTGGACTTATAATGCTGAACTTCTGGTTCTCATGGAAA
ATGAGAGAACTCTAGACTTTCATGACTCAAATGCCAAGAACCTTTACGACAAGGTCCGACTACAGCTTAGGGATAATGCA
AAGGAGCTGGGTAATGGTTGTTTCGAGTTCTATCACAAATGTGATAATGAATGTATGGAAAGTGTAAAAAACGGAACGTA
TGACTACCCGCAGTATTCAGAAGAAGCAAGACTAAACAGAGAGGAAATAAGTGGAGTAAAATTGGAATCAATGGGAACTT
ACCAAATACTGTCAATTTATTCAACAGTGGCGAGTTCCCTAGCACTGGCAATCATGGTAGCTGGT---CTATCTTTATGG
ATGTGCTCCAATGGATCGTTACAATGCAGAATTTGCATT
>A/Environment/Hong_Kong/437-10/1999_H5N1_EPI_ISL_1462_0
ATGGAGAAAATAGTGCTTCTTCTTGCAATAGTCAGTCTTGTTAAAAGTGATCAGATTTGCATTGGTTACCATGCAAATAA
CTCGACAGAGCAGGTTGACACAATAATGGAAAAGAACGTTACTGTTACACATGCCCAAGACATACTGGAAAAGACACACA
ACGGGAAGCTCTGCGATCTAGATGGAGTGAAGCCTCTAATTTTGAGAGATTGTAGTGTAGCTGGATGGCTCCTCGGAAAC
CCTATGTGTGACGAATTCATCAATGTGCCGGAATGGTCTTACATAGTGGAGAAGGCCAGTCCAGCCAATGACCTCTGTTA
CCCAGGGGATTTCAACAACTATGAAGAACTGAAACACCTATTGAGCAGAACAAACCATTTTGAGAAAATTCAGATCATCC
CCAAAAGTTCTTGGTCCAATCATGATGCCTCATCAGGGGTGAGCTCAGCA---TGTCCATACCATGGGAAGTCCTCCTTT
TTCAGAAATGTGGTATGGCTTACCAAAAAGAACAGTGCATACCCAACAATAAAGAGGAGCTACAATAATACCAACCAAGA
AGATCTTTTGGTACTGTGGGGGATTCACCATCCTAATGATGCGGCAGAGCAGACAAAGCTCTATCAAAACCCAACCACCT
ATATTTCCGTTGGAACATCAACACTGAACCAGAGATTGGTTCCAGAAATAGCTACTAGACCCAAAGTAAACGGGCAAAGT
GGAAGAATGGAGTTCTTCTGGACAATTTTAAAGCCGAATGATGCCATCAATTTCGAGAGTAATGGAAATTTCATTGCTCC
AGAATATGCATACAAAATTGTCAAGAAAGGGGACTCAGCAATTATGAAAAGTGAATTGGAATATGGTAACTGCAACACCA
AGTGTCAAACTCCAATGGGGGCGATAAACTCTAGTATGCCATTCCACAACATACACCCTCTCACCATCGGGGAATGCCCC
AAATATGTGAAATCAAACAGATTAGTCCTTGCGACTGGACTCAGAAATACCCCTCAAAGAGAGAGA---------AGAAG
AAAAAAGAGAGGACTATTTGGGGCTATAGCAGGTTTTATAGAGGGAGGATGGCAGGGAATGGTAGATGGTTGGTATGGGT
ACCACCATAGCAATGAGCAGGGGAGTGGATACGCTGCAGACAAAGAATCCACTCAAAAGGCAATAGATGGAGTCACCAAT
AAGGTCAACTCGATCATTGACAAAATGAACACTCAGTTTGAGGCCGTTGGAAGGGAATTTAATAACTTAGAAAGGAGGAT
AGAAAATTTGAACAAGAAGATGGAAGACGGATTCCTAGATGTCTGGACTTATAATGCTGAACTTCTGGTTCTCATGGAAA
ATGAGAGAACTCTAGACTTTCATGACTCAAATGTCAAGAACCTTTACGACAAGGTCCGACTACAGCTTAGGGATAATGCA
AAGGAGCTGGGTAATGGTTGTTTCGAGTTCTATCACAAATGTGATAATGAATGTATGGAAAGTGTAAAAAACGGAACGTA
TGACTACCCGCAGTATTCAGAAGAAGCAAGACTAAACAGAGAGGAAATAAGTGGAGTAAAATTGGAATCAATGGGAACTT
ACCAAATACTGTCAATTTATTCAACAGTGGCGAGTTCCCTAGCACTGGCAATCATGGTAGCTGGT---CTATCTTTATGG
ATGTGCTCCAATGGATCGTTACAATGCAGAATTTGCATT
>A/Environment/Hong_Kong/437-6/1999_H5N1_EPI_ISL_1460_0
ATGGAGAAAATAGTGCTTCTTCTTGCAATAGTCAGTCTTGTTAAAAGTGATCAGATTTGCATTGGTTACCATGCAAACAA
CTCGACAGAGCAGGTTGACACAATAATGGAAAAGAACGTTACTGTTACACATGCCCAAGACATACTGGAAAAGACACACA
ACGGGAAGCTCTGCGATCTAGATGGAGTGAAGCCTCTAATTTTGAGAGATTGTAGTGTAGCTGGATGGCTCCTCGGAAAC
CCTATGTGTGACGAATTCATCAATGTGCCGGAATGGTCTTACATAGTGGAGAAGGCCAGTCCAGCCAATGACCTCTGTTA
CCCAGGGGATTTCAACAACTATGAAGAACTGAAACACCTATTGAGCAGAACAAACCATTTTGAGAAAATTCAGATCATCC
CCAAAAGTTCTTGGTCCAATCATGATGCCTCATCAGGGGTGAGCTCAGCA---TGTCCATACCATGGGAAGTCCTCCTTT
TTCAGAAATGTGGTATGGCTTATCAAAAAGAACAGTGCATACCCAACAATAAAGAGGAGCTACAATAATACCAACCAAGA
AGATCTTTTGGTACTGTGGGGGATTCACCATCCTAATGATGCGGCAGAGCAGACAAAGCTCTATCAAAACCCAACCACCT
ATATTTCCGTTGGAACATCAACACTGAACCAGAGATTGGTTCCAGAAATAGCTACTAGACCCAAAGTAAACGGGCAAAGT
GGAAGAATGGAGTTCTTCTGGACAATTTTAAAGCCGAATGATGCCATCAATTTCGAGAGTAATGGAAATTTCATTGCTCC
AGAATATGCATACAAAATTGTCAAGAAAGGGGACTCAGCAATTATGAAAAGTGAATTGGAATATGGTAACTGCAACACCA
AGTGTCAAACTCCAATGGGGGCGATAAACTCTAGTATGCCATTCCACAACATACACCCTCTCACCATCGGGGAATGCCCC
AAATATGTGAAATCAAACAGATTAGTCCTTGCGACTGGACTCAGAAATACCCCTCAAAGAGAGAGA---------AGAAG
AAAAAAGAGAGGACTATTTGGAGCTATAGCAGGTTTTATAGAGGGAGGATGGCAGGGAATGGTAGATGGTTGGTATGGGT
ACCACCATAGCAATGAGCAGGGGAGTGGATACGCTGCAGACAAAGAATCCACTCAAAAGGCAATAGATGGAGTCACCAAT
AAGGTCAACTCGATCATTGACAAAATGAACACTCAGTTTGAGGCCGTTGGAAGGGAATTTAATAACTTAGAAAGGAGGAT
AGAAAATTTAAACAAGAAGATGGAAGACGGATTCCTAGATGTCTGGACTTATAATGCTGAACTTCTGGTTCTCATGGAAA
ATGAGAGAACTCTAGACTTTCATGACTCAAATGTCAAGAACCTTTACGACAAGGTCCGACTACAGCTTAGGGATAATGCA
AAGGAGCTGGGTAATGGTTGTTTCGAGTTCTATCACAAATGTGATAATGAATGTATGGAAAGTGTAAAAAACGGAACGTA
TGACTACCCGCAGTATTCAGAAGAAGCAAGACTAAACAGAGAGGAAATAAGTGGAGTAAAATTGGAATCAATGGGAACTT
ACCAAATACTGTCAATTTATTCAGCAGTGGCGAGTTCCCTAGCACTGGCAATCATGGTAGCTGGT---CTATCTTTATGG
ATGTGCTCCAATGGATCGTTACAATGCAGAATTTGCATT
>A/Environment/Hong_Kong/437-8/1999_H5N1_EPI_ISL_1461_0
ATGGAGAAAATAGTGCTTCTTCTTGCAATAGTCAGTCTTGTTAAAAGTGATCAGATTTGCATTGGTTACCATGCAAATAA
CTCGACAGAGCAGGTTGACACAATAATGGAAAAGAACGTTACTGTTACACATGCCCAAGACATACTGGAAAAGACACACA
ACGGGAAGCTCTGCGATCTAGATGGAGTGAAGCCTCTAATTTTGAGAGATTGTAGTGTAGCTGGATGGCTCCTCGGAAAC
CCTATGTGTGACGAATTCATCAATGTGCCGGAATGGTCTTACATAGTGGAGAAGGCCAGTCCAGCCAATGACCTCTGTTA
TCCAGGGGATTTCAACAACTATGAAGAACTGAAACACCTATTGAGCAGAACAAACCATTTTGAGAAAATTCAGATCATCC
CCAAAAGTTCTTGGTCCAATCATGATGCCTCATCAGGGGTGAGCTCAGCA---TGTCCATACCATGGGAAGTCCTCCTTT
TTCAGAAATGTGGTATGGCTTATCAAAAAGAACAGTGCATACCCAACAATAAAGAGGAGCTACAATAATACCAACCAAGA
AGATCTTTTGGTACTGTGGGGGATTCACCATCCTAATGATGCGGCAGAGCAGACAAAGCTCTATCAAAACCCAACCACCT
ATATTTCCGTTGGAACATCAACACTGAACCAGAGATTGGTTCCAGAAATAGCTACTAGACCCAAAGTGAACGGGCAAAGT
GGAAGAATGGAGTTCTTCTGGACAATTTTAAAGCCGAATGATGCCATCAATTTCGAGAGTAATGGAAATTTCATTGCTCC
AGAATATGCATACAAAATTGTCAAGAAAGGGGACTCAGCAATTATGAAAAGTGAATTGGAATATGGTAACTGCAACACCA
AGTGTCAAACTCCAATGGGGGCGATAAACTCTAGTATGCCATTCCACAACATACACCCTCTCACCATCGGGGAATGCCCC
AAATATGTGGAATCAAACAGATTAGTCCTTGCGACTGGACTCAGAAATACCCCTCAAAGAGAGAGA---------AGAAG
AAAAAAGAGAGGACTATTTGGGGCTATAGCAGGTTTTATAGAGGGAGGATGGCAGGGAATGGTAGATGGTTGGTATGGGT
ACCACCATAGCAATGAGCAGGGGAGTGGATACGCTGCAGACAAAGAATCCACTCAAAAGGCAATAGATGGAGTCACCAAT
AAGGTCAACTCGATCATTGACAAAATGAACACTCAGTTTGAGGCCGTTGGAAGGGAATTTAATAACTTAGAAAGGAGGAT
AGAAAATTTGAACAAGAAGATGGAAGACGGATTCCTAGATGTCTGGACTTATAATGCTGAACTTCTGGTTCTCATGGAAA
ATGAGAGAACTCTAGACTTTCATGACTCAAATGTCAAGAACCTTTACGACAAGGTCCGACTACAGCTTAGGGATAATGCA
AAGGAGCTGGGTAATGGTTGTTTCGAGTTCTATCACAAATGTGATAATGAATGTATGGAAAGTGTAAAAAACGGAACGTA
TGACTACCCGGAGTATTCAGAAGAAGCAAGACTAAACAGAGAGGAAATAAGTGGAGTAAAATTGGAATCAATGGGAACTT
ACCAAATACTGTCAATTTATTCAACAGTGGCGAGTTCCCTAGCACTGGCAATCATGGTAGCTGGT---CTATCTTTATGG
ATGTGCTCCAATGGATCGTTACAATGCAGAATTTGCATT
>A/chicken/Hubei/wl/1997_H5N1_EPI_ISL_68666_0
ATGGAGAAAATAGTGCTTCTTCTTGCAATAGTCAGTCTTGTTAAAAGTGATCAGATTTGCATTGGTTACCATGCAAACAA
CTCGACAGAGCAGGTTGACACAATAATGGAAAAGAACGTTACTGTTACACATGCCCAAGACATACTGGAAAAGAAACACA
ACGGGAAGCTCTGCGATCTAGATGGAGTGAAACCTCTAATTTTAAGAGATTGTAGTGTAGCTGGATGGCTCCTCGGAAAC
CCAATGTGTGACGAATTCATCAATGTGCCGGAATGGTCTTACATAGTAGAGAAGGCCAGTCCAGCCAATGACCTCTGTTA
CCCAGGGGATTTCAACGACTATGAAGAACTGAAACACCTATTGAGCAGAATAAACCATTTTGAGAAAATTCAGATCATCC
CCAAAAGTTCTTGGTCCAATCATGAAGCCTCATCAGGGGTGAGCGCAGCA---TGTCCATACCATGGGAGGTCCTCCTTT
TTCAGAAATGTGGTATGGCTTATCAAAAAGAACAGTACATACCCAACAATAAAGAGGAGCTACAATAATACCAACCAAGA
AGATCTTTTGGTACTGTGGGGGATTCACCATCCTAATGATGCGGCAGAGCAGACAAAGCTCTATCAAAACCCAACCACCT
ACATTTCCGTTGGAACATCAACACTGAACCAGAGATTGGTTCCAGAAATAGCTACTAGACCCAAAGTAAACGGGCAAAGT
GGAAGAATGGAGTTCTTCTGGACAATTTTAAAGCCGAATGATGCCATCAATTTCGAAAGTAATGGAAATTTCATTGCTCC
AGAATATGCATACAAAATTGTCAAGAAAGGGGACTCAGCAATTATGAAAAGTGAATTGGAATATGGTAACTGCAACACCA
AGTGTCAAACTCCAATGGGGGCGATAAACTCTAGTATGCCATTCCACAACATACACCCCCTCACCATCGGGGAATGCCCC
AAATATGTGAAATCAAACAGATTAGTCCTTGCGACTGGACTCAGAAATACCCCTCAAAGAGAGAGA---------AGAAG
AAAAAAGCGAGGACTATTTGGAGCTATAGCAGGTTTTATAGAGGGAGGATGGCAGGGAATGGTAGATGGTTGGTATGGGT
ACCACCATAGCAATGAGCAGGGGAGCGGATACGCTGCAGACAAAGAATCCACTCAAAAGGCAATAGATGGAGTCACCAAT
AAGGTCAACTCGATCATTGACAAAATGAACACTCAGTTTGAGGCCGTTGGAAGGGAATTTAATAACTTGGAAAGGAGGAT
AGAGAGTTTAAACAAGAAGATGGAAGACGGATTCCTAGATGTCTGGACTTATAATGCTGAACTTCTGGTTCTCATGGAAA
ATGAGAGAACTCTAGACTTTCATGACTCAAATGTCAAGAACCTTTACGACAAGGTCCGACTACAGCTTAGGGATAATGCA
AAGGAGCTGGGTAATGGTTGTTTCGAGTTCTATCACAAATGTGATAATGAATGTATGGAAAGTGTAAAAAACGGAACGTA
TGACTACCCGCAGTATTCAGAAGAAGCAAGACTAAACAGAGAGGAAATAAGTGGAGTAAAATTGGAATCAATGGGAACTT
ACCAAATACTGTCAATTTATTCAACAGTGGCGAGTTCCCTAGCACTGGCAATCATGGTAGCTGGT---CTATCTTTATGG
ATGTGCTCCAATGGATCGTTACAATGCAGAATTTGCATT
>A/chicken/Hubei/wj/1997_H5N1_EPI_ISL_68664_0
ATGGAGAAAATAGTGCTTCTTCTTGCAATAGTCAGTCTTGTCAAAAGTGATCAGATTTGCATTGGTTACCATGCAAACAA
CTCGACAGAGCAGGTTGACACAATAATGGAAAAGAACGTTACTGTTACACATGCCCAAGACATACTGGAAAAGACACACA
ACGGGAAGCTCTGCGATCTAAATGGAGTGAAGCCTCTCATTTTGAGAGATTGTAGTGTAGCTGGATGGCTCCTCGGAAAC
CCTATGTGTGACGAATTCACCAATGTGCCGGAATGGTCTTACATAGTGGAGAAGGCCAGTCCAGCCAATGACCTCTGTTA
CCCAGGGGATTTCAACGACTATGAAGAACTGAAACACCTATTGAGCAGAATAAACCATTTTGAGAAAATTCAGATCATCC
CCAAAAGTTCTTGGTCCAATCATGATGCCTCATCAGGGGTGAGCTCAGCA---TGTCCATACCATGGGAGGTCCTCCTTT
TTCAGAAATGTGGTATGGCTTATCAAAAAGAACAGTACATACCCAACAATAAAGAGGAGCTACAATAATACCAACCAAGA
AGATCTTTTGGTACTGTGGGGGATTCACCATCCTAATGATGCGGCAGAGCAGACAAAGCTCTATCAAAACCCAACCACCT
ATATTTCCGTTGGGACATCAACACTGAACCAGAGATTGGTTCCAGAAATAGCTACTAGATCCAAAGTAAACGGGCAAAGT
GGAAGAATGGAGTTCTTCTGGACAATTTTAAAGCCGAATGATGCCATCAATTTCGAAAGTAATGGAAATTTCATTGCTCC
AGAATATGCATACAAAATTGTCAAGAAAGGGGACTCAGCAATTATGAAAAGTGAATTGGAATATGGTAACTGCAACACCA
AGTGTCAAACTCCAATGGGGGCGATAAACTCTAGTATGCCATTCCACAACATACACCCCCTCACCATCGGAGAATGCCCC
AAATATGTGAAATCAAACAGATTAGTCCTTGCGACTGGACTCAGAAATACCCCTCAAAGAGAGAGA---------AGAAG
AAAAAAGAGAGGACTATTTGGAGCTATAGCAGGTTTTATAGAGGGAGGATGGCAGGGAATGGTAGATGGTTGGTATGGGT
ACCACCATAGCAATGAGCAGGGGAGTGGATACGCTGCAGATAGAGAATCCACTCAAAAGGCAATAGATGGAGTCACCAAT
AAGGTCAACTCGATCATTGACAAAATGAACACTCAGTTTGAGGCCGTTGGAAGGGAATTTAATAACTTGGAAAGGAGGAT
AGAGAGTTTAAACAAGAAGATGGAAGACGGATTCCTAGATGTCTGGACTTATAATGCTGAACTTCTGGTTCTCATGGAAA
ATGAGAGAACTCTAGACTTTCATGACTCAAATGTCAAGAACCTTTACGACAAGGTCCGACTACAGCTTAGGGATAATGCA
AAGGAGCTGGGTAATGGTTGTTTCGAGTTCTATCACAAATGTGATAATGAATGTATGGAAAGTGTAAAAAACGGAACGTA
TGACTACCCGCAGTATTCAGAAGAAGCAAGACTAAACAGAGAGGAAATAAGTGGAGTAAAATTGGAATCAATGGGAACTT
ACCAAATACTGTCAATTTATTCAACAGTGGCGAGTTCCCTAGTACTGGCAATCATGGTAGCTGGT---CTATCTTTATGG
ATGTGCTCCAATGGATCGTTACAATGCAGAATTTGCATT
>A/chicken/Hubei/wh/1997_H5N1_EPI_ISL_68662_0
ATGGAGAAAATAGTGCTTCTTCTTGCAATAGTCAGTCTTGTTAAAAGTGATCAGATTTGCATTGGTTACCATGCAAACAA
CTCGACAGAGCAGGTTGACACAATAATGGAAAAGAACGTTACTGTTACACATGCCCAAGACATACTGGAAAGGACACACA
ACGGGAAGCTCTGCGATCTAGATGGAGTAAAGCCTCTCATTTTGAGAGATTGTAGTGTAGCTGGATGGCTCCTCGGAAAC
CCTATGTGTGACGAATTCACCAATGTGCCGGAATGGTCTTACATAGTGGAGAAGGCCAGTCCAGCCAATGACCTCTGTTA
CCCAGGGGATTTCAACGACTATGAAGAACTGAAACACCTATTGAGCAGAATAAACCATTTTGAGAAAATTCAGATCATCC
CCAAAAGTTCTTGGTCCGATCATGATGCCTCATCAGGGGTGAGCTCAGCA---TGTCCATACCATGGGAGGTCCTCCTTT
TTCAGAAATGTGGTATGGCTTATCAAAAAGAACAGTACATACCCCACAATAAAGAGGAGCTACAATAATACCAACCAAGA
AGATCTTTTGGTACTGTGGGGGATTCACCATCCTAATGATGCGGCAGAGCAGACAAAGCTCTATCAAAACCCAACCACCT
ACATTTCCGTTGGAACATCAACACTGAACCAGAGATTGGTTCCAGAAATAGCTACTAGACCCAAAGTAAACGGGCAAAGT
GGAAGAATGGAGTTCTTCTGGACATTTTTAAAGCCGAATGATGCCATCAATTTCGAAAGTAATGGAAATTTCATTGCTCC
AGAATATGCATACAAAATTGTCAAGAAAGGGGACTCAGCAATTATGAAAAGTGAATTGGAATATGGTAACTGCAACACCA
AGTGTCAAACTCCAATGGGGGCGATAAACTCTAGTATGCCATTCCACAACATACACCCCCTCACCATCGGGGAATGCCCC
AAATATGTGAAATCAAACAGATTAGTCCTTGCGACTGGACTCAGAAATACCCCTCAAAGAGAGAGA---------AGAAG
AAAAAAGCGAGGACTATTTGGAGCTATAGCAGGTTTTATAGAGGGAGGATGGCAGGGAATGGTAGATGGTTGGTATGGGT
ACCACCATAGCAATGAGCAGGGGAGCGGATACGCTGCAGACAAAGAATCCACTCCAAAGGCAATAGATGGAGTCACCAAT
AAGGTCAACTCGATCATTGACAAAATGAACACTCAGTTTGAGGCCGTTGGAAGGGAATTTAATAACTTGGAAAGGAGGAT
AGAGAGTTTAAACAAGAAGATGGAAGACGGATTCCTAGATGTCTGGACTTATAATGCTGAACTTCTGGTTCTCATGGAAA
ATGAGAGAACTCTAGACTTTCATGACTCAAATGTCAAGAACCTTTACGACAAGGTCCGACTACAGCTTAGGGATAATGCA
AAGGAGCTGGGTAATGGTTGTTTCGAGTTCTATCACAAATGTGATAATGAATGTATGGAAAGTGTAAGAAACGGAACGTA
TGACTACCCGCAGTATTCAGAAGAAGCAAGACTAAACAGAGAGGAAATAAGTGGAGTAAAATTGGAATCAATGGGAACTT
ACCAAATACTGTCAATTTATTCAACAGTGGCGAGTTCCCTAGCACTGGCAATCATGGTAGCTGGT---CTATCTTTATGG
ATGTGCTCCAATGGATCGTTACAATGCAGAATTTGCATT
>A/duck/Guangxi/07/1999_H5N1_EPI_ISL_3895_0
ATGGAGAAAATAGTGCTTCTTCTTGCAATAGTCAGTCTTGTTGAAAGTGATCAAATTTGCATTGGTTACCATGCAAACAA
CTCGACAGAGCAGGTTGACACAATAATGGAAAAGAACGTTACTGTTACACATGCCCAAGACATACTGGAAAAGACACACA
ACGGGAAGCTCTGCAATCTAAATGGAGTGAAGCCTCTCATTTTGAGAGATTGTAGTGTAGCTGGATGGCTCCTCGGAAAT
CCTATGTGTGACGAATTCATCAATGTGCCGGAATGGTCTTACATAGTGGAGAAGGCTAGCCCAGCCAATGACCTCTGTTA
CCCAGGGGATCTCAATGACTATGAAGAACTGAAACACCTATTGAGCAGCACAAACCATTTTGAGAAAATTCAGATCATCC
CCAAAAATTCTTGGTCCAATCATGATGCCTCATCAGGGGTGAGCTCAGCA---TGTCCATACCATGGGAGGTCCTCCTTT
TTCAGAAATGTGGTATGGCTTACCAAAAAGAACAGTGCATACCCAACAATAAAGAGGAGCTACAATAATACCAACCCAGA
AGATCTTTTGATACTGTGGGGGATTCACCATCCTAATGATGCAGCAGAGCAGACAAAGCTCTATCAAAACCCAACCACCT
ACGTTTCCGTTGGAACATCAACACTGAACCAGAGATTGGTTCCAGAAATAGCTACTAGACCCAAAGTAAACGGGCAAAGT
GGAAGAATGGAGTTCTTCTGGACAATTTTAAAGCCGAATGATGCCATCAATTTCGAGAGTAATGGAAATTTCATTGCTCC
AGAATATGCATACAAAATTGTCAAGAAAGGGGACTCAGCAATTATGAAAAGTGAATTGGAATATAGTAACTGCAACACCA
AGTGTCAAACTCCAATAGGGGCGATAAACTCTAGTATGCCATTCCACAACATACATCCTCTCACCATCGGGGAATGCCCC
AAATATGTGAAATCAAACAGATTAGTCCTTGCGACTGGACTCAGAAATACCCCTCAAAGAGAGAAA---------AGAAG
AAAAAAGAGAGGGCTATTTGGAGCTATAGCAGGTTTTATAGAGGGAGGATGGCAGGGAATGGTAGATGGTTGGTATGGGT
ACCACCATAGCAATGAGCAGGGGAGTGGATACGCTGCAGACAAAGAATCCACTCAAAAGGCAATAGATGGAGTCACCAAT
AAGGTCAATTCGATCATTGACAAAATGAACACTCAGTTTGAGGCCGTTGGAAGGGAATTTAATAACTTGGAAAGGAGAAT
AGAGAATTTAAACAAGAAGATGGAAGACGGATTCCTAGATGTCTGGACTTATAATGCTGAACTTCTGGTTCTCATGGAGA
ATGAGAGAACTCTATACTTTCATGACTCAAATGTCAAGGACCTTTACGACAAGGTCCGACTACAGCTTAGGGATAATGCA
AAGGAGCTGGGTAATGGTTGTTTCGAGTTCTATCACAAATGTGATAATGAATGTATGGAAAGTGTAAGAAACGGAACGTA
TGACTATCCGCAGTATTCAGAAGAAGCAAGGCTAAACAGAGAGGAAATAAGTGGAGTAAAATTGGAATCAATGGGAACTT
ACCAAATACTGTCAATTTATTCAACAGTGGCGAGTTCCCTAGCACTGGCAATCATGGTAGCTGGT---CTATCTTTATGG
ATGTGCTCCAATGGATCATTACAATGCAGAATTTGCATT
@richelbilderbeek
Copy link
Member

Thanks for this bug report! I will take a look now ...

@richelbilderbeek
Copy link
Member

richelbilderbeek commented Jan 4, 2025

Note to self:

Indeed, creating the BEAST2 input file works perfect:

test_that("use", {
  expect_true(file.exists(get_beautier_path("babette_issue_108_tipdates.txt")))
  expect_true(file.exists(get_beautier_path("babette_issue_108.fasta")))
  fasta_filename <- get_beautier_path("babette_issue_108.fasta")
  output_filename <- get_beautier_tempfilename()
  tipdates_filename <- get_beautier_tempfilename(pattern = "absent_")
  create_beast2_input_file(
    fasta_filename,
    output_filename,
    tipdates_filename = tipdates_filename,
    clock_model = create_rln_clock_model(),
    site_model = create_gtr_site_model(),
    mcmc = create_mcmc(),
    tree_prior = create_cbs_tree_prior(),
    beauti_options = create_beauti_options_v2_6()
  )
  expect_true(file.exists(output_filename))
  expect_false(file.exists(tipdates_filename))
  remove_beautier_folder()
})

This test is in beautier, on the develop branch 👍

richelbilderbeek added a commit to ropensci/beautier that referenced this issue Jan 4, 2025
@richelbilderbeek
Copy link
Member

richelbilderbeek commented Jan 4, 2025

Note to self:

  • [FALSE] It is a feature of beautier/babette to not check if the tipdates file is present yes/no at the time before running
  • [FALSE] it seems that BEAST2 does not give the expected error when this file is absent
/usr/lib/jvm/java-21-openjdk-amd64/bin/java -cp /home/richel/.local/share/beast/lib/launcher.jar beast.app.beastapp.BeastLauncher -statefile /home/richel/.cache/beastier/beast2_29dcf25ef0351b.xml.state -overwrite ~/.cache/beautier/file29dcf22ec106cc

Attaching the created XML...
babette_issue_108.zip

@richelbilderbeek
Copy link
Member

Note to self:

On the other hand, it seems that the absent tipdates file did not make it into the XML at all ...?

richelbilderbeek added a commit to ropensci/beautier that referenced this issue Jan 4, 2025
@richelbilderbeek
Copy link
Member

Note to self: the tipdates file is not stored in the BEAST2 input XML file. Instead, its content is added to the sequences, e.g.

GAAAGTGTAAAAAACGGAACGTATGACTACCCGCAGTATTCAGAAGAAGCAAGACTAAACAGAGAGGAAATAAGTGGAGTAAAATTGGAATCAATGGGAACTTACCAAATACTGTCAATTTATTCAACAGTGGCGAGTTCCCTAGCACTGGCAATCATGGTAGCTGGT---CTATCTTTATGGATGTGCTCCAATGGATCGTTACAATGCAGAATTTGCATT"/>
                                
        <sequence id="seq_A/goose/Guangdong/3/1997_H5N1_EPI_ISL_1909_0" spec="Sequence" taxon="A/goose/Guangdong/3/1997_H5N1_EPI_ISL_1909_0" totalcount="4" value="ATGGAGAAAATAGTGCTTCTTCTTGCAATAGTCAGTCTTGTCAAAAGTGATCAGATTTGCATTGGTTACCATGCAAACAACTCGACAGAGCAGGTTGACACAATAATGGAAAAGAACGTTACTGTTACACATGCCCAAGACATACTGGAAAAGACACACAATGGGAAGCTCTGCGATCTAAATGGAGTGAAGCCTCTCATTTTGAGAGATTGTAGTGTAGCTGGATGGCTCCTCGGA

So indeed beautier should give an error!

richelbilderbeek added a commit to ropensci/beautier that referenced this issue Jan 4, 2025
richelbilderbeek added a commit to ropensci/beautier that referenced this issue Jan 4, 2025
richelbilderbeek added a commit to ropensci/beautier that referenced this issue Jan 4, 2025
@richelbilderbeek
Copy link
Member

Hi @WJH58,

Thanks again for this bug report! I think I fixed it. To use the new code, install it with:

remotes::install_github("ropensci/beautier", ref = "develop")

Could you confirm that now you get a proper error message?

I've added you as a contributor of the beautier package as I know how tedious it is to make a proper bug report like that 👍

@richelbilderbeek
Copy link
Member

P.S. the code will reach CRAN when testing has finished and after CRAN has had their (well-deserved) holidays 👍

@WJH58
Copy link
Author

WJH58 commented Jan 7, 2025

@richelbilderbeek
Thanks for your quick reply! I've installed the developed version and tried again, and indeed the function check_inference_model would check whether the tip dates file exists. However, the produced xml file still does not contain tip dates information:

 <state id="state" spec="State" storeEvery="5000">
            <tree id="Tree.t:2006-2007" spec="beast.evolution.tree.Tree" name="stateNode">
                <trait id="dateTrait.t:2006-2007" spec="beast.evolution.tree.TraitSet" traitname="date" value="">   ## value is empty!

@WJH58
Copy link
Author

WJH58 commented Jan 7, 2025

It is because of the function tipdate_taxa_to_xml_trait():

function (inference_model) 
{
    id <- inference_model$tree_prior$id
    trait_set_str <- NULL
    if (inference_model$beauti_options$beast2_version != "2.6") {
        trait_set_str <- create_trait_set_string(utils::read.table(inference_model$tipdates_filename, 
            sep = "\t"))
    }
    first_line <- paste0("<trait id=\"dateTrait.t:", id, "\" ", 
        "spec=\"beast.evolution.tree.TraitSet\" ")
    if (inference_model$beauti_options$beast2_version != "2.6") {
        first_line <- paste0(first_line, "traitname=\"date-forward\" ")
    }
    else {
        first_line <- paste0(first_line, "traitname=\"date\" ")
    }
    first_line <- paste0(first_line, "value=\"", trait_set_str, 
        "\">")
    c(first_line, paste0("    <taxa id=\"TaxonSet.", id, "\" spec=\"TaxonSet\">"), 
        paste0("        <alignment idref=\"", id, "\"/>"), "    </taxa>", 
        "</trait>")
}

Only when the version of beast is not 2.6, inference_model$tipdates_filename would be read. However beastierinstall::install_beast2() automatically installs v2.6. I would like to try v2.7 later.

@WJH58
Copy link
Author

WJH58 commented Jan 7, 2025

update:

create_beast2_input_file(
    input_filename = fasta_filename,
    output_filename = glue("{start}-{end}.xml"),
    tipdates_filename = "temp_date.txt",
    clock_model = beautier::create_rln_clock_model(),
    site_model = beautier::create_hky_site_model(),
    mcmc = beautier::create_mcmc(),
    tree_prior = beautier::create_cbs_tree_prior(),
    beauti_options = beautier::create_beauti_options(beast2_version = "2.7")
)

I changed the beast2 version to 2.7. In this way, create_beast2_input_file() finally reads tipdates file, but run_beast2() reports error due to the conflicts between Java17 and beast2.7 ...

running command ''/home/zhulab/miniconda3/envs/r/lib/jvm/bin/java' -cp /home/zhulab/.local/share/beast/lib/launcher.jar beast.app.beastapp.BeastLauncher -validate 1996-2000.xml 2>&1' had status 1

Error in check_input_filename_validity(beast2_options) : 
  'input_filename' must be a valid BEAST2 XML file. File '1996-2000.xml' is not a valid BEAST2 file. FALSE
Calls: run_beast2 ... run_beast2_from_options -> check_input_filename_validity
Execution halted

Hope you might give me suggestions about which beast2 version to use. Or fix that tipdate_taxa_to_xml_trait() function. I'd be happy to use beast v2.6.

@richelbilderbeek
Copy link
Member

Hi @WJH58,

Thanks for confirming that the first part of your bug report works (i.e. give an error message if the tipdates file is not found).

I will take a look at the second part before Sunday 23:59 and inform you about my progress 👍

@richelbilderbeek
Copy link
Member

Hi @WJH58, this Sunday did not work out. I will take a look at the second part before next Sunday (January 19th) 23:59 and inform you about my progress 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants