def loadProjectPCA(): saveFileName = askopenfilename(initialdir = "/",title = "Select file",filetypes = (("Phenotype Files","*"),("all files","*.*"))) saveFileObject = open(saveFileName) i = 0; next = saveFileObject.readline() PCADataRead = next PCADataRead = PCADataRead.strip() #reads through the text file and takes out the save data while i < 5: if(i == 0): PCAPhenoRead = saveFileObject.readline() PCAPhenoRead = PCAPhenoRead.rstrip('\n') if(i == 1): columnPCAEvec1read = saveFileObject.readline() columnPCAEvec1read = columnPCAEvec1read.strip() if(i == 2): columnPCAEvec2read = saveFileObject.readline() columnPCAEvec2read = columnPCAEvec2read.strip() if(i == 3): columnPCAEvec3read = saveFileObject.readline() columnPCAEvec3read = columnPCAEvec3read.strip() if(i == 4): columnPCAPhenoRead = saveFileObject.readline() columnPCAPhenoRead = columnPCAPhenoRead.strip() i = i + 1 #Creates a new plot when loaded PCAPlotterLoad = PCA.PCAPlotter() PCAPlotterLoad.readFile1(PCAPhenoRead) PCAPlotterLoad.readFile2(PCADataRead) PCAPlotterLoad.connectFilesAddColour(int(columnPCAEvec1read), int(columnPCAEvec2read), int(columnPCAEvec3read), int(columnPCAPhenoRead)) PCAPlotterLoad.plotGraph()
PCAData = "" PCAPheno = "" AdmixData = "" AdmixFam = "" AdmixPheno = "" #----------------------Colour Options------------------------------------------------ #Colors to be used within the plotted graphs colors = ['#0000FF', '#FF0000', '#008000', '#00FF00', '#FFFF00', '#00FFFF', '#008080', '#C0C0C0', '#FF00FF', '#800080', '#008000', '#000000'] #--------------------------------------------------------------------- # Instantiating the classes PCAplotter = PCA.PCAPlotter() AdmixPlotter = Admix.admixPlotter() # Takes the file directory chosen and gives it to the PCA object def importDataFilePCA(): global PCAData PCAData = askopenfilename(initialdir = "/",title = "Select file",filetypes = (("Data Files",".evec"),("all files","*.*"))) PCAplotter.readFile2(PCAData) # Takes the file directory chosen and gives it to the PCA object def importPhenoFilePCA(): global PCAPheno PCAPheno = askopenfilename(initialdir = "/",title = "Select file",filetypes = (("Phenotype Files","*.phe"),("all files","*.*"))) #plotter.readFile2('comm-SYMCL.pca.evec') PCAplotter.readFile1(PCAPheno)