#gal spot class
class galSpot:
	row = 0
	col = 0
	block = 0
	iD = 0
	name = 0
	
	def __init__( self ):
		#print( "creating galSpot" );
		row = 0
		col = 0
		block = 0
		iD = 0
		name = 0
		
	def __init__( self, block, col, ID, name ,row ):
		#print( "creating galSpot" );
		self.block = block;
		self.col = col;
		self.iD = ID;
		self.name = name;
		self.row = row;

#open the file
#fname = input("Enter file name:" );
f = open( "test.gal", "r" );
data = []
colnames = [];
mapp = {};


#look through the file and find the first instance of "Block"
i = 0;
j = 0;
for line in f:
	data = line.split();
	i+=1;
	#print( data[0] );
	if( data[0].strip( '"' ) == "Block" ):
		break;


#create map
for x in data:
	mapp[x] = j;
	j+=1;


#sort the data
data.sort();
#print( "Sorted headings: ", data );


#generate the translation array
translate = [];
for x in data:
	translate.append( mapp[x] );

#print( "Translation array: ", translate );


#continue reading through the file
spots = [];
for line in f:
	data = line.split();
	s = galSpot( data[translate[0]], data[translate[1]], data[translate[2]], data[translate[3]], data[translate[4]] )
	spots.append( s );

f.close()
print( "Completed gal file analysis" ); 
print( "Results" );

i = 0;
for x in spots:
	print( "%i, %s, %s, %s, %s, %s" % ( i, x.block, x.row, x.col, x.iD, x.name ) ); 

f5c4cd184fdc467fa1ed7a316bfa69170cc053aa
class galSpot:
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>

    def __init__(self, block, col, ID, name, row):
        self.block = block
        self.col = col
        self.iD = ID
        self.name = name
        self.row = row


<mask token>

class galSpot:
    row = 0
    col = 0
    block = 0
    iD = 0
    name = 0

    def __init__(self):
        row = 0
        col = 0
        block = 0
        iD = 0
        name = 0

    def __init__(self, block, col, ID, name, row):
        self.block = block
        self.col = col
        self.iD = ID
        self.name = name
        self.row = row


<mask token>

class galSpot:
    row = 0
    col = 0
    block = 0
    iD = 0
    name = 0

    def __init__(self):
        row = 0
        col = 0
        block = 0
        iD = 0
        name = 0

    def __init__(self, block, col, ID, name, row):
        self.block = block
        self.col = col
        self.iD = ID
        self.name = name
        self.row = row


<mask token>
for line in f:
    data = line.split()
    i += 1
    if data[0].strip('"') == 'Block':
        break
for x in data:
    mapp[x] = j
    j += 1
data.sort()
<mask token>
for x in data:
    translate.append(mapp[x])
<mask token>
for line in f:
    data = line.split()
    s = galSpot(data[translate[0]], data[translate[1]], data[translate[2]],
        data[translate[3]], data[translate[4]])
    spots.append(s)
f.close()
print('Completed gal file analysis')
print('Results')
<mask token>
for x in spots:
    print('%i, %s, %s, %s, %s, %s' % (i, x.block, x.row, x.col, x.iD, x.name))

class galSpot:
    row = 0
    col = 0
    block = 0
    iD = 0
    name = 0

    def __init__(self):
        row = 0
        col = 0
        block = 0
        iD = 0
        name = 0

    def __init__(self, block, col, ID, name, row):
        self.block = block
        self.col = col
        self.iD = ID
        self.name = name
        self.row = row


f = open('test.gal', 'r')
data = []
colnames = []
mapp = {}
i = 0
j = 0
for line in f:
    data = line.split()
    i += 1
    if data[0].strip('"') == 'Block':
        break
for x in data:
    mapp[x] = j
    j += 1
data.sort()
translate = []
for x in data:
    translate.append(mapp[x])
spots = []
for line in f:
    data = line.split()
    s = galSpot(data[translate[0]], data[translate[1]], data[translate[2]],
        data[translate[3]], data[translate[4]])
    spots.append(s)
f.close()
print('Completed gal file analysis')
print('Results')
i = 0
for x in spots:
    print('%i, %s, %s, %s, %s, %s' % (i, x.block, x.row, x.col, x.iD, x.name))

#gal spot class
class galSpot:
	row = 0
	col = 0
	block = 0
	iD = 0
	name = 0
	
	def __init__( self ):
		#print( "creating galSpot" );
		row = 0
		col = 0
		block = 0
		iD = 0
		name = 0
		
	def __init__( self, block, col, ID, name ,row ):
		#print( "creating galSpot" );
		self.block = block;
		self.col = col;
		self.iD = ID;
		self.name = name;
		self.row = row;

#open the file
#fname = input("Enter file name:" );
f = open( "test.gal", "r" );
data = []
colnames = [];
mapp = {};


#look through the file and find the first instance of "Block"
i = 0;
j = 0;
for line in f:
	data = line.split();
	i+=1;
	#print( data[0] );
	if( data[0].strip( '"' ) == "Block" ):
		break;


#create map
for x in data:
	mapp[x] = j;
	j+=1;


#sort the data
data.sort();
#print( "Sorted headings: ", data );


#generate the translation array
translate = [];
for x in data:
	translate.append( mapp[x] );

#print( "Translation array: ", translate );


#continue reading through the file
spots = [];
for line in f:
	data = line.split();
	s = galSpot( data[translate[0]], data[translate[1]], data[translate[2]], data[translate[3]], data[translate[4]] )
	spots.append( s );

f.close()
print( "Completed gal file analysis" ); 
print( "Results" );

i = 0;
for x in spots:
	print( "%i, %s, %s, %s, %s, %s" % ( i, x.block, x.row, x.col, x.iD, x.name ) ); 
