Search is not available for this dataset
text
stringlengths
75
104k
def down(self): """ Move this object down one position. """ self.swap(self.get_ordering_queryset().filter(order__gt=self.order))
def to(self, order): """ Move object to a certain position, updating all affected objects to move accordingly up or down. """ if order is None or self.order == order: # object is already at desired position return qs = self.get_ordering_queryset() ...
def above(self, ref): """ Move this object above the referenced object. """ if not self._valid_ordering_reference(ref): raise ValueError( "%r can only be moved above instances of %r which %s equals %r." % ( self, self.__class__, self.order_...
def below(self, ref): """ Move this object below the referenced object. """ if not self._valid_ordering_reference(ref): raise ValueError( "%r can only be moved below instances of %r which %s equals %r." % ( self, self.__class__, self.order_...
def top(self): """ Move this object to the top of the ordered stack. """ o = self.get_ordering_queryset().aggregate(Min('order')).get('order__min') self.to(o)
def bottom(self): """ Move this object to the bottom of the ordered stack. """ o = self.get_ordering_queryset().aggregate(Max('order')).get('order__max') self.to(o)
def unapi(request): """ This view implements unAPI 1.0 (see http://unapi.info). """ id = request.GET.get('id') format = request.GET.get('format') if format is not None: try: publications = Publication.objects.filter(pk=int(id)) if not publications: raise ValueError except ValueError: # inv...
def populate(publications): """ Load custom links and files from database and attach to publications. """ customlinks = CustomLink.objects.filter(publication__in=publications) customfiles = CustomFile.objects.filter(publication__in=publications) publications_ = {} for publication in publications: publication...
def make(data, samples): """ build a vcf file from the supercatg array and the cat.clust.gz output""" outfile = open(os.path.join(data.dirs.outfiles, data.name+".vcf"), 'w') inloci = os.path.join(data.dirs.outfiles, data.name+".loci") names = [i.name for i in samples] names.sort() ## TODO:...
def worker(self): """ Calculates the quartet weights for the test at a random subsampled chunk of loci. """ ## subsample loci fullseqs = self.sample_loci() ## find all iterations of samples for this quartet liters = itertools.product(*self.imap.values()) ## run tree inference fo...
def get_order(tre): """ return tree order """ anode = tre.tree&">A" sister = anode.get_sisters()[0] sisters = (anode.name[1:], sister.name[1:]) others = [i for i in list("ABCD") if i not in sisters] return sorted(sisters) + sorted(others)
def count_var(nex): """ count number of sites with cov=4, and number of variable sites. """ arr = np.array([list(i.split()[-1]) for i in nex]) miss = np.any(arr=="N", axis=0) nomiss = arr[:, ~miss] nsnps = np.invert(np.all(nomiss==nomiss[0, :], axis=0)).sum() return nomiss.shape[1], nsnp...
def sample_loci(self): """ finds loci with sufficient sampling for this test""" ## store idx of passing loci idxs = np.random.choice(self.idxs, self.ntests) ## open handle, make a proper generator to reduce mem with open(self.data) as indata: liter = (indata.read()....
def run_tree_inference(self, nexus, idx): """ Write nexus to tmpfile, runs phyml tree inference, and parses and returns the resulting tree. """ ## create a tmpdir for this test tmpdir = tempfile.tempdir tmpfile = os.path.join(tempfile.NamedTemporaryFile( ...
def run(self, ipyclient): """ parallelize calls to worker function. """ ## connect to parallel client lbview = ipyclient.load_balanced_view() ## iterate over tests asyncs = [] for test in xrange(self.ntests): ## ...
def plot(self): """ return a toyplot barplot of the results table. """ if self.results_table == None: return "no results found" else: bb = self.results_table.sort_values( by=["ABCD", "ACBD"], ascending=[False, True], ...
def plot(self, pcs=[1, 2], ax=None, cmap=None, cdict=None, legend=True, title=None, outfile=None): """ Do the PCA and plot it. Parameters --------- pcs: list of ints ... ax: matplotlib axis ... cmap: matplotlib colormap ... cdict: ...
def plot_pairwise_dist(self, labels=None, ax=None, cmap=None, cdict=None, metric="euclidean"): """ Plot pairwise distances between all samples labels: bool or list by default labels aren't included. If labels == True, then labels are read in from the vcf file. Al...
def copy(self): """ returns a copy of the pca analysis object """ cp = copy.deepcopy(self) cp.genotypes = allel.GenotypeArray(self.genotypes, copy=True) return cp
def loci2cf(name, locifile, popdict, wdir=None, ipyclient=None): """ Convert ipyrad .loci file to an iqtree-pomo 'counts' file Parameters: ----------- name: A prefix name for output files that will be produced locifile: A .loci file produced by ipyrad. popdict: A p...
def loci2migrate(name, locifile, popdict, mindict=1): """ A function to build an input file for the program migrate from an ipyrad .loci file, and a dictionary grouping Samples into populations. Parameters: ----------- name: (str) The name prefix for the migrate formatted output file...
def update(assembly, idict, count): """ updates dictionary with the next .5M reads from the super long string phylip file. Makes for faster reading. """ data = iter(open(os.path.join(assembly.dirs.outfiles, assembly.name+".phy"), 'r')) ntax, nchar = data.next().strip().split() ...
def makephy(data, samples, longname): """ builds phy output. If large files writes 50000 loci at a time to tmp files and rebuilds at the end""" ## order names names = [i.name for i in samples] names.sort() ## read in loci file locifile = os.path.join(data.dirs.outfiles, data.name+".loc...
def makenex(assembly, names, longname, partitions): """ PRINT NEXUS """ ## make nexus output data = iter(open(os.path.join(assembly.dirs.outfiles, assembly.name+".phy" ), 'r' )) nexout = open(os.path.join(assembly.dirs.outfiles, assembly.name+".nex" ), 'wb' ) ntax, nchar = data.next().strip().spli...
def make(assembly, samples): """ Make phylip and nexus formats. This is hackish since I'm recycling the code whole-hog from pyrad V3. Probably could be good to go back through and clean up the conversion code some time. """ ## get the longest name longname = max([len(i) for i in assembly.samp...
def sample_cleanup(data, sample): """ Clean up a bunch of loose files. """ umap1file = os.path.join(data.dirs.edits, sample.name+"-tmp-umap1.fastq") umap2file = os.path.join(data.dirs.edits, sample.name+"-tmp-umap2.fastq") unmapped = os.path.join(data.dirs.refmapping, sample.name+"-unmapped.bam"...
def index_reference_sequence(data, force=False): """ Index the reference sequence, unless it already exists. Also make a mapping of scaffolds to index numbers for later user in steps 5-6. """ ## get ref file from params refseq_file = data.paramsdict['reference_sequence'] index_files = [] ...
def mapreads(data, sample, nthreads, force): """ Attempt to map reads to reference sequence. This reads in the fasta files (samples.files.edits), and maps each read to the reference. Unmapped reads are dropped right back in the de novo pipeline. Reads that map successfully are processed and pushed...
def fetch_cluster_se(data, samfile, chrom, rstart, rend): """ Builds a single end cluster from the refmapped data. """ ## If SE then we enforce the minimum overlap distance to avoid the ## staircase syndrome of multiple reads overlapping just a little. overlap_buffer = data._hackersonly["min_SE...
def fetch_cluster_pairs(data, samfile, chrom, rstart, rend): """ Builds a paired cluster from the refmapped data. """ ## store pairs rdict = {} clust = [] ## grab the region and make tuples of info iterreg = samfile.fetch(chrom, rstart, rend) ## use dict to match up read pairs ...
def ref_build_and_muscle_chunk(data, sample): """ 1. Run bedtools to get all overlapping regions 2. Parse out reads from regions using pysam and dump into chunk files. We measure it out to create 10 chunk files per sample. 3. If we really wanted to speed this up, though it is pretty fast alrea...
def ref_muscle_chunker(data, sample): """ Run bedtools to get all overlapping regions. Pass this list into the func 'get_overlapping_reads' which will write fastq chunks to the clust.gz file. 1) Run bedtools merge to get a list of all contiguous blocks of bases in the reference seqeunce where one ...
def get_overlapping_reads(data, sample, regions): """ For SE data, this pulls mapped reads out of sorted mapped bam files and appends them to the clust.gz file so they fall into downstream (muscle alignment) analysis. For PE data, this pulls mapped reads out of sorted mapped bam files, splits ...
def split_merged_reads(outhandles, input_derep): """ Takes merged/concat derep file from vsearch derep and split it back into separate R1 and R2 parts. - sample_fastq: a list of the two file paths to write out to. - input_reads: the path to the input merged reads """ handle1, handle2 = ou...
def check_insert_size(data, sample): """ check mean insert size for this sample and update hackersonly.max_inner_mate_distance if need be. This value controls how far apart mate pairs can be to still be considered for bedtools merging downstream. """ ## pipe stats output to grep cmd1...
def bedtools_merge(data, sample): """ Get all contiguous genomic regions with one or more overlapping reads. This is the shell command we'll eventually run bedtools bamtobed -i 1A_0.sorted.bam | bedtools merge [-d 100] -i <input_bam> : specifies the input file to bed'ize -d <int> ...
def trim_reference_sequence(fasta): """ If doing PE and R1/R2 don't overlap then the reference sequence will be quite long and will cause indel hell during the alignment stage. Here trim the reference sequence to the length of the merged reads. Input is a list of alternating locus labels and se...
def bam_region_to_fasta(data, sample, proc1, chrom, region_start, region_end): """ Take the chromosome position, and start and end bases and return sequences of all reads that overlap these sites. This is the command we're building: samtools view -b 1A_sorted.bam 1:116202035-116202060 | \ ...
def refmap_stats(data, sample): """ Get the number of mapped and unmapped reads for a sample and update sample.stats """ ## shorter names mapf = os.path.join(data.dirs.refmapping, sample.name+"-mapped-sorted.bam") umapf = os.path.join(data.dirs.refmapping, sample.name+"-unmapped.bam") ...
def refmap_init(data, sample, force): """ create some file handles for refmapping """ ## make some persistent file handles for the refmap reads files sample.files.unmapped_reads = os.path.join(data.dirs.edits, "{}-refmap_derep.fastq".format(sample.name)) sample.files.m...
def parse_command_line(): """ Parse CLI args. Only three options now. """ ## create the parser parser = argparse.ArgumentParser( formatter_class=argparse.RawDescriptionHelpFormatter, epilog=""" * Example command-line usage ---------------------------------------------- * Read in seque...
def main(): """ main function """ ## parse params file input (returns to stdout if --help or --version) args = parse_command_line() print(HEADER.format(ip.__version__)) ## set random seed np.random.seed(args.rseed) ## debugger---------------------------------------- if os.path.exists(...
def _command_list(self): """ build the command list """ ## base args cmd = [self.params.binary, "-i", OPJ(self.workdir, self.name+".treemix.in.gz"), "-o", OPJ(self.workdir, self.name), ] ## addon params args = [] for key,...
def _subsample(self): """ returns a subsample of unlinked snp sites """ spans = self.maparr samp = np.zeros(spans.shape[0], dtype=np.uint64) for i in xrange(spans.shape[0]): samp[i] = np.random.randint(spans[i, 0], spans[i, 1], 1) return samp
def copy(self, name): """ Returns a copy of the treemix object with the same parameter settings but with the files attributes cleared, and with a new 'name' attribute. Parameters ---------- name (str): A name for the new copied treemix bject that wi...
def draw(self, axes): """ Returns a treemix plot on a toyplot.axes object. """ ## create a toytree object from the treemix tree result tre = toytree.tree(newick=self.results.tree) tre.draw( axes=axes, use_edge_lengths=True, ...
def _resolveambig(subseq): """ Randomly resolves iupac hetero codes. This is a shortcut for now, we could instead use the phased alleles in RAD loci. """ N = [] for col in subseq: rand = np.random.binomial(1, 0.5) N.append([_AMBIGS[i][rand] for i in col]) return np.array(N)
def _count_PIS(seqsamp, N): """ filters for loci with >= N PIS """ counts = [Counter(col) for col in seqsamp.T if not ("-" in col or "N" in col)] pis = [i.most_common(2)[1][1] > 1 for i in counts if len(i.most_common(2))>1] if sum(pis) >= N: return sum(pis) else: return 0
def write_nexus_files(self, force=False, quiet=False): """ Write nexus files to {workdir}/{name}/[0-N].nex, If the directory already exists an exception will be raised unless you use the force flag which will remove all files in the directory. Parameters: ----------- ...
def run(self, steps=None, ipyclient=None, force=False, quiet=False): """ Submits an ordered list of jobs to a load-balancer to complete the following tasks, and reports a progress bar: (1) Write nexus files for each locus (2) Run mrBayes on each locus to get a posterior of gene ...
def _write_nex(self, mdict, nlocus): """ function that takes a dictionary mapping names to sequences, and a locus number, and writes it as a NEXUS file with a mrbayes analysis block given a set of mcmc arguments. """ ## create matrix as a string max_name_len =...
def run_mbsum(self, ipyclient, force=False, quiet=False): """ Sums two replicate mrbayes runs for each locus """ minidir = os.path.realpath(os.path.join(self.workdir, self.name)) trees1 = glob.glob(os.path.join(minidir, "*.run1.t")) trees2 = glob.glob(os.path.join(minidir...
def run_mrbayes(self, ipyclient, force=False, quiet=False): """ calls the mrbayes block in each nexus file. """ ## get all the nexus files for this object minidir = os.path.realpath(os.path.join(self.workdir, self.name)) nexus_files = glob.glob(os.path.join(minidir, "*.n...
def run_bucky(self, ipyclient, force=False, quiet=False, subname=False): """ Runs bucky for a given set of parameters and stores the result to the ipa.bucky object. The results will be stored by default with the name '{name}-{alpha}' unless a argument is passed for 'subname' to ...
def _get_samples(self, samples): """ Internal function. Prelude for each step() to read in perhaps non empty list of samples to process. Input is a list of sample names, output is a list of sample objects.""" ## if samples not entered use all samples if not samples: samples = self.sample...
def _name_from_file(fname, splitnames, fields): """ internal func: get the sample name from any pyrad file """ ## allowed extensions file_extensions = [".gz", ".fastq", ".fq", ".fasta", ".clustS", ".consens"] base, _ = os.path.splitext(os.path.basename(fname)) ## remove read number from name ba...
def _read_sample_names(fname): """ Read in sample names from a plain text file. This is a convenience function for branching so if you have tons of sample names you can pass in a file rather than having to set all the names at the command line. """ try: with open(fname, 'r') as infile: ...
def _expander(namepath): """ expand ./ ~ and ../ designators in location names """ if "~" in namepath: namepath = os.path.expanduser(namepath) else: namepath = os.path.abspath(namepath) return namepath
def merge(name, assemblies): """ Creates and returns a new Assembly object in which samples from two or more Assembly objects with matching names are 'merged'. Merging does not affect the actual files written on disk, but rather creates new Samples that are linked to multiple data files, and with ...
def _bufcountlines(filename, gzipped): """ fast line counter. Used to quickly sum number of input reads when running link_fastqs to append files. """ if gzipped: fin = gzip.open(filename) else: fin = open(filename) nlines = 0 buf_size = 1024 * 1024 read_f = fin.read # loo...
def _zbufcountlines(filename, gzipped): """ faster line counter """ if gzipped: cmd1 = ["gunzip", "-c", filename] else: cmd1 = ["cat", filename] cmd2 = ["wc"] proc1 = sps.Popen(cmd1, stdout=sps.PIPE, stderr=sps.PIPE) proc2 = sps.Popen(cmd2, stdin=proc1.stdout, stdout=sps.PIPE, s...
def _tuplecheck(newvalue, dtype=str): """ Takes a string argument and returns value as a tuple. Needed for paramfile conversion from CLI to set_params args """ if isinstance(newvalue, list): newvalue = tuple(newvalue) if isinstance(newvalue, str): newvalue = newvalue.rstrip(")"...
def _paramschecker(self, param, newvalue): """ Raises exceptions when params are set to values they should not be""" if param == 'assembly_name': ## Make sure somebody doesn't try to change their assembly_name, bad ## things would happen. Calling set_params on assembly_name only raises ...
def stats(self): """ Returns a data frame with Sample data and state. """ nameordered = self.samples.keys() nameordered.sort() ## Set pandas to display all samples instead of truncating pd.options.display.max_rows = len(self.samples) statdat = pd.DataFrame([self.samples[...
def files(self): """ Returns a data frame with Sample files. Not very readable... """ nameordered = self.samples.keys() nameordered.sort() ## replace curdir with . for shorter printing #fullcurdir = os.path.realpath(os.path.curdir) return pd.DataFrame([self.samples[i].fil...
def _build_stat(self, idx): """ Returns a data frame with Sample stats for each step """ nameordered = self.samples.keys() nameordered.sort() newdat = pd.DataFrame([self.samples[i].stats_dfs[idx] \ for i in nameordered], index=nameordered)\ ...
def _link_fastqs(self, path=None, force=False, append=False, splitnames="_", fields=None, ipyclient=None): """ Create Sample objects from demultiplexed fastq files in sorted_fastq_path, or append additional fastq files to existing Samples. This provides more flexible file input t...
def _link_barcodes(self): """ Private function. Links Sample barcodes in a dictionary as [Assembly].barcodes, with barcodes parsed from the 'barcodes_path' parameter. This function is called during set_params() when setting the barcodes_path. """ ## parse barcode...
def _link_populations(self, popdict=None, popmins=None): """ Creates self.populations dictionary to save mappings of individuals to populations/sites, and checks that individual names match with Samples. The self.populations dict keys are pop names and the values are lists of len...
def get_params(self, param=""): """ pretty prints params if called as a function """ fullcurdir = os.path.realpath(os.path.curdir) if not param: for index, (key, value) in enumerate(self.paramsdict.items()): if isinstance(value, str): value = value...
def set_params(self, param, newvalue): """ Set a parameter to a new value. Raises error if newvalue is wrong type. Note ---- Use [Assembly].get_params() to see the parameter values currently linked to the Assembly object. Parameters ---------- pa...
def write_params(self, outfile=None, force=False): """ Write out the parameters of this assembly to a file properly formatted as input for `ipyrad -p <params.txt>`. A good and simple way to share/archive parameter settings for assemblies. This is also the function that's used by __main__...
def branch(self, newname, subsamples=None, infile=None): """ Returns a copy of the Assembly object. Does not allow Assembly object names to be replicated in namespace or path. """ ## subsample by removal or keeping. remove = 0 ## is there a better way to ask if i...
def _step1func(self, force, ipyclient): """ hidden wrapped function to start step 1 """ ## check input data files sfiles = self.paramsdict["sorted_fastq_path"] rfiles = self.paramsdict["raw_fastq_path"] ## do not allow both a sorted_fastq_path and a raw_fastq if sfiles ...
def _step2func(self, samples, force, ipyclient): """ hidden wrapped function to start step 2""" ## print header if self._headers: print("\n Step 2: Filtering reads ") ## If no samples in this assembly then it means you skipped step1, if not self.samples.keys(): ...
def _step3func(self, samples, noreverse, maxindels, force, ipyclient): """ hidden wrapped function to start step 3 """ ## print headers if self._headers: print("\n Step 3: Clustering/Mapping reads") ## Require reference seq for reference-based methods if self.params...
def _step4func(self, samples, force, ipyclient): """ hidden wrapped function to start step 4 """ if self._headers: print("\n Step 4: Joint estimation of error rate and heterozygosity") ## Get sample objects from list of strings samples = _get_samples(self, samples) ...
def _step5func(self, samples, force, ipyclient): """ hidden wrapped function to start step 5 """ ## print header if self._headers: print("\n Step 5: Consensus base calling ") ## Get sample objects from list of strings samples = _get_samples(self, samples) #...
def _step6func(self, samples, noreverse, force, randomseed, ipyclient, **kwargs): """ Hidden function to start Step 6. """ ## Get sample objects from list of strings samples = _get_samples(self, samples) ## remove ...
def _step7func(self, samples, force, ipyclient): """ Step 7: Filter and write output files """ ## Get sample objects from list of strings samples = _get_samples(self, samples) if self._headers: print("\n Step 7: Filter and write output files for {} Samples".\ ...
def _samples_precheck(self, samples, mystep, force): """ Return a list of samples that are actually ready for the next step. Each step runs this prior to calling run, makes it easier to centralize and normalize how each step is checking sample states. mystep is the state prod...
def _compatible_params_check(self): """ check for mindepths after all params are set, b/c doing it while each is being set becomes complicated """ ## do not allow statistical < majrule val1 = self.paramsdict["mindepth_statistical"] val2 = self.paramsdict['mindepth_majrule'] ...
def run(self, steps=0, force=False, ipyclient=None, show_cluster=0, **kwargs): """ Run assembly steps of an ipyrad analysis. Enter steps as a string, e.g., "1", "123", "12345". This step checks for an existing ipcluster instance otherwise it raises an exception. The ipyparallel ...
def _to_fulldict(self): """ Write to dict including data frames. All sample dicts are combined in save() to dump JSON output """ ## returndict = OrderedDict([ ("name", self.name), ("barcode", self.barcode), ("files", self.files), ...
def combinefiles(filepath): """ Joins first and second read file names """ ## unpack seq files in filepath fastqs = glob.glob(filepath) firsts = [i for i in fastqs if "_R1_" in i] ## check names if not firsts: raise IPyradWarningExit("First read files names must contain '_R1_'.") #...
def findbcode(cutters, longbar, read1): """ find barcode sequence in the beginning of read """ ## default barcode string for cutter in cutters[0]: ## If the cutter is unambiguous there will only be one. if not cutter: continue search = read1[1][:int(longbar[0]+len(cutter)...
def find3radbcode(cutters, longbar, read1): """ find barcode sequence in the beginning of read """ ## default barcode string for ambigcuts in cutters: for cutter in ambigcuts: ## If the cutter is unambiguous there will only be one. if not cutter: continue ...
def make_stats(data, perfile, fsamplehits, fbarhits, fmisses, fdbars): """ Write stats and stores to Assembly object. """ ## out file outhandle = os.path.join(data.dirs.fastqs, 's1_demultiplex_stats.txt') outfile = open(outhandle, 'w') ## write the header for file stats -------------------...
def barmatch2(data, tups, cutters, longbar, matchdict, fnum): """ cleaner barmatch func... """ ## how many reads to store before writing to disk waitchunk = int(1e6) ## pid name for this engine epid = os.getpid() ## counters for total reads, those with cutsite, and those that matched ...
def get_barcode_func(data, longbar): """ returns the fastest func given data & longbar""" ## build func for finding barcode if longbar[1] == 'same': if data.paramsdict["datatype"] == '2brad': def getbarcode(cutters, read1, longbar): """ find barcode for 2bRAD data """ ...
def get_quart_iter(tups): """ returns an iterator to grab four lines at a time """ if tups[0].endswith(".gz"): ofunc = gzip.open else: ofunc = open ## create iterators ofile1 = ofunc(tups[0], 'r') fr1 = iter(ofile1) quart1 = itertools.izip(fr1, fr1, fr1, fr1) if tups[...
def writetofastq(data, dsort, read): """ Writes sorted data 'dsort dict' to a tmp files """ if read == 1: rrr = "R1" else: rrr = "R2" for sname in dsort: ## skip writing if empty. Write to tmpname handle = os.path.join(data.dirs.fastqs, "{}_{}_....
def collate_files(data, sname, tmp1s, tmp2s): """ Collate temp fastq files in tmp-dir into 1 gzipped sample. """ ## out handle out1 = os.path.join(data.dirs.fastqs, "{}_R1_.fastq.gz".format(sname)) out = io.BufferedWriter(gzip.open(out1, 'w')) ## build cmd cmd1 = ['cat'] for tmpfil...
def prechecks2(data, force): """ A new simplified version of prechecks func before demux Checks before starting analysis. ----------------------------------- 1) Is there data in raw_fastq_path 2) Is there a barcode file 3) Is there a workdir and fastqdir 4) remove old fastq/tmp_sample_R...
def inverse_barcodes(data): """ Build full inverse barcodes dictionary """ matchdict = {} bases = set("CATGN") poss = set() ## do perfect matches for sname, barc in data.barcodes.items(): ## remove -technical-replicate-N if present if "-technical-replicate-" in sname: ...
def estimate_optim(data, testfile, ipyclient): """ Estimate a reasonable optim value by grabbing a chunk of sequences, decompressing and counting them, to estimate the full file size. """ ## count the len of one file and assume all others are similar len insize = os.path.getsize(testfile) ...
def run2(data, ipyclient, force): """ One input file (or pair) is run on two processors, one for reading and decompressing the data, and the other for demuxing it. """ ## get file handles, name-lens, cutters, and matchdict raws, longbar, cutters, matchdict = prechecks2(data, force) ## wra...
def _cleanup_and_die(data): """ cleanup func for step 1 """ tmpfiles = glob.glob(os.path.join(data.dirs.fastqs, "tmp_*_R*.fastq")) tmpfiles += glob.glob(os.path.join(data.dirs.fastqs, "tmp_*.p")) for tmpf in tmpfiles: os.remove(tmpf)
def run3(data, ipyclient, force): """ One input file (or pair) is run on two processors, one for reading and decompressing the data, and the other for demuxing it. """ start = time.time() ## get file handles, name-lens, cutters, and matchdict, ## and remove any existing files if a previou...
def splitfiles(data, raws, ipyclient): """ sends raws to be chunked""" ## create a tmpdir for chunked_files and a chunk optimizer tmpdir = os.path.join(data.paramsdict["project_dir"], "tmp-chunks-"+data.name) if os.path.exists(tmpdir): shutil.rmtree(tmpdir) os.makedirs(tmpdir) ## chun...