Beast 2

133 views
Skip to first unread message

Luka Jovanovic

unread,
Jun 4, 2019, 6:41:06 AM6/4/19
to beast-users
I have a problem with an R plotting tool for Birth Death Skyline plot log file. When try to lunch it in R studio there is an error in the statement > delta_hpd < getHPD(lf$becomeUninfectiousRate). 

The error message is as follows:
 Error in attributes(.Data) <- c(attributes(.Data), attrib) : 
  'names' attribute [2] must be the same length as the vector [0]
In addition: Warning message:
In structure(c(a[i], b[i]), names = c("Lower Bound", "Upper Bound")) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.

Here I am adding also a link to a tutorial that I used: https://taming-the-beast.org/tutorials/Skyline-plots/

Please help!!
Best regards 
Luka Jovanovic MD, Ph.D. candidate Institute for Microbiology and Immunology, Medical Faculty, University of Belgrade. 

Walter Xie

unread,
Jun 4, 2019, 10:20:44 PM6/4/19
to beast-users
Hi Luka,

This is not a BEAST 2 issue. I cannot replicate it using R 3.5.1 and following the tutorial instruction. The R script works fine. A screenshot is attached.

I think you need to update/reinstall your R. 

Cheers,
Walter
Screen Shot 2019-06-05 at 2.19.25 PM.png

Luka Jovanovic

unread,
Jun 4, 2019, 11:40:14 PM6/4/19
to beast...@googlegroups.com
Thank you so much.


--
You received this message because you are subscribed to a topic in the Google Groups "beast-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beast-users/HBkH8Vf2XVM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beast-users...@googlegroups.com.
To post to this group, send email to beast...@googlegroups.com.
Visit this group at https://groups.google.com/group/beast-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/beast-users/3c8cd773-f602-4548-8db8-3d02de77cc48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Luka Jovanovic

unread,
Jun 5, 2019, 2:29:45 AM6/5/19
to beast...@googlegroups.com
I tried again and the previous problem is solved but now I have a problem with plotting the results.
Code goes as follows: 

...package ‘devtools’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
        C:\Users\Luka\AppData\Local\Temp\Rtmp6hJSJa\downloaded_packages
> library(devtools)
> devtools::install_github("laduplessis/bdskytools")
Skipping install of 'bdskytools' from a github remote, the SHA1 (c4740523) has not changed since last install.
  Use `force = TRUE` to force installation
> library(bdskytools)
> fname <- "C:\\Users\\Luka\\Downloads\\BEAST.v2.4.2.Windows\\BEAST\\MREZA.log"
> lf    <- readLogfile(fname, burnin=0.1)
> Re_sky    <- getSkylineSubset(lf, "reproductiveNumber")
> Re_hpd    <- getMatrixHPD(Re_sky)
> delta_hpd <- getHPD(lf$becomeUninfectiousRate)
> plotSkyline(1:10, Re_hpd, type='step', ylab="R")...

And then I got the error mesage: ...Error in plotSkyline(1:10, Re_hpd, type = "step", ylab = "R") : 
  Dimension mismatch between times and skyline_mat!...

Again I did not use the data set from the following tutorial, but I did use the code:   https://taming-the-beast.org/tutorials/Skyline-plots/ 
Please be kind again to help an inexperienced R user :)
Luka Jovanovic MD, Ph.D. candidate


Virus-free. www.avg.com

--

Luka Jovanovic

unread,
Jun 5, 2019, 2:39:07 AM6/5/19
to beast...@googlegroups.com
I will upload the log file that I used.

Virus-free. www.avg.com
MREZA.log

Walter Xie

unread,
Jun 9, 2019, 7:16:29 PM6/9/19
to beast-users
Hi Luka,

If you type "? plotSkyline" in R, it will bring the document:

times


The time points to draw the skyline at. length(times) should be equal to ncol(skyline_mat) + 1. (Because there are length(times) intervals and the last interval needs an end-time). If length(times) == ncol(skyline_mat) the last interval is arbitrarily given the same length as the second last interval.

 
So your case is "plotSkyline(1:4, Re_hpd, type='step', ylab="R")".

Cheers,
Walter


On Wednesday, 5 June 2019 18:29:45 UTC+12, Luka Jovanovic wrote:
I tried again and the previous problem is solved but now I have a problem with plotting the results.
Code goes as follows: 

...package ‘devtools’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
        C:\Users\Luka\AppData\Local\Temp\Rtmp6hJSJa\downloaded_packages
> library(devtools)
> devtools::install_github("laduplessis/bdskytools")
Skipping install of 'bdskytools' from a github remote, the SHA1 (c4740523) has not changed since last install.
  Use `force = TRUE` to force installation
> library(bdskytools)
> fname <- "C:\\Users\\Luka\\Downloads\\BEAST.v2.4.2.Windows\\BEAST\\MREZA.log"
> lf    <- readLogfile(fname, burnin=0.1)
> Re_sky    <- getSkylineSubset(lf, "reproductiveNumber")
> Re_hpd    <- getMatrixHPD(Re_sky)
> delta_hpd <- getHPD(lf$becomeUninfectiousRate)
> plotSkyline(1:10, Re_hpd, type='step', ylab="R")...

And then I got the error mesage: ...Error in plotSkyline(1:10, Re_hpd, type = "step", ylab = "R") : 
  Dimension mismatch between times and skyline_mat!...

Again I did not use the data set from the following tutorial, but I did use the code:   https://taming-the-beast.org/tutorials/Skyline-plots/ 
Please be kind again to help an inexperienced R user :)
Luka Jovanovic MD, Ph.D. candidate


Virus-free. www.avg.com

сре, 5. јун 2019. у 04:20 Walter Xie <dong...@gmail.com> је написао/ла:
Hi Luka,

This is not a BEAST 2 issue. I cannot replicate it using R 3.5.1 and following the tutorial instruction. The R script works fine. A screenshot is attached.

I think you need to update/reinstall your R. 

Cheers,
Walter



On Tuesday, 4 June 2019 22:41:06 UTC+12, Luka Jovanovic wrote:
I have a problem with an R plotting tool for Birth Death Skyline plot log file. When try to lunch it in R studio there is an error in the statement > delta_hpd < getHPD(lf$becomeUninfectiousRate). 

The error message is as follows:
 Error in attributes(.Data) <- c(attributes(.Data), attrib) : 
  'names' attribute [2] must be the same length as the vector [0]
In addition: Warning message:
In structure(c(a[i], b[i]), names = c("Lower Bound", "Upper Bound")) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.

Here I am adding also a link to a tutorial that I used: https://taming-the-beast.org/tutorials/Skyline-plots/

Please help!!
Best regards 
Luka Jovanovic MD, Ph.D. candidate Institute for Microbiology and Immunology, Medical Faculty, University of Belgrade. 

--
You received this message because you are subscribed to a topic in the Google Groups "beast-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beast-users/HBkH8Vf2XVM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beast...@googlegroups.com.

Luka Jovanovic

unread,
Jun 9, 2019, 11:28:01 PM6/9/19
to beast...@googlegroups.com
Thank you so much.

To unsubscribe from this group and all its topics, send an email to beast-users...@googlegroups.com.

To post to this group, send email to beast...@googlegroups.com.
Visit this group at https://groups.google.com/group/beast-users.
Reply all
Reply to author
Forward
0 new messages