+ removed load_genomic dependency
authorFabio <fabio@congo.fml.local>
Thu, 2 Oct 2008 16:55:23 +0000 (18:55 +0200)
committerFabio <fabio@congo.fml.local>
Thu, 2 Oct 2008 16:55:23 +0000 (18:55 +0200)
doc/qpalma.tex
qpalma/SettingsParser.py
qpalma/sequence_utils.py

index b45cc64..a6e07e5 100644 (file)
@@ -215,6 +215,14 @@ yourself then you can use splice site predictions of any kind... as long as the
 prediction of one site is a real value.
 
 
+Dependencies so far
+
+SWIG
+numpy
+pythongrid
+genome_utils
+Genefinding
+
 \begin{thebibliography}{1}
 
 \bibitem[1]{DeBona08} 
index ab05a03..700c896 100644 (file)
@@ -72,6 +72,11 @@ def makeSettings(settings):
    except:
       print 'Error: num_splits has to be a positive integer'
 
+   try:
+      settings['prb_offset'] = int(settings['prb_offset'])
+   except:
+      print 'Error: prb_offset has to be a positive integer'
+
    settings['allowed_fragments'] = eval(settings['allowed_fragments'])
    settings['half_window_size']  = int(settings['half_window_size'])
 
index 8effa98..d0549eb 100644 (file)
@@ -25,8 +25,41 @@ import numpy
 
 from numpy.matlib import inf
 
-from Genefinding import *
-from genome_utils import load_genomic
+def load_genomic(chromosome, strand, start, stop, genome, one_based=True):
+   """
+   This function stems from Cheng Soon Ongs genome_utils package.
+   """
+
+   if (type(start)==numpy.ndarray) or (type(stop)==numpy.ndarray):
+      assert(len(start) == len(stop))
+      assert((start[1:]-stop[:-1]>0).all())
+      if strand == '+':
+          idx = xrange(len(start))
+      else:
+          idx = xrange(len(start)-1,-1,-1)
+
+      seq = ''.join([load_genomic(chromosome, strand, start[ix], stop[ix], genome)\
+                     for ix in idx])
+      return seq
+  
+      #fname = '/fml/ag-raetsch/share/databases/genomes/' + genome + '/' + chromosome + '.dna.flat'
+      fname = genome + '/' + chromosome + '.dna.flat'
+      f=file(fname)
+      if one_based:
+          f.seek(start-1)
+          str=f.read(stop-start+1)
+      else:
+          f.seek(start)
+          str=f.read(stop-start)
+  
+      if strand=='-':
+          return reverse_complement(str)
+      elif strand=='+':
+          return str
+      else:
+          print 'strand must be + or -'
+          raise KeyError
+
 
 extended_alphabet    = ['-','a','c','g','t','n','[',']']
 alphabet             = ['-','a','c','g','t','n']