comparison extract_genomic_dna_utils.py @ 16:030691e5cc86 draft

Uploaded
author greg
date Thu, 03 Mar 2016 14:52:26 -0500
parents 1a10864abc1f
children 2a80b722679c
comparison
equal deleted inserted replaced
15:e70f5ca82b63 16:030691e5cc86
290 return seq_path 290 return seq_path
291 except Exception, e: 291 except Exception, e:
292 stop_err('Error running faToTwoBit. ' + str(e)) 292 stop_err('Error running faToTwoBit. ' + str(e))
293 293
294 294
295 def get_description_field_delimiter(description_field_delimiter): 295 def get_bedtools_getfasta_default_header(chrom, start, end, strand, includes_strand_col):
296 # Convert a word to an appropriate character. 296 """
297 if description_field_delimiter == 'underscore': 297 Return a fasta header that is the default produced by the bedtools
298 getfasta tool, assuming "force strandedness". This will produce a
299 header with this format: <chrom>:<start>-<end>(strand). If the input
300 data includes a strand column and the strand is '+' or '-', then use it.
301 If the input data includes a strand column and the value of strand is
302 anything but '+' or '-', set strand to '.' in the header. If the input
303 data does not include a strand column, set strand to '.' in the header.
304 """
305 if includes_strand_col and strand in ['+', '-']:
306 strand_val = strand
307 else:
308 strand_val = '.'
309 return '%s:%s-%s(%s)' % (chrom, start, end, strand_val)
310
311
312 def get_fasta_header_delimiter(delimiter):
313 # Return a specified fasta header delimiter.
314 if delimiter == 'underscore':
298 return '_' 315 return '_'
299 if description_field_delimiter == 'semicolon': 316 if delimiter == 'semicolon':
300 return ';' 317 return ';'
301 if description_field_delimiter == 'comma': 318 if delimiter == 'comma':
302 return ',' 319 return ','
303 if description_field_delimiter == 'tilda': 320 if delimiter == 'tilda':
304 return '~' 321 return '~'
305 if description_field_delimiter == 'vetical_bar': 322 if delimiter == 'vetical_bar':
306 return '|' 323 return '|'
307 # Set the default to underscore. 324 # Set the default to underscore.
308 return '_' 325 return '_'
309 326
310 327