Skip to content

WhiteDataReader

WhiteDataReader

Bases: ConnectomeDataset

Reader for datasets from White et al. 1986

Source code in cect/WhiteDataReader.py
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
class WhiteDataReader(ConnectomeDataset):
    """Reader for datasets from [White et al. 1986](../../White_1986.md)"""

    verbose = False

    def __init__(self, spreadsheet_filename):
        ConnectomeDataset.__init__(self)
        self.filename = spreadsheet_filename

        neurons, muscles, other_cells, conns = self.read_all_data()
        # neurons, conns = self.read_data()

        for conn in conns:
            self.add_connection_info(conn)

    def read_all_data(self):
        neurons = set([])
        muscles = set([])
        other_cells = set([])
        conns = []

        with open(self.filename, "r") as f:
            print_("Opened file: " + self.filename)
            f.readline()

            # known_nonconnected_cells = ["CANL", "CANR"]

            for line in f:
                pre, post, num, syntype, synclass = parse_line(line)

                pre = remove_leading_index_zero(pre)
                post = remove_leading_index_zero(post)

                if is_potential_muscle(pre):
                    pre = convert_to_preferred_muscle_name(pre)

                if is_potential_muscle(post):
                    post = convert_to_preferred_muscle_name(post)

                if synclass == "Generic_GJ":
                    conns.append(ConnectionInfo(post, pre, num, syntype, synclass))

                conns.append(ConnectionInfo(pre, post, num, syntype, synclass))

                for p in [pre, post]:
                    if is_herm_neuron(p):
                        neurons.add(pre)
                    elif is_known_muscle(p):
                        muscles.add(pre)
                    else:
                        other_cells.add(p)

        return list(neurons), list(muscles), list(other_cells), conns