comparison extract_genomic_dna.py @ 2:702970e4a134 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/extract_genomic_dna commit 9192c1e90e2fd5017e6044884bcc6f2e80ba8b31
author iuc
date Wed, 09 Mar 2016 05:07:21 -0500
parents 8dd8e89c0603
children b71579ad576c
comparison
equal deleted inserted replaced
1:9af3f57e50b9 2:702970e4a134
15 parser.add_argument('--interpret_features', dest='interpret_features', default=None, help="Interpret features if input format is gff") 15 parser.add_argument('--interpret_features', dest='interpret_features', default=None, help="Interpret features if input format is gff")
16 parser.add_argument('--columns', dest='columns', help="Columns to use in input file") 16 parser.add_argument('--columns', dest='columns', help="Columns to use in input file")
17 parser.add_argument('--reference_genome_source', dest='reference_genome_source', help="Source of reference genome file") 17 parser.add_argument('--reference_genome_source', dest='reference_genome_source', help="Source of reference genome file")
18 parser.add_argument('--reference_genome', dest='reference_genome', help="Reference genome file") 18 parser.add_argument('--reference_genome', dest='reference_genome', help="Reference genome file")
19 parser.add_argument('--output_format', dest='output_format', help="Output format") 19 parser.add_argument('--output_format', dest='output_format', help="Output format")
20 parser.add_argument('--fasta_header_type', dest='fasta_header_type', default=None, help="Fasta header format")
21 parser.add_argument('--fasta_header_delimiter', dest='fasta_header_delimiter', default=None, help="Fasta header field delimiter")
20 parser.add_argument('--output', dest='output', help="Output dataset") 22 parser.add_argument('--output', dest='output', help="Output dataset")
21 args = parser.parse_args() 23 args = parser.parse_args()
22 24
23 input_is_gff = args.input_format == 'gff' 25 input_is_gff = args.input_format == 'gff'
24 interpret_features = input_is_gff and args.interpret_features == "yes" 26 interpret_features = input_is_gff and args.interpret_features == "yes"
156 if args.output_format == "fasta": 158 if args.output_format == "fasta":
157 l = len(sequence) 159 l = len(sequence)
158 c = 0 160 c = 0
159 if input_is_gff: 161 if input_is_gff:
160 start, end = egdu.convert_bed_coords_to_gff([start, end]) 162 start, end = egdu.convert_bed_coords_to_gff([start, end])
161 fields = [args.genome, str(chrom), str(start), str(end), strand] 163 if args.fasta_header_type == "bedtools_getfasta_default":
162 meta_data = "_".join(fields) 164 out.write(">%s\n" % egdu.get_bedtools_getfasta_default_header(str(chrom),
163 if name.strip(): 165 str(start),
164 out.write(">%s %s\n" % (meta_data, name)) 166 str(end),
165 else: 167 strand,
166 out.write(">%s\n" % meta_data) 168 includes_strand_col))
169 else:
170 # args.fasta_header_type == "char_delimited":
171 fields = [args.genome, str(chrom), str(start), str(end), strand]
172 field_delimiter = egdu.get_fasta_header_delimiter(args.fasta_header_delimiter)
173 meta_data = field_delimiter.join(fields)
174 if name.strip():
175 out.write(">%s %s\n" % (meta_data, name))
176 else:
177 out.write(">%s\n" % meta_data)
167 while c < l: 178 while c < l:
168 b = min(c + 50, l) 179 b = min(c + 50, l)
169 out.write("%s\n" % str(sequence[c:b])) 180 out.write("%s\n" % str(sequence[c:b]))
170 c = b 181 c = b
171 else: 182 else:
179 feature.score, 190 feature.score,
180 feature.strand, 191 feature.strand,
181 ".", 192 ".",
182 egdu.gff_attributes_to_str(feature.attributes, "GTF")]) 193 egdu.gff_attributes_to_str(feature.attributes, "GTF")])
183 else: 194 else:
184 # Where is fields being set here? 195 # Here fields was set up around line 73.
185 meta_data = "\t".join(fields) 196 meta_data = "\t".join(fields)
186 if input_is_gff: 197 if input_is_gff:
187 format_str = "%s seq \"%s\";\n" 198 format_str = "%s seq \"%s\";\n"
188 else: 199 else:
189 format_str = "%s\t%s\n" 200 format_str = "%s\t%s\n"