from datasetsToTranscriptList import datasetToListOfTranscripts path = sys.argv[1] filenameList = os.listdir(path) filenames = [] for filename in filenameList: filenames.append(filename) filenames.sort() filenameToDataset = dict() for filename in filenames: filenameToDataset[filename] = parser.parseNameToGene(open(path + filename, 'r')) transcriptList = datasetToListOfTranscripts(filenameToDataset) graph = dict() def computeLeastSquaresError(transcriptList, transcriptTupleA, transcriptTupleB): transcriptsA = transcriptList[transcriptTupleA] transcriptsB = transcriptList[transcriptTupleB] lse = 0 for filename in transcriptsA: transcriptA = transcriptsA[filename] transcriptB = transcriptsB[filename] lse += (transcriptA.relativePercent - transcriptB.relativePercent) ** 2 return lse
#!/usr/bin/env python2 import sys import parser filename = sys.argv[1] nameToGene = parser.parseNameToGene(open(filename, 'r')) geneName = sys.argv[2] gene = nameToGene[geneName] print gene from pylab import * figure(1, figsize=(6,6)) ax = axes([0.1, 0.1, 0.8, 0.8]) labels = [] percs = [] for transcript in gene.transcripts: labels.append(transcript.name) percs.append(transcript.percent*100) pie(percs, explode=None, labels=labels, autopct='%1.1f%%', shadow=True, startangle=90) title(geneName, bbox={'facecolor':'0.8', 'pad':5})