Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

variable event support #1

Open
PeterVenhuizen opened this issue Jan 9, 2018 · 4 comments
Open

variable event support #1

PeterVenhuizen opened this issue Jan 9, 2018 · 4 comments

Comments

@PeterVenhuizen
Copy link

Will variable SUPPA events be supported?

@EduEyras
Copy link
Member

EduEyras commented Jan 9, 2018 via email

@PeterVenhuizen
Copy link
Author

Hi Eduardo,

as of now I cannot use the suppa_to_bed.py script to generate the bed files for the RI events, because it expects 4 coordinates in the event_id, but the variable RI event_ids only contain the coordinates of the retained intron.
Running the suppa_to_bed.py with variable events thus gives me IndexErrors. I assume that I could run MoSEA if I generate the bed files myself, but I was wondering whether the suppa_to_bed.py script would be updated to support variable events.

Best
Peter

@EduEyras
Copy link
Member

EduEyras commented Jan 10, 2018 via email

@PeterVenhuizen
Copy link
Author

PeterVenhuizen commented Jan 10, 2018

I've written an updated version of the fun_RI_bedfile function, which supports variable events. I have thus far not extensively tested it, but it is able to generate the V1, V2, and V3 coordinates from the variable RI events. However, I think it will break if an variable RI event is given, but no ext_len, I have not yet tested for this.

The updated function is below. Feel free to use it.

def fun_RI_bedfile(in_file, out_file, len_ext, event, mediandiff):
	'''
	##ref: see Fig.2 suppa documentaion of RI e1 & s1..descriptions
	#https://bitbucket.org/regulatorygenomicsupf/suppa
	#Example event id: 
	#TIAL1|7073;RI:chr10:121336123:121336262-121336592:121336715:-
	'''

	fo = open(out_file, "a")

	variable = False
	ev_all = event.split(';')[1].split(':')
	if len(ev_all) == 6: #strict
		ev_type, ev_chr, s1, e1_s2, e2, ev_strand = event.split(';')[1].split(':')

		s1 = int(s1)
		e1, s2 = map(int, e1_s2.split('-'))
		e2 = int(e2)

	else: #variable
		ev_type, ev_chr, e1_s2, ev_strand = event.split(';')[1].split(':')
		variable = True

	e1, s2 = map(int, e1_s2.split('-'))

	if ev_strand == '+':
		V2 = "{}\t{}".format(e1, s2) 
		if len_ext or variable:
			V1 = "{}\t{}".format(e1 - len_ext, e1) 
			V3 = "{}\t{}".format(s2, s2 + len_ext)
		else: 
			V1 = "{}\t{}".format(s1, e1) 
			V3 = "{}\t{}".format(s2, e2) 

	elif ev_strand == "-":
		V2 = "{}\t{}".format(e1, s2) 
		s2 = s2 -1 #for 0-based correction

		if len_ext or variable:
			V1 = "{}\t{}".format(s2, s2 + len_ext)
			V3 = "{}\t{}".format(e1 - len_ext, e1)
		else:
			V1 = "{}\t{}".format(s2, e2) 
			V3 = "{}\t{}".format(s1, e1) 

	else:
		print("No strand information in file, for event: {}".format(event))
		sys.exit()

	fo.write("{}\t{}\t{};V1\t{}\t{}\n".format(ev_chr, V1, event, mediandiff, ev_strand))
	fo.write("{}\t{}\t{};V2\t{}\t{}\n".format(ev_chr, V2, event, mediandiff, ev_strand))
	fo.write("{}\t{}\t{};V3\t{}\t{}\n".format(ev_chr, V3, event, mediandiff, ev_strand))

	fo.close()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants