def builder(myList): # sets list of all skeleton IDs mySkels = myList myAnnotations = NeuronObjectData.getMyAnnotations(217284386) myAnnotations2 = NeuronObjectData.getMyAnnotations(3552044) myAnnotations3 = merge_dicts(myAnnotations, myAnnotations2) # creates a dictionary with key-value pairs of int(skelID) and and str(neuron name) myNames = NeuronObjectData.getLookUpTableSkID_Name(217284386) myNames2 = NeuronObjectData.getLookUpTableSkID_Name(3552044) # creates empty list to be filled with all instances myNeurons = [] # creates list of of all instances while setting each instance's name and skeletonID to be an element from mySkls for i in mySkels: x = AscendingNeuron(i) myNeurons.append(x) # converts skeletonID attribute to string for use as dictionary key then adds all available synapses from # dictionary of synapses and all available annotations from dictionary of annotations for elem in myNeurons: y = elem.skeletonID z = str(y) if z in myAnnotations3: elem.annotations = myAnnotations3[z] p = elem.annotations if "Descending Neuron" in p: elem.classification = "Descending" elem.status = "Descending Neuron" elif "Ascending Neuron" in p: elem.classification = "Ascending" elem.status = "Ascending Neuron" elif "Putative_Ascending" in p: elem.classification = 'Ascending' elem.status = "Putative_Ascending" if "merges larger DN" in p: elem.status = "Merges into larger DN" elif "merges existing DN" in p: elem.status = "Merges into existing DN" elif 'Halted' in p or 'Halted Neuron' in p: elem.status = 'Halted' elif 'FindSoma' in p: elem.status = 'FindSoma' if y in myNames: elem.neuronName = myNames[y] if y in myNames2: elem.neuronName = myNames2[y] removeAnno = re.compile("Merged: Google") newAnno = [ ann for ann in elem.annotations if not removeAnno.search(ann) ] elem.annotations = newAnno return myNeurons
def builder(): dnskidList = NeuronObjectData.getListOfSkID_int(2998068) putative_skidlist = NeuronObjectData.getListOfSkID_int(217431412) skidList = [] for i in dnskidList: skidList.append(i) for i in putative_skidlist: if i not in skidList: skidList.append(i) mySet = DnAutoseg_set(np.array(DnAutosegClass.builder(skidList))) return mySet
def builder(): ascending_skidlist = NeuronObjectData.getListOfSkID_int(217284386) putative_skidlist = NeuronObjectData.getListOfSkID_int(3552044) skidList = [] for i in ascending_skidlist: skidList.append(i) for i in putative_skidlist: if i not in skidList: skidList.append(i) mySet = AscendingSet(np.array(AscendingNeuronClass.builder(skidList))) return mySet
def correctAnnotations(self): mySet = NeuronObjectData.removeSomaless(self) rightHem = [] leftHem = [] for item in mySet: if item.soma[0] < 500000: rightHem.append(item.skeletonID + 1) elif item.soma[0] > 550000: leftHem.append(item.skeletonID + 1) responseOne = requests.post( 'https://neuropil.janelia.org/tracing/fafb/v14/{}/annotations/remove' .format(project_id), auth=config.CatmaidApiTokenAuth(token), data={ 'entity_ids': rightHem, 'annotation_ids': [1223085] }) responseOne = json.loads(responseOne.content) print(responseOne) responseTwo = requests.post( 'https://neuropil.janelia.org/tracing/fafb/v14-seg-li-190805.0/{}/annotations/remove' .format(project_id), auth=config.CatmaidApiTokenAuth(token), data={ 'entity_ids': leftHem, 'annotation_ids': [1167304] }) responseTwo = json.loads(responseTwo.content) print(responseTwo) return
def getNeuronName(self): y = self.skeletonID z = str(y) myNames = NeuronObjectData.getLookUpTableSkID_Name() if y in myNames: self.neuronName = myNames[y] return self.neuronName
def getAnnotations(self): myAnnotations = NeuronObjectData.getMyAnnotations() y = self.skeletonID z = str(y) if z in myAnnotations: self.annotations = myAnnotations[z] return self.annotations
def getSkeletonNodes(self): self.skeletonNodes = NeuronObjectData.getAllNodes(self) return self.skeletonNodes
def builder(myList): # sets list of all skeleton IDs mySkels = myList myAnnotations = NeuronObjectData.getMyAnnotations(2998068) myAnnotations2 = NeuronObjectData.getMyAnnotations(217431412) myAnnotations3 = merge_dicts(myAnnotations, myAnnotations2) # creates a dictionary with key-value pairs of int(skelID) and and str(neuron name) myNames = NeuronObjectData.getLookUpTableSkID_Name(2998068) myNames2 = NeuronObjectData.getLookUpTableSkID_Name(217431412) myNames3 = merge_dicts(myNames, myNames2) # creates empty list to be filled with all instances myNeurons = [] # creates list of of all instances while setting each instance's name and skeletonID to be an element from mySkls for i in mySkels: x = DescendingNeuron(i) myNeurons.append(x) # converts skeletonID attribute to string for use as dictionary key then adds all available synapses from # dictionary of synapses and all available annotations from dictionary of annotations for elem in myNeurons: y = elem.skeletonID z = str(y) if z in myAnnotations3: elem.annotations = myAnnotations3[z] p = elem.annotations #DNp10 Non-Visual Input ClusterA DNTypeReg = re.compile( r'^.*DN[a-z][0-9](?!Interneuron)(?!Exploration)(?!presynaptic)(?!postsynaptic)(?!.*Non-Visual)' ) DNNewType = re.compile(r'DN[a-z] type') DNPutative = re.compile(r'putative_DN[a-z]$') idType = list(filter(DNTypeReg.match, p)) newType = list(filter(DNNewType.match, p)) putType = list(filter(DNPutative.match, p)) if len(idType) != 0: elem.classification = str(idType[0]) elif len(newType) != 0: elem.classification = str(newType[0]) elif len(putType) != 0: elem.classification = str(putType[0]) if "putative_Descending" in p: elem.classification = "putative_Descending" elif "DNa" in p: elem.dnType = "DNa" elif "DNb" in p: elem.dnType = "DNb" elif "DNc" in p: elem.dnType = "DNc" elif "DNd" in p: elem.dnType = "DNd" elif "DNg" in p: elem.dnType = "DNg" elif "DNp" in p: elem.dnType = "DNp" elif "DNx" in p: elem.dnType = "DNx" if "Typed DN" in p: elem.ID = "Typed DN" elif "miscellaneous DNa" in p: elem.ID = "Miscellaneous DNa" elif "miscellaneous DNp" in p: elem.ID = "Miscellaneous DNp" elif "miscellaneous DNg" in p: elem.ID = "Miscellaneous DNg" if elem.ID is None: if "Identified DN" in p: elem.ID = "Identified DN" elif "Unidentified DN" in p: elem.ID = "Unidentified DN" if 'RIGHT HEMISPHERE' in p: elem.hemisphere = "RIGHT HEMISPHERE" elif 'LEFT HEMISPHERE' in p: elem.hemisphere = "LEFT HEMISPHERE" elif 'midLine' in p: elem.hemisphere = "midLine" elif 'FindSoma' in p: elem.hemisphere = 'FindSoma' if elem.hemisphere is not None: elem.status = "Complete" if "duplicate - manual" in p: elem.status = "duplicate - manual" elif "duplicate - auto" in p: elem.status = "duplicate - auto" elif "check FC" in p: elem.status = "Check FC" elif 'Putative_Ascending' in p: elem.status = 'Putative_Ascending' elif 'Halted' in p or 'Halted Neuron' in p: elem.status = 'Halted' elif 'unclear FW' in p: elem.status = 'unclear FW' elif 'no FW soma' in p: elem.status = 'no FW soma' elif 'FindSoma' in p: elem.status = 'FindSoma' if 'check DT' in p: elem.dtSide = 'check DT' elif 'double DT' in p: elem.dtSide = "double DT" elif 'left DT' in p: elem.dtSide = 'Left' elif 'right DT' in p: elem.dtSide = 'Right' if y in myNames3: elem.neuronName = myNames3[y] removeAnno = re.compile("Merged: Google") newAnno = [ ann for ann in elem.annotations if not removeAnno.search(ann) ] elem.annotations = newAnno for neuron in myNeurons: classif = str(neuron.classification) neuron.classification = classif.replace("_", " ") return myNeurons
def getSomaNode(self): self.soma = NeuronObjectData.getSoma(self) return self.soma