Data Import and Export (Python API)
1. Importing a network from a Table
- If you have an interaction matrix stored in a
tsv
orcsv
format, you can load it into aNetwork
object. Additionally we require: obsmeta_file
- Acsv
file containing the taxonomy information for the microbes that are a part of the matrixmeta_file
- Ajson
file containing the experimental metadata for the networkcmeta_file
- Ajson
file containing the details about the computational processing done on the data
from micone import Network, NetworkGroup
network = Network.load_data(
interaction_file,
meta_file,
cmeta_file,
obsmeta_file,
)
network_group = NetworkGroup([network])
Additionally, you can specify the matrix of pvalues and thesholds if any to be applied to the data
Note
The indices of the
interaction_file
andobsmeta_file
must matchThe order of indicies of
interaction_file
andpvalue_file
must match
2. Importing a network from an edge list
If you have interaction data stored in the form of an edge list
from micone import Network. NetworkGroup
network = Network.load_elist(
elist_file,
meta_file,
cmeta_file,
obsmeta_file,
)
network_group = NetworkGroup([network])
Note
The headers of the
elist_file
must contain “source”, “target”, “weight”
3. Exporting your Network object into JSON file
network_group.write("network.json", pvalue_filter=True, interaction_filter=False)
This JSON
file is compatible with the MIND
database and can be uploaded and visualized directly on the website.