Demo entry 6350022

my

   

Submitted by anonymous on Mar 02, 2017 at 20:36
Language: Python. Code size: 803 Bytes.

  1 |#!/usr/bin/env python
  2 |
  3 |import sys, re
  4 |for info in open("lumpy/deletion").readlines():
  5 |  s=info
  6 |  if not re.search(r'^#', s):
  7 |    edited_s=s.split('\t')
  8 |    chromosome_name=edited_s[0]
  9 |    start=edited_s[1]
 10 |    for data in edited_s:
 11 |      m_obj1=re.search(r'(SVTYPE)=([A-Z]+)', data)
 12 |      if m_obj1:
 13 |        sv_type=m_obj1.groups()[1]
 14 |	
 15 |      m_obj2=re.search(r'(END)=([0-9]+)', data)
 16 |      if m_obj2:
 17 |        ending=m_obj2.groups()[1]
 18 |        i_end=int(ending)
 19 |        i_start=int(start)
 20 |        size=i_end-i_start	
 21 |        fh=open("lumpy/del_output.txt", "a")
 22 |        sys.stdout=fh
 23 |        print chromosome_name, sv_type, start, ending, "REARRANGEMENT SIZE=", size

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).