def check_logic(self): options, args = self.options, self.args if not options.vcf_fn: drdcommon.error("Need vcf file.") if options.vcf_fn == '-' and not drdcommon.data_in_stdin(): drdcommon.error("No data in stdin.") if not options.vcf_fn == '-' and not os.path.isfile(options.vcf_fn): drdcommon.error("Vcf file does not exists.") if options.coor_fn: if options.coor_fn == '-' and options.vcf_fn == '-': drdcommon.error("I cannot read two streams from stdin.") if not os.path.isfile(options.coor_fn): drdcommon.error("coor file does not exists.") options.drop = True options.coordinates_in_file = True else: options.coordinates_in_file = False if len(args) == 0: if options.wes: self.exp_type = 'wes' elif options.wgs: self.exp_type = 'wgs' else: self.exp_type = 'null' if not self.options.list_s_snps: drdcommon.error("Experiment type not set.") else: drdcommon.error("Incorrect # of params.")
def main(): args = parse_args() stream = drdcommon.xopen("-") if not drdcommon.data_in_stdin(): drdcommon.error(usage) print Saturation(stream, args.at_least_seen).csv("\t") stream.close()
def main(): if len(sys.argv) != 2: drdcommon.error("Wrong # of args", usage) if not drdcommon.data_in_stdin(): drdcommon.error("No data in stdin.", usage) ratios_stream = drdcommon.xopen("-") threshold = float(sys.argv[1]) CnvStateMachine(ratios_stream, threshold).run()
def main(): if len(sys.argv) != 1: drdcommon.error("Wrong # of args", usage) if not drdcommon.data_in_stdin(): drdcommon.error("No data in stdin.", usage) fd_vcf = drdcommon.xopen("-") do_work(fd_vcf) fd_vcf.close()
def main(): if not drdcommon.data_in_stdin(): drdcommon.error("I need a data stream in stdin.", usage="-") if not len(sys.argv) == 2: drdcommon.error("Wrong number of parameters", usage="-") title = sys.argv[1] x, y = process_data(drdcommon.xopen("-")) plot(x, y, title, xlabel="genomic window", ylabel="Average Read Depth")
def main(): if len(sys.argv) == 2: drdcommon.error("Wrong # of args", usage) if drdcommon.data_in_stdin() == False: drdcommon.error("Need data in stdin.", usage) fd_vcf = drdcommon.xopen("-") do_work(fd_vcf) fd_vcf.close()
def main(): if not drdcommon.data_in_stdin(): drdcommon.error("I need a data stream in stdin.", usage=_usage) if not len(sys.argv) == 4: drdcommon.error("Wrong number of parameters", usage=_usage) title, _xl, _yl = sys.argv[1:] x, y = process_data(drdcommon.xopen("-")) plot(x, y, title, xlabel=_xl, ylabel=_yl)
def main(): if len(sys.argv) != 2: drdcommon.error("Wrong # of args", usage) if not drdcommon.data_in_stdin(): drdcommon.error("No data in stdin.", usage) fd_vcf = drdcommon.xopen("-") w_size = int(sys.argv[1]) do_work(fd_vcf, w_size) fd_vcf.close()
def main(): if len(sys.argv) != 2: drdcommon.error("Wrong # of args", usage) if drdcommon.data_in_stdin() == False: drdcommon.error("Need data in stdin.", usage) min_num_samples = int(sys.argv[1]) fd_vcf = drdcommon.xopen("-") do_work(fd_vcf, min_num_samples) fd_vcf.close()
def main(): if len(sys.argv) != 2: drdcommon.error("Wrong # of args", usage) if not drdcommon.data_in_stdin(): drdcommon.error("No data in stdin.", usage) windows = drdcommon.xopen("-") bam_name = sys.argv[1] if not os.path.isfile(bam_name): drdcommon.error("Invalid bam file.", usage) compute_ratios(windows, bam_name)
return prev_end + random.randint(10000, 20000) def next_size(): return random.randint(100, 20000) def in_n_region(start, end, ref): num_ns, s, e = 0, int(start), int(end) _max = e-s/8 for i in range(s, e+1): if ref.exists(i): num_ns += 1 if num_ns > _max: return True return False if len(sys.argv) < 4 or not drdcommon.data_in_stdin(): sys.stderr.write("cat ref.fa | tool <n_events> <chrm> <chrm_size>" + "\n") sys.exit(1) _ = sys.argv n_events, chrm, chrm_size = int(_[1]), _[2], int(_[3]) # Store N locations sys.stderr.write("Loading N locations ..." + "\n") ref = BitMask() i = 0 for l in drdcommon.xopen("-"): if l[0] != '-': for c in l.rstrip(): if c.upper() == 'N': ref.set(i)
#!/usr/bin/env python import drdcommon import sys import re def help(msg): sys.stderr.write("ERROR: " + msg + "\n") sys.stderr.write("Usage: cat gtf.txt | tool list_genes_names.txt > genes.coor.bed\n") sys.exit(1) # Main if not drdcommon.data_in_stdin(): help("Need data in stdin") if len(sys.argv) != 2: help("Invalid list of arguments") gene_names = {} for l in drdcommon.xopen(sys.argv[1]): name = l.split()[0] gene_names[name] = True drdcommon.log("%s genes loaded." % len(gene_names)) for l in drdcommon.xopen("-"): s = l.split("\t") if s[2] == "CDS": chrm, start, end, _list = s[0], s[3], s[4], s[8] g_name, e_name, t_name = None, None, None for e in _list.split(";"):
#!/usr/bin/env python import drdcommon import sys import re def help(msg): sys.stderr.write("ERROR: " + msg + "\n") sys.stderr.write("Usage: cat gtf.txt | tool > exon.coor.bed\n") sys.exit(1) # Main if not drdcommon.data_in_stdin(): help("Need data in stdin") if len(sys.argv) != 1: help("Invalid list of arguments") for l in drdcommon.xopen("-"): s = l.split("\t") if s[2] == "CDS": chrm, start, end, _list = s[0], s[3], s[4], s[8] g_name, e_name, t_name = None, None, None for e in _list.split(";"): _ = e.split() if len(_) == 2 and _[0] == "transcript_name": t_name = re.sub('\"', '', _[1]) if len(_) == 2 and _[0] == "gene_name":
def next_size(): return random.randint(100, 20000) def in_n_region(start, end, ref): num_ns, s, e = 0, int(start), int(end) _max = e - s / 8 for i in range(s, e + 1): if ref.exists(i): num_ns += 1 if num_ns > _max: return True return False if len(sys.argv) < 4 or not drdcommon.data_in_stdin(): sys.stderr.write("cat ref.fa | tool <n_events> <chrm> <chrm_size>" + "\n") sys.exit(1) _ = sys.argv n_events, chrm, chrm_size = int(_[1]), _[2], int(_[3]) # Store N locations sys.stderr.write("Loading N locations ..." + "\n") ref = BitMask() i = 0 for l in drdcommon.xopen("-"): if l[0] != '-': for c in l.rstrip(): if c.upper() == 'N': ref.set(i)