def program_args(self): name = 'wespipeline' if not utils.GlobalParams( ).exp_name else utils.GlobalParams().exp_name rg = '@RG\\tID:' + name + '\\tSM:' + name + '\\tPL:illumina' args = [ 'bwa', 'mem', '-M', '-R', rg, '-t', FastqAlign().cpus, self.input()['reference']['fa'].path, self.input()['fastq']['fastq1'].path, ] if 'fastq_2' in self.input()['fastq']: args.append(self.input()['fastq']['fastq2'].path) args.append('-o') args.append(self.output().path) return args
def output(self): outputs = set() outputs.add( luigi.LocalTarget( os.path.join(utils.GlobalParams().base_dir, utils.GlobalParams().exp_name + ".fa.amb"))) outputs.add( luigi.LocalTarget( os.path.join(utils.GlobalParams().base_dir, utils.GlobalParams().exp_name + ".fa.ann"))) outputs.add( luigi.LocalTarget( os.path.join(utils.GlobalParams().base_dir, utils.GlobalParams().exp_name + ".fa.bwt"))) outputs.add( luigi.LocalTarget( os.path.join(utils.GlobalParams().base_dir, utils.GlobalParams().exp_name + ".fa.pac"))) outputs.add( luigi.LocalTarget( os.path.join(utils.GlobalParams().base_dir, utils.GlobalParams().exp_name + ".fa.sa"))) return outputs
def output(self): return { 'bam' : luigi.LocalTarget( \ path.join(utils.GlobalParams().base_dir, utils.GlobalParams().exp_name+'_nodup.bam')), 'metrics' : luigi.LocalTarget( \ path.join(utils.GlobalParams().base_dir, utils.GlobalParams().exp_name+'_MD.matrix')) }
def output(self): get_name = lambda x: os.path.splitext( os.path.basename(os.path.realpath(x)))[0] output_filename = get_name( self.input()['fastq']['fastq1'].path) + '.sam' if utils.GlobalParams().exp_name: output_filename = os.path.join( utils.GlobalParams().base_dir, utils.GlobalParams().exp_name + ".sam") return luigi.LocalTarget(output_filename)
def requires(self): if self.reference_local_file != '': dependencies = { 'program': utils.GetProgram(), 'file': utils.LocalFile(file=self.reference_local_file), } else: file = os.path.join(utils.GlobalParams().base_dir, utils.GlobalParams().exp_name + '.2bit') dependencies = { 'program': GetProgram(), 'file': utils.Wget(url=self.ref_url, output_file=file), } return dependencies
def requires(self): if self.from2bit == True: dependency = TwoBitToFa( reference_local_file=self.reference_local_file, ref_url=self.ref_url) else: if self.reference_local_file != '': dependency = utils.LocalFile(self.reference_local_file) else: out_file = luigi.LocalTarget( os.path.join(utils.GlobalParams().base_dir, utils.GlobalParams().exp_name + '.fa')) dependency = utils.Wget(url=self.ref_url, output_file=out_file) return dependency
def output(self): filename = lambda f: path.split(f)[-1].split('.')[0] return luigi.LocalTarget( path.join( utils.GlobalParams().base_dir, ''.join([filename(self.vcf1), '_vs_', filename(self.vcf2)]) + '.diff.sites_in_files'))
def requires(self): if self.accession_number != '' and self.fastq1_local_file == '' and self.fastq1_local_file == '': return SraToolkitFastq(accession_number=self.accession_number, paired_end=self.paired_end) dependencies = dict() if self.compressed == True: if self.fastq1_local_file != '': dependencies.update({'fastq1' : UncompressFastqgz( fastq_local_file=self.fastq1_local_file, fastq_url=self.fastq1_url, output_file='.'.join(self.fastq1_local_file.split('.')[:-1]))}) else: dependencies.update({'fastq1' : UncompressFastqgz( fastq_local_file=self.fastq1_local_file, fastq_url=self.fastq1_url, output_file=path.join(utils.GlobalParams().base_dir, 'hg19_1.fastq'))}) else: if self.fastq1_local_file != '': dependencies.update({'fastq1' : utils.LocalFile(file=self.fastq1_local_file)}) else: dependencies.update({'fastq1' : utils.Wget(url=self.fastq1_url, output_file=path.join(utils.GlobalParams().base_dir, 'hg19_1.fastq'))}) if self.paired_end == True: if self.compressed == True: if self.fastq2_local_file != '': dependencies.update({'fastq2' : UncompressFastqgz( fastq_local_file=self.fastq2_local_file, fastq_url=self.fastq2_url, output_file='.'.join(self.fastq2_local_file.split('.')[:-1]))}) else: dependencies.update({'fastq2' : UncompressFastqgz( fastq_local_file=self.fastq2_local_file, fastq_url=self.fastq2_url, output_file=path.join(utils.GlobalParams().base_dir, 'hg19_2.fastq'))}) else: if self.fastq2_local_file != '': dependencies.update({'fastq2' : utils.LocalFile(file=self.fastq2_local_file)}) else: dependencies.update({'fastq2' : utils.Wget(url=self.fastq2_url, output_file=path.join(utils.GlobalParams().base_dir, 'hg19_2.fastq'))}) return dependencies
def program_args(self): filename = lambda f: path.split(f)[-1].split('.')[0] output_filename = path.join(utils.GlobalParams().base_dir, \ ''.join([filename(self.vcf1), '_vs_', filename(self.vcf2)])) return ['bash', '-c', \ f"vcftools --vcf {self.vcf2} --diff {self.vcf1} --diff-site " + \ "--chr chr1 --chr chr2 --chr chr3 --chr chr4 --chr chr5 --chr chr6 " + \ "--chr chr7 --chr chr8 --chr chr9 --chr chr10 --chr chr11 --chr chr12 " + \ "--chr chr13 --chr chr14 --chr chr15 --chr chr16 --chr chr17 --chr chr18 " + \ f"--chr chr20 --chr chr21 --chr chr22 --chr chrX --chr chrY --out {output_filename} 2> {output_filename}.log" ]
def output(self): return luigi.LocalTarget( os.path.join(utils.GlobalParams().base_dir, utils.GlobalParams().exp_name + '.fa'))
def output(self): program_file = os.path.join(utils.GlobalParams().base_dir, 'twoBitToFa') return luigi.LocalTarget(program_file)
def requires(self): program_file = os.path.join(utils.GlobalParams().base_dir, 'twoBitToFa') program_url = 'ftp://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/twoBitToFa' return utils.Wget(url=program_url, output_file=program_file)