comparison extract_genomic_dna.py @ 3:b71579ad576c draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/extract_genomic_dna commit bd4fbe120288bf8452e479cbd82aa1bbf5c4bd31
author iuc
date Mon, 19 Dec 2016 11:57:37 -0500
parents 702970e4a134
children c8467246b57e
comparison
equal deleted inserted replaced
2:702970e4a134 3:b71579ad576c
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 import argparse 2 import argparse
3 import os 3 import os
4 4
5 import extract_genomic_dna_utils as egdu
6 import bx.seq.nib 5 import bx.seq.nib
7 import bx.seq.twobit 6 import bx.seq.twobit
8 from bx.intervals.io import Header, Comment 7 from bx.intervals.io import Comment, Header
9 8
9 import extract_genomic_dna_utils as egdu
10 10
11 parser = argparse.ArgumentParser() 11 parser = argparse.ArgumentParser()
12 parser.add_argument('--input_format', dest='input_format', help="Input dataset format") 12 parser.add_argument('--input_format', dest='input_format', help="Input dataset format")
13 parser.add_argument('--input', dest='input', help="Input dataset") 13 parser.add_argument('--input', dest='input', help="Input dataset")
14 parser.add_argument('--genome', dest='genome', help="Input dataset genome build") 14 parser.add_argument('--genome', dest='genome', help="Input dataset genome build")
108 nib = nibs[chrom] 108 nib = nibs[chrom]
109 else: 109 else:
110 nibs[chrom] = nib = bx.seq.nib.NibFile(open("%s/%s.nib" % (seq_path, chrom))) 110 nibs[chrom] = nib = bx.seq.nib.NibFile(open("%s/%s.nib" % (seq_path, chrom)))
111 try: 111 try:
112 sequence = nib.get(start, end - start) 112 sequence = nib.get(start, end - start)
113 except Exception, e: 113 except Exception as e:
114 warning = "Unable to fetch the sequence from '%d' to '%d' for build '%s'. " % (start, end - start, args.genome) 114 warning = "Unable to fetch the sequence from '%d' to '%d' for build '%s'. " % (start, end - start, args.genome)
115 warnings.append(warning) 115 warnings.append(warning)
116 if not invalid_lines: 116 if not invalid_lines:
117 invalid_lines = egdu.get_lines(feature) 117 invalid_lines = egdu.get_lines(feature)
118 first_invalid_line = line_count 118 first_invalid_line = line_count