neherlab / treetime

Maximum likelihood inference of time stamped phylogenies and ancestral reconstruction
MIT License
222 stars 55 forks source link

Relaxed clock in NextStrain? #143

Open NakarinP opened 3 years ago

NakarinP commented 3 years ago

Hello Richard,

Since there is no relaxed clock argument in "rule refine" in Augur, I have tried to separately run Treetime with --relax argument then put the results back to the pipeline as they're needed for further rules. Briefly, I used "aligned.fasta" from rule align and "tree_raw.nwk" from rule tree as inputs for the Treetime running (treetime --tree tree_raw.nwk --dates metadata.tsv --aln aligned.fasta --outdir out --relax 1.0 0). However, Treetime's outputs couldn't be matched with rule refine's outputs for example "branchlengths.json" of rule refine needs branch_length, clock_length, date, mutation_length, and num_date_confidence for each taxa, but the resulting tree from Treetime only provides only branch_length, mutations, and date.

Is there any way to apply a relaxed clock model into the NextStrain's Augur pipeline or the way to tell Treetime to create some results corresponding to rule refine's output?

Thank you,

Nakarin

rneher commented 3 years ago

you are right, augur doesn't accept arguments for a relaxed clock.

you could write a little script that produces a branchlengths.json from the output of treetime (the tree and tabular output). But it would probably be easier to call treetime from within a little python script. See here for an example

https://github.com/neherlab/treetime_examples/blob/master/scripts/relaxed_clock.py#L32

and then output the desired json.

NakarinP commented 3 years ago

Thank you for the suggestion!