Commits

Hanfei Sun  committed 8078b5d

Use global BG as one BG probability instead of 3 independent BG probability on 3 regions

  • Participants
  • Parent commits b47deb3

Comments (0)

Files changed (2)

File MPIPE/check_file.py

 #! /usr/bin/env python
-# Time-stamp: <2011-11-28 21:53:54 root>
+# Time-stamp: <2011-12-02 08:12:30 hanfei>
 
 """Module Description: Check integrity of input bed,xml and fasta files.
 
     @param fname: path of the file to be checked
     @type  check_3col_bed: bool
     @param check_3col_bed: whether to check 3 column bed in addition to normal 5 column bed
-    @rtype:   bool
-    @return:  whether the file passed the bed check
+    @rtype:   dict
+    @return:  whether the file's type is peak or summit, whether thr file is 3-column or 5-column format bed
     """                   
     if not check_common(fname,".bed",maxsize=107341824):
         return False
         lines = to_check.readlines()
         first_line,last_line = lines[0],lines[-1]
         is_5col_bed = lambda a_line:re.search("chr\S+\s\d+\s\d+\s\S+\s\d+[.]*[\d]*",a_line)
-        is_3col_bed = lambda a_line:re.search("chr\S+\s\d+\s\d+",a_line)
+        is_3col_bed = lambda a_line:re.search("chr\S+\s\d+\s\d+$",a_line)
 
         suffix_5col = lambda a_file: a_file+".5c.bed"
         def threetofive(fname):

File MPIPE/triple_SS.py

 #! /usr/bin/env python
-# Time-stamp: <2011-11-30 09:49:02 hanfei>
+# Time-stamp: <2011-12-02 07:27:13 hanfei>
 
 """Description: An executable for motif score comparing for left,right and middle regions.
 
     lt_fa, md_fa, rt_fa = (part_fa(i) for i in("left", "middle", "right"))
     fa_to_part = zip((lt_fa, rt_fa, md_fa), 
                    ("left", "right", "middle"))
+
+    seq_gc_dict={}
     for fa, part in fa_to_part:
         seq_record = SPI.fetch_seq_record(fa)
-        seq_gc = SPI.fetch_GC_percent(seq_record)
+        seq_gc_dict[part] = SPI.fetch_GC_percent(seq_record)
+    seq_gc=sum(seq_gc_dict.values())/3
+        
+    for fa, part in fa_to_part:        
         print debug_
         if debug_==True:
             info("debug mode on")