igraph biological communities

I have invertebrate species collected in different sites on a river. I will calculate which species ocurr more than expected by chance and use positive coocurrences as links. I want to calculate modulatiy of the network and topological roles of the species and I was wondering whether I could use igraph.

Yes, igraph is suitable for such tasks.

Could you please let me know which codes could I use to calculate modularity, its significance and topological roles in igraph?
I have a network with pairs os species with positive cooccurrences (they cooccurr more than expected by chance).
Thanks in advance

It sounds like you are seeking help with an entire ecological data analysis project. A forum like this is not the right place for this. I suggest you seek local network science expert collaborators, with whom you can discuss this in person.

If you are looking to do community detection, R/igraph has many functions for this. Their names all start with cluster_.

Regarding finding the modularity of your network: Note that modularity does not characterize a network, but a specific partitioning of a network. Many, but not all, community detection methods are based on the idea of trying to find the partitioning with the highest modularity.

Thank you very much for the constructive comments!