#A.append(StrListToFloatList(selectListByIndexVector(fields,grp1Selector)))
		#B.append(StrListToFloatList(selectListByIndexVector(fields,grp2Selector)))
		for groupDataMatrix,groupLabelSelector in zip(groupData,groupLabelSelectors):
			groupLabel,groupSelectors=groupLabelSelector
			groupDataMatrix.append(StrListToFloatList(selectListByIndexVector(fields,groupSelectors)))
		
	
	
	fil.close()
	
	#now transpose
	#A=matrix_transpose(A,len(A),len(A[0]))[0] #get the data only, discards the nrow and ncol
	#B=matrix_transpose(B,len(B),len(B[0]))[0] 
	for i in range(0,len(groupData)):
		groupData[i]=matrix_transpose(groupData[i],len(groupData[i]),len(groupData[i][0]))[0]
	
	
	#now calculate distance
	#dist=linkage(A,B,method)
	for i in range(0,len(groupLabelSelectors)):
		for j in range(i,len(groupLabelSelectors)):
			
			ALabel=groupLabelSelectors[i][0]
			BLabel=groupLabelSelectors[j][0]
			
			if i==j:
				print >> stdout,"%s\t%s\t%f" %(ALabel,BLabel,0.0)
				continue
				
			A=groupData[i]
        #A.append(StrListToFloatList(selectListByIndexVector(fields,grp1Selector)))
        #B.append(StrListToFloatList(selectListByIndexVector(fields,grp2Selector)))
        for groupDataMatrix, groupLabelSelector in zip(groupData,
                                                       groupLabelSelectors):
            groupLabel, groupSelectors = groupLabelSelector
            groupDataMatrix.append(
                StrListToFloatList(
                    selectListByIndexVector(fields, groupSelectors)))

    fil.close()

    #now transpose
    #A=matrix_transpose(A,len(A),len(A[0]))[0] #get the data only, discards the nrow and ncol
    #B=matrix_transpose(B,len(B),len(B[0]))[0]
    for i in range(0, len(groupData)):
        groupData[i] = matrix_transpose(groupData[i], len(groupData[i]),
                                        len(groupData[i][0]))[0]

    #now calculate distance
    #dist=linkage(A,B,method)
    for i in range(0, len(groupLabelSelectors)):
        for j in range(i, len(groupLabelSelectors)):

            ALabel = groupLabelSelectors[i][0]
            BLabel = groupLabelSelectors[j][0]

            if i == j:
                print >> stdout, "%s\t%s\t%f" % (ALabel, BLabel, 0.0)
                continue

            A = groupData[i]
            B = groupData[j]
	#two pass
	
	fil=open(filename)
	lino=0
	for lin in fil:
		lino+=1
		if lino<startRow:
			continue
		
		fields=lin.rstrip("\r\n").split(fs)
		Matrix.append(toFloatList(getSubvector(fields,cols)))
	
	fil.close()
	
	#now Matrix is gotten, quantile normalize
	Matrix,MtRow,MtCol=matrix_transpose(Matrix,len(Matrix),len(Matrix[0]))
	quantileNormalizeMInPlace(Matrix,method)
	Matrix,MtRow,MtCol=matrix_transpose(Matrix,MtRow,MtCol)
	
	#print >> stderr,Matrix
	#now second pass
	fil=open(filename)
	lino=0
	for lin in fil:
		lino+=1
		fields=lin.rstrip("\r\n").split(fs)
		if lino<startRow:
			pass
		else:
			fillVectorByIndexAsString(fields,Matrix[lino-startRow],cols)
		
    #two pass

    fil = open(filename)
    lino = 0
    for lin in fil:
        lino += 1
        if lino < startRow:
            continue

        fields = lin.rstrip("\r\n").split(fs)
        Matrix.append(toFloatList(getSubvector(fields, cols)))

    fil.close()

    #now Matrix is gotten, quantile normalize
    Matrix, MtRow, MtCol = matrix_transpose(Matrix, len(Matrix),
                                            len(Matrix[0]))
    quantileNormalizeMInPlace(Matrix, method)
    Matrix, MtRow, MtCol = matrix_transpose(Matrix, MtRow, MtCol)

    #print >> stderr,Matrix
    #now second pass
    fil = open(filename)
    lino = 0
    for lin in fil:
        lino += 1
        fields = lin.rstrip("\r\n").split(fs)
        if lino < startRow:
            pass
        else:
            fillVectorByIndexAsString(fields, Matrix[lino - startRow], cols)