a = open(File, 'r') for l in a.read().split('\n'): if l.strip() == "": continue lsep = l.split('\t') if lsep[3] in ['+', '-']: bed1 = Bed(lsep[0:3], strand=lsep[3]) bed2 = Bed(lsep[s:(s + 3)], strand=lsep[s + 3]) else: bed1 = Bed(lsep[0:3]) bed2 = Bed(lsep[s:(s + 3)]) yield (bed1, bed2, lsep) # annotation files db = "/home/yu68/bharat-interaction/new_lincRNA_data/all_RNAs-rRNA_repeat.txt" db_detail = "/home/yu68/bharat-interaction/new_lincRNA_data/Ensembl_mm9.genebed" db_repeat = "/home/yu68/bharat-interaction/new_lincRNA_data/mouse.repeat.txt" print >> sys.stderr, "Indexing annotation files..." ref_allRNA = DBI.init( db, "bed") # the DBI init file for bed6 file of all kinds of RNA ref_detail = DBI.init( db_detail, "bed" ) # the DBI init file for bed12 file of lincRNA and mRNA with intron, exon, UTR ref_repeat = DBI.init(db_repeat, "bed") print >> sys.stderr, "Start to update..." for l in read_interaction(sys.argv[1], 9): l[2][5:8] = annotation(l[0], ref_allRNA, ref_detail, ref_repeat) l[2][14:17] = annotation(l[1], ref_allRNA, ref_detail, ref_repeat) print "\t".join(l[2])
s: start column number for second part of interaction ''' a=open(File,'r') for l in a.read().split('\n'): if l.strip()=="": continue lsep=l.split('\t') if lsep[3] in ['+','-']: bed1=Bed(lsep[0:3],strand=lsep[3]) bed2=Bed(lsep[s:(s+3)],strand=lsep[s+3]) else: bed1=Bed(lsep[0:3]) bed2=Bed(lsep[s:(s+3)]) yield (bed1,bed2,lsep) # annotation files db="/home/yu68/bharat-interaction/new_lincRNA_data/all_RNAs-rRNA_repeat.txt" db_detail="/home/yu68/bharat-interaction/new_lincRNA_data/Ensembl_mm9.genebed" db_repeat="/home/yu68/bharat-interaction/new_lincRNA_data/mouse.repeat.txt" print >>sys.stderr, "Indexing annotation files..." ref_allRNA=DBI.init(db,"bed") # the DBI init file for bed6 file of all kinds of RNA ref_detail=DBI.init(db_detail,"bed") # the DBI init file for bed12 file of lincRNA and mRNA with intron, exon, UTR ref_repeat=DBI.init(db_repeat,"bed") print >>sys.stderr, "Start to update..." for l in read_interaction(sys.argv[1],7): l[2][3:6] = annotation(l[0],ref_allRNA,ref_detail,ref_repeat) l[2][10:13] = annotation(l[1],ref_allRNA,ref_detail,ref_repeat) print "\t".join(l[2])
s: start column number for second part of interaction ''' a=open(File,'r') for l in a.read().split('\n'): if l.strip()=="": continue lsep=l.split('\t') if lsep[3] in ['+','-']: bed1=Bed(lsep[0:3],strand=lsep[3]) bed2=Bed(lsep[s:(s+3)],strand=lsep[s+3]) else: bed1=Bed(lsep[0:3]) bed2=Bed(lsep[s:(s+3)]) yield (bed1,bed2,lsep) # annotation files db="/home/yu68/bharat-interaction/new_lincRNA_data/all_RNAs-rRNA_repeat.txt" db_detail="/home/yu68/bharat-interaction/new_lincRNA_data/Ensembl_mm9.genebed" db_repeat="/home/yu68/bharat-interaction/new_lincRNA_data/mouse.repeat.txt" print >>sys.stderr, "Indexing annotation files..." ref_allRNA=DBI.init(db,"bed") # the DBI init file for bed6 file of all kinds of RNA ref_detail=DBI.init(db_detail,"bed") # the DBI init file for bed12 file of lincRNA and mRNA with intron, exon, UTR ref_repeat=DBI.init(db_repeat,"bed") print >>sys.stderr, "Start to update..." for l in read_interaction(sys.argv[1],9): l[2][5:8] = annotation(l[0],ref_allRNA,ref_detail,ref_repeat) l[2][14:17] = annotation(l[1],ref_allRNA,ref_detail,ref_repeat) print "\t".join(l[2])