def run(self): globalTempDir = self.getGlobalTempDir() ext = "pickle" files = iseqlib.getfiles(self.indir, ext) samples = [file.split('.')[0] for file in files] for sample in samples: samplefile = os.path.join(self.indir, "%s.%s"%(sample, ext)) sampledir = os.path.join(globalTempDir, sample) system("mkdir -p %s" %sampledir) if self.options.sampling: for i in xrange(self.options.numsam): #sampling a number of times samplingdir = os.path.join(sampledir, "%d" %i) system("mkdir -p %s" %samplingdir) self.addChildTarget( Sampling(samplefile, samplingdir, self.options) ) else: tempoutdir = os.path.join(sampledir, "0") system("mkdir -p %s" %tempoutdir) #filtering if selected Vs and/or selected Js were specified if self.options.vs or self.options.js: sampleObj = pickle.load( gzip.open(samplefile, "rb") ) subsample = iseqlib.filterSampleByGenes(sampleObj, self.options.vs, self.options.js) system("rm %s" %samplefile) pickle.dump( subsample, gzip.open(samplefile, "wb") ) self.addChildTarget( Analyses(samplefile, tempoutdir, self.options) ) #Calculate means & standard deviations of samplings self.setFollowOnTarget( AverageResults(globalTempDir, self.options) )
def filterSamples(indir, vs, js): if not vs and not js: return ext = 'pickle' files = iseqlib.getfiles(indir, ext) for file in files: filepath = os.path.join(indir, file) sample = pickle.load( gzip.open(filepath, "rb") ) subsample = iseqlib.filterSampleByGenes(sample, vs, js) system("rm %s" %filepath) pickle.dump(subsample, gzip.open(filepath, "wb")) return
def run(self): sample = pickle.load( gzip.open(self.samplefile, "rb") ) if self.options.uniq: subsample = iseqlib.samplingSample_weightedUniq(sample, self.size) #subsample = iseqlib.samplingSample_uniq(sample, self.size) else: subsample = iseqlib.samplingSample(sample, self.size) #filtering if selected Vs and/or selected Js were specified subsample = iseqlib.filterSampleByGenes(subsample, self.options.vs, self.options.js) pickle.dump(subsample, gzip.open(self.outfile, "wb"))
def run(self): globalTempDir = self.getGlobalTempDir() #sampling sample = pickle.load( gzip.open(self.samplefile, "rb") ) if self.options.uniq: subsample = iseqlib.samplingSample_weightedUniq(sample, size) else: subsample = iseqlib.samplingSample(sample, self.size) #filtering if selected Vs and/or selected Js were specified subsample = iseqlib.filterSampleByGenes(subsample, self.options.vs, self.options.js) picklefile = os.path.join(globalTempDir, "%s.pickle" %sample.name) pickle.dump(subsample, gzip.open(picklefile, "wb")) self.addChildTarget( Analyses(picklefile, self.outdir, self.options) )