Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@

/.idea
*.pyc

/build
/synister.egg-info
/src

/data/fafb_v3/mongodb.ini

/singularity/requirements.txt
/singularity/setup.py
/singularity/synister
/singularity/synister.img
/singularity/src
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ useful to train and predict in other datasets.

### Installation

1. Singularity
You need to build a Singularity container and a conda environment.

#### Singularity
Install [Singularity](https://github.com/sylabs/singularity/blob/main/INSTALL.md) and then run this:
```console
cd singularity
make
```

2. Conda
#### Conda
Create a conda environment with:
```
conda create -n synister -c conda-forge -c funkey python numpy scipy cython pylp pytorch-gpu
conda activate synister
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ tqdm
tensorboardX
notebook==6.1.4
zarr
git+git://github.com/nilsec/pymaid@master
git+https://github.com/nilsec/pymaid@master
-e git+https://github.com/funkey/gunpowder@754607abcd3c84ec28c0d2ea257b969934ce986d#egg=gunpowder
-e git+https://github.com/funkelab/daisy@0.3-dev#egg=daisy
-e git+https://github.com/funkelab/daisy@master#egg=daisy
-e git+https://github.com/funkelab/funlib.learn.torch@636813e60d48379d078b5458e40bdf23269631b3#egg=funlib.learn.torch
-e git+https://github.com/funkelab/funlib.show.neuroglancer@master#egg=funlib.show.neuroglancer
-e git+https://github.com/funkelab/funlib.math@master#egg=funlib.math
Expand Down
7 changes: 3 additions & 4 deletions singularity/Singularity
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ rm -rf /var/lib/apt/lists/*

# install conda

wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
wget https://repo.anaconda.com/miniconda/Miniconda3-py37_4.10.3-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p /miniconda
PATH="/miniconda/bin:$PATH"
conda config --set always_yes yes --set changeps1 no
conda update -q conda
conda info -a
conda install python=3.6

Expand Down Expand Up @@ -124,7 +123,7 @@ python setup.py build_ext --inplace
PYTHONPATH=${FUNLIB_LEARN_ROOT}:$PYTHONPATH

# install pytorch
conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
conda install pytorch=1.10.2 torchvision==0.11.3 cudatoolkit=11.3 -c pytorch

# install synister
cd /src/synister
Expand All @@ -134,7 +133,7 @@ PYTHONPATH=/src/synister:$PYTHONPATH

pip install mahotas
pip install pymongo
pip install opencv-python
pip install opencv-python==4.2.0.34
pip install iteration_utilities

%environment
Expand Down
37 changes: 33 additions & 4 deletions synister/synister_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,40 @@ def __init__(self, credentials, db_name):
self.credentials["host"] = config.get("Credentials", "host")
self.credentials["port"] = config.get("Credentials", "port")

self.auth_string = 'mongodb://{}:{}@{}:{}'.format(self.credentials["user"],
self.credentials["password"],
self.credentials["host"],
self.credentials["port"])
self.connection = {}
self.connection["is_srv"] = config.get("Connection", "is_srv").lower()
if self.connection["is_srv"] == "true":
self.connection["is_srv"] = True
elif self.connection["is_srv"] == "false":
self.connection["is_srv"] = False
else:
raise ValueError('"is_srv" must be "true" or "false".')

self.connection["options"] = config.get("Connection", "options")

auth_string_0 = 'mongodb'

auth_string_template_1 = '://{user:s}:{password:s}@{host:s}'

auth_string_1 = auth_string_template_1.format(
user=self.credentials["user"],
password=self.credentials["password"],
host=self.credentials["host"])

if self.connection["is_srv"]:
auth_string_0 += '+srv'
elif len(self.credentials["port"]) > 0:
try:
int(self.credentials["port"])
auth_string_1 += ':' + self.credentials["port"]
except ValueError:
raise ValueError('"port" must only contains numeric characters.')

self.auth_string = auth_string_0 + auth_string_1

if (len(self.connection["options"]) > 0) and self.connection["options"].__contains__('='):

self.auth_string += '/?' + self.connection["options"]

self.collections = ["synapses", "skeletons", "hemi_lineages", "meta"]

Expand Down