def getNeuronName(self): y = elem.skeletonID z = str(y) myNames = GetAnnotationsByID.getLookUpTableSkID_Name() if y in myNames: self.neuronName = myNames[y] else: myOtherNames = GetAnnotationsByID.getLookUpTableSkID_Name('CardLab-collaborating') self.neuronName = myOtherNames[y] return self.neuronName
def buildFromSkidList(myList): # sets list of all skeleton IDs mySkels = myList # creates dictionary with keys as str(skel IDs) and values as number of synapses with DNright # myDNrightConnectivity = GetDNrightConnectivity.removeExtra(myList) # creates dictionary with key-value pairs of str(skelID) and list of str(annotations) myAnnotations = GetAnnotationsByID.getMyAnnotations(myList) # creates a dictionary with key-value pairs of int(skelID) and and str(neuron name) myNames = GetAnnotationsByID.getLookUpTableSkID_Name() # 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 myList: x = DNinputNeuron(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 myDNrightConnectivity: # elem.DNrightsynapseCount = myDNrightConnectivity[z] if z in myAnnotations: elem.annotations = myAnnotations[z] p = elem.annotations if y in myNames: elem.neuronName = myNames[y] return myNeurons
def builder(DNSKID, SKID=None): if SKID is None: # creates dictionary with keys as str(skel IDs) and values as number of synapses with DNright myDNrightConnectivity = GetDNrightConnectivity.removeExtra(DNSKID) # sets string list of all skeleton IDs mySkels = GetDNrightConnectivity.getMySkids(DNSKID, myDNrightConnectivity) mySkelIDs = [] for i in mySkels: mySkelIDs.append(int(i)) # 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 mySkelIDs: x = DNinputNeuron(i) myNeurons.append(x) else: SKID = int(SKID) myNeurons = [] x = DNinputNeuron(SKID) myNeurons.append(x) myDNrightConnectivity = [] # creates dictionary with key-value pairs of str(skelID) and list of str(annotations) myAnnotations = GetAnnotationsByID.getMyAnnotations(mySkels) # creates a dictionary with key-value pairs of int(skelID) and and str(neuron name) myNames = GetAnnotationsByID.getLookUpTableSkID_Name() # 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 myDNrightConnectivity: elem.DNrightsynapseCount = myDNrightConnectivity[z] else: elem.DNrightsynapseCount = 0 if z in myAnnotations: elem.annotations = myAnnotations[z] p = elem.annotations for abc in p: if ( 'putative' in abc or 'Unclassified' in abc or 'JO' in abc or 'B1' in abc or 'GCI' in abc or 'Halted' in abc or 'Neuron Fragment' in abc or 'DN' in abc) and 'synaptic' not in abc and \ 'input to' not in abc and 'DN106 input neuron' not in abc: elem.classification = abc # if ('type 37' in abc or 'type 38' in abc or 'type 44' in abc or 'JO' in abc: # elem.classification = 'JO' if elem.classification is None: elem.classification = "Other" if "Descending" in abc or 'Ascending' in abc: if 'Unclassified' in elem.classification and 'type' not in elem.classification: elem.classification = "Unclassified {} DN input neuron".format(abc) if 'RIGHT' in abc or 'LEFT' in abc: if elem.hemisphere is None: elem.hemisphere = abc if 'Bilateral' in abc: elem.hemisphere = abc if elem.hemisphere is None: elem.hemisphere = "RIGHT HEMISPHERE" if y in myNames: elem.neuronName = myNames[y] return myNeurons