--quality=<quality> Trimming quality [default: 20] --adapter=<adapter> Adapter sequence [default: AGATCGGAAGAGC] --path=<path> Path to cutadapt [default: cutadapt] --help Output this message """ # Import required modules import os from ngs_python.fastq import fastqFind, fastqTrim from general_python import docopt, toolbox, moab # Extract and process arguments args = docopt.docopt(__doc__,version = 'v1') args['--quality'] = int(args['--quality']) inDir, inPrefix = os.path.split(args['<inprefix>']) toolbox.checkArg(args['--path'], 'exc') # Extract fastq files and generate output file names read1In, read2In = fastqFind.findFastq(prefix = inPrefix, dirList = [inDir], pair = True, gzip = True) read1Out = args['<outprefix>'] + '.R1.fastq.gz' read2Out = args['<outprefix>'] + '.R2.fastq.gz' trimLog = args['<outprefix>'] + '.log' # Generate and submit trim command trimCommand = fastqTrim.cutadaptTrimPaired(read1In = read1In, read2In = read2In, read1Out = read1Out, read2Out = read2Out, quality = args['--quality'], adapter = 'AGATCGGAAGAGC', length = 25, path = args['--path'] ) jobID = moab.submitJob(trimCommand, stdout = trimLog, stderr = trimLog) print jobID
""" # Import required modules import os from ngs_python.fastq import fastqFind, fastqTrim from general_python import docopt, toolbox, moab # Extract and process arguments args = docopt.docopt(__doc__, version='v1') args['--quality'] = int(args['--quality']) inDir, inPrefix = os.path.split(args['<inprefix>']) toolbox.checkArg(args['--path'], 'exc') # Extract fastq files and generate output file names read1In, read2In = fastqFind.findFastq(prefix=inPrefix, dirList=[inDir], pair=True, gzip=True) read1Out = args['<outprefix>'] + '.R1.fastq.gz' read2Out = args['<outprefix>'] + '.R2.fastq.gz' trimLog = args['<outprefix>'] + '.log' # Generate and submit trim command trimCommand = fastqTrim.cutadaptTrimPaired(read1In=read1In, read2In=read2In, read1Out=read1Out, read2Out=read2Out, quality=args['--quality'], adapter='AGATCGGAAGAGC', length=25, path=args['--path']) jobID = moab.submitJob(trimCommand, stdout=trimLog, stderr=trimLog) print jobID
# Find FASTQ files by prefix if args['prefix']: indir, prefix = os.path.split(args['<prefix>']) print indir, prefix args['<infastq>'] = fastqFind.findFastq(prefix = prefix, dirList = [indir], pair = False) args['<infastq>'].sort() # Check number of FASTQ files if len(args['<infastq>']) < 2: sys.exit('\nCannot concatenate %s files\n' %(len(args['<infastq>']))) # Check output file doesnt exist if os.path.isfile(args['<outfastq>']): sys.exit('\nOutput file exists. No command submitted\n') # Print input and out files print '\nInput files:\n%s\n\nOutput file:\n%s\n' %( '\n'.join(args['<infastq>']), args['<outfastq>']) # Get user response before concatenation print "Enter 'concat' to concatenate: " response = raw_input() # Submit command if response == 'concat': # Create and submit command command = 'zcat %s | gzip > %s' %( ' '.join(args['<infastq>']), args['<outfastq>'] ) moabID = moab.submitJob(command) print '\n%s\n' %(moabID) else: print '\nNo command submitted\n'
inDir, inPrefix = os.path.split(args['<inprefix>']) outDir = os.path.join(args['<outdir>'], args['<samplename>']) if not os.path.isdir(outDir): os.mkdir(outDir) outPrefix = os.path.join(outDir, args['<samplename>']) outLog = outPrefix + '.rsem.log' # Create job dictionary # Extract fastq files and generate output file names read1, read2 = fastqFind.findFastq(prefix=inPrefix, dirList=[inDir], pair=True, gzip=True) rsemCommand = fastqAlign.rsemBowtie2Align(index=args['<index>'], outPrefix=outPrefix, read1=read1, read2=read2, rsemPath=args['--rsem'], bowtie2Path=args['--bowtie2'], threads=args['--threads'], forProb=args['--forprob'], genomeBam=args['--genomebam'], estimateRspd=False, check=True) print rsemCommand jobID = moab.submitJob(rsemCommand, processor=args['--threads'], stdout=outLog, stderr=outLog) print args['<samplename>'], jobID
""" # Import required modules import os from ngs_python.fastq import fastqFind, fastqAlign from general_python import docopt, toolbox, moab # Extract and process arguments args = docopt.docopt(__doc__,version = 'v1') args['--threads'] = int(args['--threads']) args['--forprob'] = float(args['--forprob']) toolbox.check_var(args['--forprob'], 'num', mn = 0, mx = 1) inDir, inPrefix = os.path.split(args['<inprefix>']) outDir = os.path.join(args['<outdir>'], args['<samplename>']) if not os.path.isdir(outDir): os.mkdir(outDir) outPrefix = os.path.join(outDir, args['<samplename>']) outLog = outPrefix + '.rsem.log' # Create job dictionary # Extract fastq files and generate output file names read1, read2 = fastqFind.findFastq(prefix = inPrefix, dirList = [inDir], pair = True, gzip = True) rsemCommand = fastqAlign.rsemBowtie2Align(index = args['<index>'], outPrefix = outPrefix, read1 = read1, read2 = read2, rsemPath = args['--rsem'], bowtie2Path = args['--bowtie2'], threads = args['--threads'], forProb = args['--forprob'], genomeBam = args['--genomebam'], estimateRspd = False, check = True) print rsemCommand jobID = moab.submitJob(rsemCommand, processor = args['--threads'], stdout = outLog, stderr = outLog) print args['<samplename>'], jobID