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

cannot find netviewr #1

Closed
AlbertoAbreu opened this issue Feb 11, 2022 · 31 comments
Closed

cannot find netviewr #1

AlbertoAbreu opened this issue Feb 11, 2022 · 31 comments
Assignees
Labels
dev Documents development actions

Comments

@AlbertoAbreu
Copy link

Hi Eike:

Was trying to download and install netviewr but I get an error

devtools::install_github("esteinig/netviewr")
Error: Failed to install 'unknown package' from GitHub:

Is it due to maintenance or has the package been removed?

best

Alberto

@esteinig
Copy link
Owner

esteinig commented Feb 12, 2022

Apologies @AlbertoAbreu this is due to maintenance and pushing code for the latest version, I'll have it ready by the end of the weekend - including documentation 🤞

If you are under time constraints, the stable version and documentation should still work.

I'll keep this issue open and ping you once you can install from GitHub or CRAN (later)

@esteinig esteinig self-assigned this Feb 12, 2022
@esteinig esteinig added the dev Documents development actions label Feb 12, 2022
@esteinig
Copy link
Owner

@AlbertoAbreu should work now:

devtools::install_github("esteinig/netviewr")

Not all documentation is up-to-date and tests still need to be implemented. Have a look here for the population genomics workflow

@AlbertoAbreu
Copy link
Author

AlbertoAbreu commented Feb 12, 2022 via email

@esteinig
Copy link
Owner

Let me know if you run into any trouble, happy to fix things as we go!

@AlbertoAbreu
Copy link
Author

AlbertoAbreu commented Feb 13, 2022 via email

@esteinig
Copy link
Owner

esteinig commented Feb 13, 2022

Good question actually, should add this to the README. It's exactly the same as NetView - except in modern R and hopefully with easier visualization features.

@AlbertoAbreu
Copy link
Author

AlbertoAbreu commented Feb 13, 2022 via email

@AlbertoAbreu
Copy link
Author

AlbertoAbreu commented Feb 13, 2022 via email

@esteinig
Copy link
Owner

Supplied by user at the moment, haven't got one ready but will add in the next week [#4] - anything you can read into a matrix will do, you don't have to use the provided function

@esteinig
Copy link
Owner

You may want to reinstall the latest push which fixes the %>% operator loading [#5]

@AlbertoAbreu
Copy link
Author

AlbertoAbreu commented Feb 13, 2022 via email

@esteinig
Copy link
Owner

esteinig commented Feb 13, 2022

Can you run the following please:

devtools::install_github("esteinig/netviewr")
library(netviewr)

node_data <- tibble::tibble(x=letters[1:10], y=1:10) 
g <- igraph::sample_gnm(n=10, m=15) %@%  node_data %@% node_color(data='x', palette='BuGn') %@% node_size(data='y', min=5, max=8) 
g %>% plot_netview() 

@AlbertoAbreu
Copy link
Author

AlbertoAbreu commented Feb 13, 2022 via email

@esteinig
Copy link
Owner

esteinig commented Feb 13, 2022

let me try a couple of things, i have some ideas. thanks for helping me debug this.

  1. What's your R version?
  2. Are you on Windows, Mac or Linux?
  3. Close RStudio, open new session, then load again
devtools::install_github("esteinig/netviewr")
library(netviewr)
  1. Can you run the following lines in sequence but separately to see where the error is
node_data <- tibble::tibble(x=letters[1:10], y=1:10) 
g <- igraph::sample_gnm(n=10, m=15) %@%  node_data
g <- g %@% node_color(data='x', palette='BuGn')
g <- g %@% node_size(data='y', min=5, max=8)
g %>% plot_netview() 
  1. When you have the line can you post the full error stacktrace please

I can't reproduce the error on Linux or Windows using R3.6.2 or R4.1.2

@AlbertoAbreu
Copy link
Author

AlbertoAbreu commented Feb 13, 2022 via email

@esteinig
Copy link
Owner

No trouble at all - R/RStudio can be a little weird sometimes.

Let me know if anything else comes up, will leave this issue open for now. I also added the minimum k-selection documentation to the population genomics section, should you need it.

@AlbertoAbreu
Copy link
Author

AlbertoAbreu commented Feb 13, 2022 via email

@esteinig
Copy link
Owner

Ah both are on me, first one is kinda irrelevant anyway (will remove) and second one is ok to fail. Data should be character or factor for color assignment but the y column is numeric. Thanks for spotting these

esteinig added a commit that referenced this issue Feb 13, 2022
@AlbertoAbreu
Copy link
Author

AlbertoAbreu commented Feb 13, 2022 via email

@esteinig
Copy link
Owner

I can't really debug this without seeing the matrix.

  1. Is the matrix file tab delineated?
  2. You can just read it into a square matrix any way you like, without using this function. It hasn't been tested yet - important is that you read it into a square matrix object - would try that for now.

@AlbertoAbreu
Copy link
Author

AlbertoAbreu commented Feb 13, 2022 via email

@esteinig
Copy link
Owner

I just realized you had attached it, my apologies! I think it didn't attach for some reason.

Thanks so much for this, will have a look (might be an hour because of meetings). I've got the file, you can delete it from the Dropbox, if you would prefer no one else to access it :)

@esteinig
Copy link
Owner

My bad again, the read_dist function is messed up, try this:

dist <- as.matrix(read.csv("testing_nonames.tsv", sep = "\t", header=FALSE))

Looks really interesting in the network topology, for a basic start:

graphs <- dist %>% netview(k=1:82)
graphs$k20 %>% plot_netview()

K-selection plot:

cgraphs <- graphs %@% community(method=c("infomap", "fast_greedy"))
cgraphs %>% plot_kselect()

Indicates around k = 20 as a good elbow value, might be interesting to look at Admixture and proportions across the structure in the network. I will add the docs for that next weekend / after work maybe this week

esteinig added a commit that referenced this issue Feb 14, 2022
@esteinig
Copy link
Owner

You'll of course have to add your meta data and probably make the plots a bit nicer looking (reduce node size, colors by sampling location or trait etc) - this is just to get you started.

@AlbertoAbreu
Copy link
Author

AlbertoAbreu commented Feb 14, 2022 via email

@esteinig
Copy link
Owner

Not sure what you mean, but you can modify the plot_netview function the same way as the igraph::plot.igraph function by passing the same parameters into it. But that's a bit beyond my scope and time to explain.

@AlbertoAbreu
Copy link
Author

AlbertoAbreu commented Feb 14, 2022 via email

@esteinig
Copy link
Owner

esteinig commented Feb 14, 2022

If I understand you correctly, you can decorate the graphs with a data frame with a group identifier for each isolate (character or factor), and then use the node_color decorator to link that to the node colors and a palette / vector of colors, but have a look in the decorator function section

I'll be able to work on this again next weekend and add this to the tutorial section, but shouldn't be too hard to figure out - since you got all this way already :)

No node labels should be default but otherwise something like:

graphs$k20 %@% node_label(data=NULL) %>% plot_netview()

Final thing you don't have to use the plot_netview function, this is just to link decorated data to the graph visualization. You can use the standard igraph::plot.igraph function with the graph object from netview builder.

@AlbertoAbreu
Copy link
Author

AlbertoAbreu commented Feb 14, 2022 via email

@esteinig
Copy link
Owner

Ah great! Of course, feel free to post them here

@esteinig
Copy link
Owner

I'll close this for now, but feel free to re-open should you run into something else! Thanks for the help debugging some of these things and improving the documentation :)

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

No branches or pull requests

2 participants