diff extract_genomic_dna_utils.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
line wrap: on
line diff
--- a/extract_genomic_dna_utils.py	Wed Jan 20 09:49:37 2016 -0500
+++ b/extract_genomic_dna_utils.py	Wed Mar 09 05:07:21 2016 -0500
@@ -292,6 +292,39 @@
         stop_err('Error running faToTwoBit. ' + str(e))
 
 
+def get_bedtools_getfasta_default_header(chrom, start, end, strand, includes_strand_col):
+    """
+    Return a fasta header that is the default produced by the bedtools
+    getfasta tool, assuming "force strandedness".  This will produce a
+    header with this format: <chrom>:<start>-<end>(strand).  If the input
+    data includes a strand column and the strand is '+' or '-', then use it.
+    If the input data includes a strand column and the value of strand is
+    anything but '+' or '-', set strand to '.' in the header.  If the input
+    data does not include a strand column, set strand to '.' in the header.
+    """
+    if includes_strand_col and strand in ['+', '-']:
+        strand_val = strand
+    else:
+        strand_val = '.'
+    return '%s:%s-%s(%s)' % (chrom, start, end, strand_val)
+
+
+def get_fasta_header_delimiter(delimiter):
+    # Return a specified fasta header delimiter.
+    if delimiter == 'underscore':
+        return '_'
+    if delimiter == 'semicolon':
+        return ';'
+    if delimiter == 'comma':
+        return ','
+    if delimiter == 'tilde':
+        return '~'
+    if delimiter == 'vertical_bar':
+        return '|'
+    # Set the default to underscore.
+    return '_'
+
+
 def get_lines(feature):
     # Get feature's line(s).
     if isinstance(feature, GFFFeature):