https://github.com/alleninstitute/standard_morph
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (7.4%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: AllenInstitute
- Language: Python
- Default Branch: main
- Size: 63.5 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
- Releases: 0
Metadata Files
README.md
Standard Morph
Standard Morph is a Python library designed for processing and validating SWC files. It provides tools for standardizing SWC structures and generating quality control (QC) reports. Future direction will include integration with backend databases.
Installation
coming soon:
pip install standard-morph
For now:
git clone https://github.com/AllenInstitute/standardmorph.git
cd standardmorph
pip install .
Usage
Example 1: Standardizing a Single SWC File
```python from standard_morph.Standardizer import Standardizer
Path to the SWC file
pathtoswc = './scratchfiles/1311509665_TT.ano.swc'
Initialize the Standardizer worker
worker = Standardizer( pathtoswc=pathtoswc, swcseparator=" ", somachildrendistancethreshold=50, validfilenameformat="None", somamipkwargs={} )
Validate the SWC file
worker.validate()
Write the QC'd SWC file with sorted node IDs
worker.writetoswc(outputswcpath="QCd_File.swc")
Generate an HTML report for the single cell
where nodedisplaymode='both' will write node ID and x,y,z coordinates
worker.reporttohtml(reportpath="CellQCReport.html", nodedisplay_mode='both')
Can inspect the report
This may be useful for writing the QC records to a database
print(worker.StandardizationReport)
{ 'inputfile': './scratchfiles/1311509665TT.ano.swc', 'StandardMorphVersion': '0.0.1', 'pathtomip': None, "errors": [ { "test": "SomaChildrenFurcation", "description": "Children nodes of the soma should not branch. The returned node IDs are immediate children of the soma that branch.", "nodeswitherror": [(2, 313.0, 4409.0, 8981.0)] }, { "test": "AxonOrigins", "description": "Axon should originate from a single location and should stem from axon, soma, or basal dendrite. Invalid axon origins are returned.", "nodeswitherror": [ (58, 3231.0, 3131.0, 9218.0), (423, 3521.0, 3320.0, 7840.0), (424, 3104.0, 3344.0, 8889.0), ] }, { "test": "DendriteOrigins", "description": "Each apical/basal dendritic node should have a parent node with type 1 (soma) or its respective dendrite type.", "nodeswitherror": [ (3, 310, 1310.0, 3044.0, 7742.0) , (15,530.0, 5502.0, 8173.0) ] } ], } ```
Example 2: Standardizing multiple SWC Files
```python
Define multiple SWC files
pathtoswc1 = "Vip-IRES-CreAi14IVSCC-259339.03.01.02678343034m.swc" pathtoswc2 = "Vip-IRES-CreAi14IVSCC-259339.03.01.02678343034m.swc"
allreports = [] for swcpath in [pathtoswc1, pathtoswc2]: worker = Standardizer(pathtoswc=swcpath, swcseparator=" ", somachildrendistancethreshold=50, validfilenameformat="None", somamipkwargs={}) worker.validate() thisreport = worker.StandardizationReport allreports.append(thisreport)
Generate a combined HTML report for multiple cells, display just the x,y,z coordinate
createhtmlreport(data=allreports, reportpath="MultiCellReport.html", nodedisplaymode='coord') ```
Example 3: Standardizing a Single SWC File + Soma MIP QC. UNTESTED
```python from standard_morph.Standardizer import Standardizer
Path to the SWC file
pathtoswc = 'Vip-IRES-CreAi14IVSCC-259339.03.01.02678343034_m.swc'
somamipkwargs = { "imagepath":"/soma/omezarr/image/", "outputdir":"/where/to/save/mip.png", "cropsize":128, "mipdepth":10 }
Initialize the Standardizer worker,
Note the validfilenameformat will check for AIND style regular expressions
worker = Standardizer( pathtoswc=pathtoswc, swcseparator=" ", somachildrendistancethreshold=50, validfilenameformat="AIND", somamipkwargs=somamipkwargs )
Validate the SWC file
worker.validate()
Generate an HTML report for the single cell
worker.reporttohtml(reportpath="SingleCellQCReportWithSomaMIP.html", nodedisplay_mode='coord') ```
Owner
- Name: Allen Institute
- Login: AllenInstitute
- Kind: organization
- Location: Seattle, WA
- Website: https://alleninstitute.org
- Repositories: 184
- Profile: https://github.com/AllenInstitute
Please visit http://alleninstitute.github.io/ for more information.
GitHub Events
Total
- Issues event: 4
- Issue comment event: 2
- Public event: 1
- Push event: 15
- Pull request event: 6
- Create event: 4
Last Year
- Issues event: 4
- Issue comment event: 2
- Public event: 1
- Push event: 15
- Pull request event: 6
- Create event: 4
Dependencies
- pandas *