OSCR

An in vivo parallelized reporter assay to uncover tissue-specific splicing regulatory sequences in a multicellular animal.

Code ↔ Paper

1 match between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 1 match
  1. [1] § Materials and methods › Phylogenetically averaged motif score analysis on C. elegans neuronal/muscle switch-like splicing events ↔ gff_exon-intron_annotations.py, lines 567–615 · score 0.68 · retained introns, skipped exons, ss exons, GFF, metadata, splicing event

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

Python · 736 lines · 44 KB · Apache-2.0 · 1 match

  1. import os
  2. import sys
  3. import numpy as np
  4. import matplotlib.pyplot as plt
  5. gff_file = sys.argv[1]
  6. keywords_file = sys.argv[2]
  7. intron_annot_file = sys.argv[3]
  8. exon_intron_annot_file = sys.argv[4]
  9. intron_cords_file = sys.argv[5]
  10. coordinate_type = sys.argv[6] # relative coordinates or absolute coordinates.
  11. median = int(sys.argv[7])
  12. # Depending on the length you want your sequences to be resized to, you can either choose to enter a length here
  13. # alternatively if you want to use the median length for resizing you can comment this out and use the code below on
  14. # median = round_to_nearest_multiple_of_10(median_size)
  15. # To keep it simple, I have used the variable name median and it depends on user to use the actual median size or
  16. # specify a length they'd like the introns to be resized to.
  17. # CAN BE CONVERTED TO BED FILE EASILY WITH EXCEL AND R - crdnts_to_bed.r ###
  18. #Simple logic here is if the exon spans an intron, it likely is a retained intron event whereas if an intron spans an exon, that's not an actual intron and gets filtered out by intron_filter().
  19. def retained_introns(model):
  20. model['splicing_event'] = np.nan
  21. exons = model[model['group'] == 'exon']
  22. introns = model[model['group'] == 'intron']
  23. exoncoords = set(map(tuple, exons[['start', 'end']].values))
  24. for index, row in introns.iterrows():
  25. for exon_start, exon_end in exoncoords:
  26. if exon_start < row['start'] and exon_end > row['end']:
  27. model.loc[index, 'splicing_event'] = 'retained intron'
  28. exon_to_delete = exons[(exons['start'] == exon_start) & (exons['end'] == exon_end)]
  29. model.loc[exon_to_delete.index, 'splicing_event'] = 'drop'
  30. # I am dropping those exons which aren't real exons but two exons flanking a retained intron.
  31. model = model[model['splicing_event'] != 'drop']
  32. return model
  33. def exon_cat(gene_model):
  34. group=gene_model[gene_model['group']=='exon']
  35. group.sort_values(by=['transcript_id'],inplace=True)
  36. group['transcript_id'] = group['transcript_id'].astype(str).str.replace('transcript_id=','')
  37. smallest_exon_start_tr = group.groupby(['transcript_id'])[['start','end']].min().reset_index()
  38. greatest_exon_end_tr = group.groupby(['transcript_id'])[['start','end']].max().reset_index()
  39. group['splicing_event'] = np.nan
  40. smallest_exon_rows = group[group[['transcript_id','start', 'end']].apply(tuple, axis=1).isin(smallest_exon_start_tr[['transcript_id','start', 'end']].apply(tuple, axis=1))]
  41. greatest_exon_rows = group[group[['transcript_id','start', 'end']].apply(tuple, axis=1).isin(greatest_exon_end_tr[['transcript_id','start', 'end']].apply(tuple, axis=1))]
  42. if '+' in group['strand'].unique():
  43. group.loc[smallest_exon_rows.index, 'splicing_event'] = 'first_exon'
  44. group.loc[greatest_exon_rows.index, 'splicing_event'] = 'last_exon'
  45. elif '-' in group['strand'].unique():
  46. group.loc[smallest_exon_rows.index, 'splicing_event'] = 'last_exon'
  47. group.loc[greatest_exon_rows.index, 'splicing_event'] = 'first_exon'
  48. excluded = group[
  49. (group['splicing_event'] == 'first_exon') |
  50. (group['splicing_event'] == 'last_exon')
  51. ][['start','end', 'transcript_id']]
  52. excluded_set = set(map(tuple, excluded.values))
  53. excluded_tuples = group[['start', 'end', 'transcript_id']].apply(tuple, axis=1).isin(excluded_set)
  54. filtered_group = group[~(excluded_tuples)]
  55. constitutive_alltrs_dic={}
  56. tr_numfilter = filtered_group['transcript_id'].nunique()
  57. alltrexons = filtered_group.groupby(['start','end'])['transcript_id'].count().reset_index(name='transcript_id_count')
  58. Const_overall_trs_condition = alltrexons[alltrexons['transcript_id_count'] == tr_numfilter]
  59. if not Const_overall_trs_condition.empty:
  60. constitutive_alltrs_tuples = set(Const_overall_trs_condition[['start', 'end']].itertuples(index=False, name=None))
  61. else:
  62. constitutive_alltrs_tuples=set()
  63. #Processing skipped and constitutive separately.
  64. first_exon_rows = group[group['splicing_event'] == 'first_exon']
  65. first_exon_tuples = first_exon_rows[['start','end','transcript_id']].apply(tuple, axis=1)
  66. # Grouping transcripts by first exons.
  67. tr_subgroup_df = first_exon_rows.groupby(['start','end'])['transcript_id'].apply(list).reset_index()
  68. tr_subgroup = tr_subgroup_df['transcript_id'].to_dict()
  69. skipped_dic = {}
  70. constitutive_dic = {}
  71. # group transcripts into sub-groups based on first exon and then locate the exon under question in the transcripts that have first exons coordinates smaller than exon in quesstion !
  72. # I am creating transcript subgroups with all exons except the first ones. Hence, I use filtered_group for subgroup.
  73. for key in tr_subgroup:
  74. subgroup = group[group['transcript_id'].isin(tr_subgroup[key])]
  75. tr_num = subgroup['transcript_id'].nunique()
  76. subgroup_filter =subgroup[~(subgroup['splicing_event']=='first_exon') & ~(subgroup['splicing_event']=='last_exon')]
  77. ex_counts = subgroup_filter.groupby(['start', 'end'])['transcript_id'].count().reset_index(name='transcript_id_count')
  78. skipped_condition = ex_counts[ex_counts['transcript_id_count'] < tr_num]
  79. skipped = list(skipped_condition[['start', 'end']].itertuples(index=False, name=None))
  80. skipped_dic[key] = skipped
  81. constitutive_condition = ex_counts[ex_counts['transcript_id_count'] == tr_num]
  82. constitutive = list((constitutive_condition[['start', 'end']].itertuples(index=False, name=None)))
  83. constitutive_dic[key]=constitutive
  84. # Next approach will be parsing out the true constitutive and skipped based on first exon coordinates.
  85. constitutive_true_dic={}
  86. constitutive_tuples_pre = set(tuple_ for tuples_list in constitutive_dic.values() for tuple_ in tuples_list)
  87. for coords in constitutive_tuples_pre:
  88. start, end = coords
  89. if '+' in first_exon_rows['strand'].unique():
  90. # With this line of code I am checking if the exon in question is an internal exon in any of the transcripts.
  91. # Only when I locate transcript block by its first exon and then if the exon in question is internal to it ( start > tup[1] (or first_exon end)) then, I extract the transcript_ids
  92. subset_condition = group.loc[
  93. group.apply(
  94. lambda row: any(start > tup[1]
  95. for tup in first_exon_tuples
  96. if ((row['end'] == tup[1]) & (row['splicing_event'] == 'first_exon'))
  97. ),axis=1)]
  98. trs = subset_condition['transcript_id'].unique()
  99. subset_trs = filtered_group[filtered_group['transcript_id'].isin(trs)]
  100. elif '-' in first_exon_rows['strand'].unique():
  101. subset_condition = group.loc[
  102. group.apply(
  103. lambda row: any(start < tup[1]
  104. for tup in first_exon_tuples
  105. if ((row['end'] == tup[1]) & (row['splicing_event'] == 'first_exon'))
  106. ),axis=1)]
  107. trs = subset_condition['transcript_id'].unique()
  108. subset_trs = filtered_group[filtered_group['transcript_id'].isin(trs)]
  109. second_ex_counts = subset_trs.groupby(['start', 'end'])['transcript_id'].count().reset_index(name='transcript_id_count')
  110. tr_num_subset = subset_trs['transcript_id'].nunique()
  111. skipped_sec_condition = second_ex_counts[second_ex_counts['transcript_id_count'] < tr_num_subset][['start','end']]
  112. if start in list(skipped_sec_condition['start']):
  113. skipped_dic[start]=[]
  114. skipped_dic[start].append(coords)
  115. const_real = second_ex_counts[second_ex_counts['transcript_id_count'] == tr_num_subset][['start','end']]
  116. if start in list(const_real['start']):
  117. constitutive_true_dic[start]=[]
  118. constitutive_true_dic[start].append(coords)
  119. skipped_tuples = set(tuple_ for tuples_list in skipped_dic.values() for tuple_ in tuples_list)
  120. constitutive_tuples = set(tuple_ for tuples_list in constitutive_true_dic.values() for tuple_ in tuples_list)
  121. #I am accounting for first and last exons here, they need to be excluded when I am trying to classify exons of other transcripts in which the first exon of trs1 might be a second or third exon.
  122. tr_num = filtered_group['transcript_id'].nunique()
  123. ex_1start_more_ends = filtered_group.groupby(['start']).filter(lambda g: g['end'].nunique() > 1)
  124. ex_1start_more_ends_count = ex_1start_more_ends.groupby(['start'])['transcript_id'].transform('count')
  125. composite_condition1 = ex_1start_more_ends[(ex_1start_more_ends_count < tr_num)]
  126. ex_1end_more_starts = filtered_group.groupby(['end']).filter(lambda g: g['start'].nunique() > 1)
  127. ex_1end_more_starts_count = ex_1end_more_starts.groupby(['end'])['transcript_id'].transform('count')
  128. composite_condition2 = ex_1end_more_starts[(ex_1end_more_starts_count < tr_num)]
  129. if '+' in group['strand'].unique():
  130. group.loc[group['start'].isin(ex_1start_more_ends['start']), 'splicing_event'] ='alt_5_prime'
  131. group.loc[group['end'].isin(ex_1end_more_starts['end']), 'splicing_event'] ='alt_3_prime'
  132. if len(composite_condition1)>0:
  133. group.loc[group['start'].isin(composite_condition1['start']), 'splicing_event'] ='composite_alt_5_skipped'
  134. if len(composite_condition2)>0:
  135. group.loc[group['end'].isin(composite_condition2['end']), 'splicing_event'] ='composite_alt_3_skipped'
  136. group.loc[group.apply(lambda row: (row['start'], row['end']) in skipped_tuples and pd.isna(row['splicing_event']), axis=1),
  137. 'splicing_event'] = 'skipped_exon'
  138. group.loc[group.apply(lambda row: ((row['start'], row['end']) in constitutive_tuples) and ((row['start'], row['end']) in constitutive_alltrs_tuples), axis=1),
  139. 'splicing_event'] = 'constitutive'
  140. group.loc[group.apply(lambda row: ((row['start'], row['end']) in constitutive_tuples) and not ((row['start'], row['end']) in constitutive_alltrs_tuples), axis=1),
  141. 'splicing_event'] = 'constitutive_totranscript'
  142. elif '-' in group['strand'].unique():
  143. group.loc[group['start'].isin(ex_1start_more_ends['start']), 'splicing_event'] ='alt_3_prime(-)'
  144. if len(composite_condition1)>0:
  145. group.loc[group['start'].isin(composite_condition1['start']), 'splicing_event'] ='composite_alt_3_skipped(-)'
  146. group.loc[group['end'].isin(ex_1end_more_starts['end']), 'splicing_event'] ='alt_5_prime(-)'
  147. if len(composite_condition2)>0:
  148. group.loc[group['end'].isin(composite_condition2['end']), 'splicing_event'] ='composite_alt_5_skipped(-)'
  149. group.loc[group.apply(lambda row: (row['start'], row['end']) in skipped_tuples and pd.isna(row['splicing_event']), axis=1),
  150. 'splicing_event'] = 'skipped_exon(-)'
  151. group.loc[group.apply(lambda row: ((row['start'], row['end']) in constitutive_tuples) and ((row['start'], row['end']) in constitutive_alltrs_tuples), axis=1),
  152. 'splicing_event'] = 'constitutive(-)'
  153. group.loc[group.apply(lambda row: ((row['start'], row['end']) in constitutive_tuples) and not ((row['start'], row['end']) in constitutive_alltrs_tuples), axis=1),
  154. 'splicing_event'] = 'constitutive_totranscript(-)'
  155. # This snippet is repeated so that some exons, which get labelled wrongly as any other events, even though they show those characteristics, to keep it simple, this will override and will always label such exons as first exons over any other thing.
  156. if '+' in group['strand'].unique():
  157. group.loc[smallest_exon_rows.index, 'splicing_event'] = 'first_exon'
  158. group.loc[greatest_exon_rows.index, 'splicing_event'] = 'last_exon'
  159. elif '-' in group['strand'].unique():
  160. group.loc[smallest_exon_rows.index, 'splicing_event'] = 'last_exon'
  161. group.loc[greatest_exon_rows.index, 'splicing_event'] = 'first_exon'
  162. gene_model = gene_model.merge(
  163. group[['start', 'end', 'splicing_event']],
  164. on=['start', 'end'],
  165. how='left'
  166. )
  167. gene_model['splicing_event'] = gene_model['splicing_event_y'].combine_first(gene_model['splicing_event_x'])
  168. gene_model.drop(['splicing_event_x', 'splicing_event_y'], axis=1, inplace=True)
  169. return gene_model
  170. def intron_filter(group):
  171. exon_condition = group[
  172. group['splicing_event'].astype(str).str.contains('constitutive') |
  173. group['splicing_event'].astype(str).str.contains('skipped_exon') |
  174. group['splicing_event'].astype(str).str.contains('first') |
  175. group['splicing_event'].astype(str).str.contains('last')]
  176. exon_range = set(exon_condition[['start','end']].itertuples(index=False, name=None))
  177. first_exons = group[group['splicing_event'].astype(str).str.contains('first')]
  178. last_exons = group[group['splicing_event'].astype(str).str.contains('last')]
  179. alt_3_exons = group[group['splicing_event'].astype(str).str.contains('alt_3')]
  180. alt_5_exons = group[group['splicing_event'].astype(str).str.contains('alt_5')]
  181. skipped_exons = group[group['splicing_event'].astype(str).str.contains('skipped_exon')]
  182. skipped_range = set(skipped_exons[['start', 'end']].itertuples(index=False, name=None))
  183. constitutive = group[group['splicing_event'].astype(str).str.contains('constitutive')]
  184. if '+' in group['strand'].unique():
  185. limitcoord_alt3 = alt_3_exons.groupby('end').apply(
  186. lambda group: group.loc[group['start'].idxmin()]
  187. ).reset_index(drop=True)
  188. limitcoord_alt5 = alt_5_exons.groupby('start').apply(
  189. lambda group: group.loc[group['end'].idxmax()]
  190. ).reset_index(drop=True)
  191. elif '-' in group['strand'].unique():
  192. limitcoord_alt5 = alt_5_exons.groupby('end').apply(
  193. lambda group: group.loc[group['start'].idxmin()]
  194. ).reset_index(drop=True)
  195. limitcoord_alt3 = alt_3_exons.groupby('start').apply(
  196. lambda group: group.loc[group['end'].idxmax()]
  197. ).reset_index(drop=True)
  198. group['correct_coords'] = np.nan
  199. introns = group[group['group']=='intron'].copy()
  200. for index, row in introns.iterrows():
  201. start, end, strand = row['start'], row['end'], row['strand']
  202. tr_id = row['transcript_id']
  203. is_in_exon_range = any(
  204. (exon_start <= end and exon_end >= start)
  205. for exon_start, exon_end in exon_range)
  206. if strand == '+':
  207. matches_first = ((start in (first_exons['end'] + 1).values) or (end in (first_exons['start'] - 1).values)) & (tr_id in first_exons['transcript_id'])
  208. matches_last = ((start in (last_exons['end'] + 1).values) or (end in (last_exons['start'] - 1).values)) & (tr_id in last_exons['transcript_id'])
  209. matches_alt3 = not limitcoord_alt3.empty and (
  210. end in (limitcoord_alt3['start'] - 1).values)
  211. matches_alt5 = not limitcoord_alt5.empty and (
  212. start in (limitcoord_alt5['end'] + 1).values)
  213. matches_constitutive = not constitutive.empty and (
  214. start in (constitutive['end'] + 1).values or end in (constitutive['start'] - 1).values)
  215. matches_skipped = not skipped_exons.empty and (
  216. start in (skipped_exons['end'] + 1).values or end in (skipped_exons['start'] - 1).values)
  217. elif (strand == '-'):
  218. matches_first = ((start in (first_exons['end'] + 1).values) or (end in (first_exons['start'] - 1).values)) & (tr_id in first_exons['transcript_id'])
  219. matches_last = ((start in (last_exons['end'] + 1).values) or (end in (last_exons['start'] - 1).values)) & (tr_id in last_exons['transcript_id'])
  220. matches_alt3 = not limitcoord_alt3.empty and (
  221. start in (limitcoord_alt3['end'] + 1).values)
  222. matches_alt5 = not limitcoord_alt5.empty and (
  223. end in (limitcoord_alt5['start'] - 1).values)
  224. matches_constitutive = not constitutive.empty and (
  225. start in (constitutive['end'] + 1).values or end in (constitutive['start'] - 1).values)
  226. matches_skipped = not skipped_exons.empty and (
  227. start in (skipped_exons['end'] + 1).values or end in (skipped_exons['start'] - 1).values)
  228. if (matches_alt3 or matches_alt5 or matches_constitutive or matches_skipped or matches_first or matches_last) and not is_in_exon_range:
  229. group.at[index, 'correct_coords'] = 'True'
  230. else:
  231. group.at[index, 'correct_coords'] = None
  232. for index, row in group.iterrows():
  233. type = row['group']
  234. if type == 'intron' and pd.isna(row['correct_coords']):
  235. group.drop(index, inplace=True)
  236. return group
  237. def intron_cat(group):
  238. introns = group[group['group']=='intron']
  239. first_int = group[group['splicing_event'].str.contains('first', na = False)][['start','end','strand','transcript_id']]
  240. last_int = group[group['splicing_event'].str.contains('last', na = False)][['start','end','strand','transcript_id']]
  241. for index, row in introns.iterrows():
  242. if (row['strand']=='+'):
  243. if (row['start'] in first_int['end'].values + 1) and (row['transcript_id'] in first_int['transcript_id'].values):
  244. current_val = group.at[index, 'splicing_event']
  245. group.at[index, 'splicing_event'] = f"{current_val}, first_intron" if pd.notna(current_val) else "first_intron"
  246. elif (row['end'] in last_int['start'].values - 1) and (row['transcript_id'] in last_int['transcript_id'].values):
  247. current_val = group.at[index, 'splicing_event']
  248. group.at[index, 'splicing_event'] = f"{current_val}, last_intron" if pd.notna(current_val) else "last_intron"
  249. elif (row['strand']=='-'):
  250. if (row['end'] in first_int['start'].values - 1) and (row['transcript_id'] in first_int['transcript_id'].values):
  251. current_val = group.at[index, 'splicing_event']
  252. group.at[index, 'splicing_event'] = f"{current_val}, first_intron(-)" if pd.notna(current_val) else "first_intron(-)"
  253. elif (row['start'] in last_int['end'].values + 1) and (row['transcript_id'] in last_int['transcript_id'].values):
  254. current_val = group.at[index, 'splicing_event']
  255. group.at[index, 'splicing_event'] = f"{current_val}, last_intron(-)" if pd.notna(current_val) else "last_intron(-)"
  256. constex_1 = group[group['splicing_event'].str.contains('constitutive',na=False)][['start','end','strand']]
  257. # Labels introns flanking constitutive exons on both strands
  258. for index, row in introns.iterrows():
  259. if (row['start'] in constex_1['end'].values + 1):
  260. if (row['strand']=='+'):
  261. group.at[index, 'splicing_event'] = 'constitutive_downstream'
  262. elif (row['strand']=='-'):
  263. group.at[index, 'splicing_event'] = 'constitutive_upstream(-)'
  264. elif (row['end'] in constex_1['start'].values - 1):
  265. if (row['strand']=='+'):
  266. group.at[index, 'splicing_event'] = 'constitutive_upstream'
  267. elif (row['strand']=='-'):
  268. group.at[index, 'splicing_event'] = 'constitutive_downstream(-)'
  269. constex = group[group['splicing_event'].str.contains('constitutive_totranscript',na=False)][['start','end','strand']]
  270. # Labels introns flanking constitutive exons grouped by first exon coords, on both strands
  271. for index, row in introns.iterrows():
  272. if (row['start'] in constex['end'].values + 1):
  273. if (row['strand']=='+'):
  274. group.at[index, 'splicing_event'] = 'constitutive_totranscript_downstream'
  275. elif (row['strand']=='-'):
  276. group.at[index, 'splicing_event'] = 'constitutive_totranscript_upstream(-)'
  277. elif (row['end'] in constex['start'].values - 1):
  278. if (row['strand']=='+'):
  279. group.at[index, 'splicing_event'] = 'constitutive_totranscript_upstream'
  280. elif (row['strand']=='-'):
  281. group.at[index, 'splicing_event'] = 'constitutive_totranscript_downstream(-)'
  282. # Labels introns flanking skipped exons on both strands
  283. skipex = group[group['splicing_event'].str.contains('skipped_exon',na=False)][['start','end','strand']]
  284. for index, row in introns.iterrows():
  285. if (row['start'] in skipex['end'].values + 1):
  286. if (row['strand']=='+'):
  287. current_val = group.at[index, 'splicing_event']
  288. if pd.notna(current_val):
  289. group.at[index, 'splicing_event'] = current_val + ', skipped_downstream'
  290. else:
  291. group.at[index, 'splicing_event'] = 'skipped_downstream'
  292. elif (row['strand']=='-'):
  293. current_val = group.at[index, 'splicing_event']
  294. if pd.notna(current_val):
  295. group.at[index, 'splicing_event'] = current_val + ', skipped_upstream(-)'
  296. else:
  297. group.at[index, 'splicing_event'] = 'skipped_upstream(-)'
  298. elif (row['end'] in skipex['start'].values - 1):
  299. if (row['strand']=='+'):
  300. current_val = group.at[index, 'splicing_event']
  301. if pd.notna(current_val):
  302. group.at[index, 'splicing_event'] = current_val + ', skipped_upstream'
  303. else:
  304. group.at[index, 'splicing_event'] = 'skipped_upstream'
  305. elif (row['strand']=='-'):
  306. current_val = group.at[index, 'splicing_event']
  307. if pd.notna(current_val):
  308. group.at[index, 'splicing_event'] = current_val + ', skipped_downstream(-)'
  309. else:
  310. group.at[index, 'splicing_event'] = 'skipped_downstream(-)'
  311. #Labels alternative 5'ss exon flanking introns on both strands:
  312. alt_5 = group[group['splicing_event'].str.contains('alt_5_prime',na=False)][['gene_id','group','start','end','strand','transcript_id']]
  313. alt_5_ex = alt_5[alt_5['group']=='exon']
  314. if '+' in alt_5['strand'].unique():
  315. alt5_ends = alt_5_ex.groupby(['gene_id', 'end', 'start'])['transcript_id'].nunique().reset_index()
  316. max_end_indices = alt5_ends.groupby(['gene_id', 'start'])['end'].idxmax() #Now I am only selecting the start and end coordinates which are #containing a greater end position i.e. the second 5'ss Because this is where the intron truly begins.
  317. alt5_grt_end = alt5_ends.loc[max_end_indices]
  318. elif '-' in alt_5['strand'].unique():
  319. alt_5_starts = alt_5_ex.groupby(['gene_id', 'end', 'start'])['transcript_id'].nunique().reset_index()
  320. min_start_indices = alt_5_starts.groupby(['gene_id', 'end'])['start'].idxmin()
  321. neg_alt_small_starts = alt_5_starts.loc[min_start_indices]
  322. for index, row in introns.iterrows():
  323. if (row['strand']=='+') and not alt_5.empty:
  324. if (row['start'] in alt5_grt_end['end'].values + 1):
  325. current_val = group.at[index, 'splicing_event']
  326. if pd.notna(current_val):
  327. group.at[index, 'splicing_event'] = current_val + ', alt_5_downstream'
  328. else:
  329. group.at[index, 'splicing_event'] = 'alt_5_downstream'
  330. elif (row['end'] in alt5_grt_end['start'].values - 1):
  331. current_val = group.at[index, 'splicing_event']
  332. if pd.notna(current_val):
  333. group.at[index, 'splicing_event'] = current_val + ', alt_5_upstream'
  334. else:
  335. group.at[index, 'splicing_event'] = 'alt_5_upstream'
  336. elif (row['strand']=='-') and not alt_5.empty:
  337. if (row['start'] in neg_alt_small_starts['end'].values + 1):
  338. current_val = group.at[index, 'splicing_event']
  339. if pd.notna(current_val):
  340. group.at[index, 'splicing_event'] = current_val + ', alt_5_upstream(-)'
  341. else:
  342. group.at[index, 'splicing_event'] = 'alt_5_upstream(-)'
  343. elif (row['end'] in neg_alt_small_starts['start'].values - 1):
  344. current_val = group.at[index, 'splicing_event']
  345. if pd.notna(current_val):
  346. group.at[index, 'splicing_event'] = current_val + ', alt_5_downstream(-)'
  347. else:
  348. group.at[index, 'splicing_event'] = 'alt_5_downstream(-)'
  349. #Labelling composite alternative 5'ss skipped exon flanking introns
  350. composite_alt_5 = group[group['splicing_event'].str.contains('composite_alt_5_skipped',na=False)][['gene_id','group','start','end','strand','transcript_id']]
  351. composite_alt_5_ex = composite_alt_5[composite_alt_5['group']=='exon']
  352. if '+' in composite_alt_5['strand'].unique():
  353. comp_alt5_ends = composite_alt_5_ex.groupby(['gene_id', 'end', 'start'])['transcript_id'].nunique().reset_index()
  354. comp_max_end_indices = comp_alt5_ends.groupby(['gene_id', 'start'])['end'].idxmax() #Now I am only selecting the start and end coordinates which are #containing a greater end position i.e. the second 5'ss Because this is where the intron truly begins.
  355. comp_alt5_grt_end = comp_alt5_ends.loc[comp_max_end_indices]
  356. elif '-' in composite_alt_5['strand'].unique():
  357. composite_alt_5_starts = composite_alt_5_ex.groupby(['gene_id', 'end', 'start'])['transcript_id'].nunique().reset_index()
  358. comp_min_start_indices = composite_alt_5_starts.groupby(['gene_id', 'end'])['start'].idxmin()
  359. comp_neg_alt_small_starts = composite_alt_5_starts.loc[comp_min_start_indices]
  360. for index, row in introns.iterrows():
  361. if (row['strand']=='+') and not composite_alt_5.empty:
  362. if (row['start'] in comp_alt5_grt_end['end'].values + 1):
  363. current_val = group.at[index, 'splicing_event']
  364. if pd.notna(current_val):
  365. group.at[index, 'splicing_event'] = current_val + ', composite_alt_5_downstream'
  366. else:
  367. group.at[index, 'splicing_event'] = 'composite_alt_5_downstream'
  368. elif (row['end'] in comp_alt5_grt_end['start'].values - 1):
  369. current_val = group.at[index, 'splicing_event']
  370. if pd.notna(current_val):
  371. group.at[index, 'splicing_event'] = current_val + ', composite_alt_5_upstream'
  372. else:
  373. group.at[index, 'splicing_event'] = 'composite_alt_5_upstream'
  374. elif (row['strand']=='-') and not composite_alt_5.empty:
  375. if (row['start'] in comp_neg_alt_small_starts['end'].values + 1):
  376. current_val = group.at[index, 'splicing_event']
  377. if pd.notna(current_val):
  378. group.at[index, 'splicing_event'] = current_val + ', composite_alt_5_upstream(-)'
  379. else:
  380. group.at[index, 'splicing_event'] = 'composite_alt_5_upstream(-)'
  381. elif (row['end'] in comp_neg_alt_small_starts['start'].values - 1):
  382. current_val = group.at[index, 'splicing_event']
  383. if pd.notna(current_val):
  384. group.at[index, 'splicing_event'] = current_val + ', composite_alt_5_downstream(-)'
  385. else:
  386. group.at[index, 'splicing_event'] = 'composite_alt_5_downstream(-)'
  387. #Labels alternative 5'ss exon flanking introns on both strands:
  388. alt_3 = group[group['splicing_event'].str.contains('alt_3_prime',na=False)][['gene_id','group','start','end','strand','transcript_id']]
  389. alt_3_ex = alt_3[alt_3['group']=='exon']
  390. if '+' in alt_3['strand'].unique():
  391. alt3_starts = alt_3_ex.groupby(['gene_id', 'end', 'start'])['transcript_id'].nunique().reset_index()
  392. min_start_indices = alt3_starts.groupby(['gene_id', 'end'])['start'].idxmin()
  393. alt3_small_starts = alt3_starts.loc[min_start_indices]
  394. elif '-' in alt_3['strand'].unique():
  395. N_alt3_ends = alt_3_ex.groupby(['gene_id', 'start', 'end'])['transcript_id'].nunique().reset_index()
  396. max_end_indices = N_alt3_ends.groupby(['gene_id', 'start'])['end'].idxmax()
  397. N_alt3_grt_end = N_alt3_ends.loc[max_end_indices]
  398. for index, row in introns.iterrows():
  399. if (row['strand']=='+') and not alt_3.empty:
  400. if (row['start'] in alt3_small_starts['end'].values + 1):
  401. current_val = group.at[index, 'splicing_event']
  402. if pd.notna(current_val):
  403. group.at[index, 'splicing_event'] = current_val + ', alt_3_downstream'
  404. else:
  405. group.at[index, 'splicing_event'] = 'alt_3_downstream'
  406. elif (row['end'] in alt3_small_starts['start'].values - 1):
  407. current_val = group.at[index, 'splicing_event']
  408. if pd.notna(current_val):
  409. group.at[index, 'splicing_event'] = current_val + ', alt_3_upstream'
  410. else:
  411. group.at[index, 'splicing_event'] = 'alt_3_upstream'
  412. elif (row['strand']=='-') and not alt_3.empty:
  413. if (row['start'] in N_alt3_grt_end['end'].values + 1):
  414. current_val = group.at[index, 'splicing_event']
  415. if pd.notna(current_val):
  416. group.at[index, 'splicing_event'] = current_val + ', alt_3_upstream(-)'
  417. else:
  418. group.at[index, 'splicing_event'] = 'alt_3_upstream(-)'
  419. elif (row['end'] in N_alt3_grt_end['start'].values - 1):
  420. current_val = group.at[index, 'splicing_event']
  421. if pd.notna(current_val):
  422. group.at[index, 'splicing_event'] = current_val + ', alt_3_downstream(-)'
  423. else:
  424. group.at[index, 'splicing_event'] = 'alt_3_downstream(-)'
  425. #Labelling composite alternative 3'ss skipped exon flanking introns
  426. composite_alt_3 = group[group['splicing_event'].str.contains('composite_alt_3_skipped',na=False)][['gene_id','group','start','end','strand','transcript_id']]
  427. composite_alt_3_ex = composite_alt_3[composite_alt_3['group']=='exon']
  428. if '+' in composite_alt_3['strand'].unique():
  429. comp_alt3_starts = composite_alt_3_ex.groupby(['gene_id', 'end', 'start'])['transcript_id'].nunique().reset_index()
  430. comp_min_start_indices = comp_alt3_starts.groupby(['gene_id', 'end'])['start'].idxmin()
  431. comp_alt3_small_starts = comp_alt3_starts.loc[comp_min_start_indices]
  432. elif '-' in composite_alt_3['strand'].unique():
  433. comp_N_alt3_ends = composite_alt_3_ex.groupby(['gene_id', 'start', 'end'])['transcript_id'].nunique().reset_index()
  434. comp_max_end_indices = comp_N_alt3_ends.groupby(['gene_id', 'start'])['end'].idxmax()
  435. comp_N_alt3_grt_end = comp_N_alt3_ends.loc[comp_max_end_indices]
  436. for index, row in introns.iterrows():
  437. if (row['strand']=='+') and not composite_alt_3.empty:
  438. if (row['start'] in comp_alt3_small_starts['end'].values + 1):
  439. current_val = group.at[index, 'splicing_event']
  440. if pd.notna(current_val):
  441. group.at[index, 'splicing_event'] = current_val + ', composite_alt_3_downstream'
  442. else:
  443. group.at[index, 'splicing_event'] = 'composite_alt_3_downstream'
  444. elif (row['end'] in comp_alt3_small_starts['start'].values - 1):
  445. current_val = group.at[index, 'splicing_event']
  446. if pd.notna(current_val):
  447. group.at[index, 'splicing_event'] = current_val + ', composite_alt_3_upstream'
  448. else:
  449. group.at[index, 'splicing_event'] = 'composite_alt_3_upstream'
  450. elif (row['strand']=='-') and not composite_alt_3.empty:
  451. if (row['start'] in comp_N_alt3_grt_end['end'].values + 1):
  452. current_val = group.at[index, 'splicing_event']
  453. if pd.notna(current_val):
  454. group.at[index, 'splicing_event'] = current_val + ', composite_alt_3_upstream(-)'
  455. else:
  456. group.at[index, 'splicing_event'] = 'composite_alt_3_upstream(-)'
  457. elif (row['end'] in comp_N_alt3_grt_end['start'].values - 1):
  458. current_val = group.at[index, 'splicing_event']
  459. if pd.notna(current_val):
  460. group.at[index, 'splicing_event'] = current_val + ', composite_alt_3_downstream(-)'
  461. else:
  462. group.at[index, 'splicing_event'] = 'composite_alt_3_downstream(-)'
  463. return group
  464. keywords = []
  465. import pandas as pd
  466. r2 = pd.read_csv(gff_file, sep='\t', names=['Chr', 'source', 'group', 'start', 'end', '_', 'strand', '-', 'info'])
  467. r2.dropna(axis=0, inplace=True)
  468. r2_Ex_Int = r2[(r2['group'] == 'exon') | (r2['group'] == 'intron')].copy()
  469. # r2_Ex_Int[['ID','Parent','gene_id', 'gene_symbol','transcript_id','transcript_symbol']] = r2_Ex_Int[
  470. # 'info'].str.split(';', expand=True) #- Drosophila gff has these entries in metadata column
  471. print('\n \\ The original gff dataframe. Parsing out the metadata column - info. \\\n')
  472. print(r2_Ex_Int.head(10))
  473. with open(keywords_file, 'r') as file:
  474. for w in file:
  475. keywords.append(str(w.rstrip()))
  476. # Converting metadata column identifiers (keywords) into columns and extracting relevant information.
  477. pattern = '|'.join(r'(?P<{}>{}=[^;]+)'.format(k, k) for k in keywords)
  478. extracted_info = r2_Ex_Int['info'].str.extractall(pattern)
  479. grouped_info = extracted_info.fillna('').astype(str).groupby(level=0).agg(lambda x: ';'.join(filter(None, x)))
  480. grouped_info.columns = [f'{col}' for col in grouped_info.columns]
  481. r2_Ex_Int = r2_Ex_Int.join(grouped_info, how='left')
  482. print('\n \\ Here\'s a glimpse of the modified gff dataframe. \\ \n')
  483. print(r2_Ex_Int.head(10))
  484. r2_Ex_Int.to_csv('gff_parsed_meta.csv', sep='\t')
  485. r2_Ex_Int.sort_values(by=['gene_id', 'start'], ascending=True, inplace=True)
  486. r2_Ex_Int.drop(labels='info', axis=1, inplace=True)
  487. r2_Ex_Int.loc[:, 'sort_order'] = r2_Ex_Int.apply(lambda x: x['start'] if x['strand'] == '+' else -x['start'], axis=1)
  488. r2_Ex_Int = r2_Ex_Int.sort_values(by=['sort_order'])
  489. r2_Ex_Int = r2_Ex_Int.drop(columns=['sort_order'])
  490. r2_Ex_Int['order_of_appearance'] = r2_Ex_Int.groupby(['group', 'transcript_id']).cumcount() + 1
  491. r2_Ex_Int_1 = r2_Ex_Int.groupby(['gene_id']).apply(lambda x: retained_introns(x))
  492. r2_Ex_Int_1.reset_index(drop=True, inplace=True)
  493. r2_Exons_annot_composite = r2_Ex_Int_1.groupby(['gene_id']).apply(lambda x: exon_cat(x))
  494. r2_Exons_annot_composite.reset_index(drop=True, inplace=True)
  495. retained_introns = len(r2_Exons_annot_composite[r2_Exons_annot_composite['splicing_event'] == 'retained intron'])
  496. constitutive = len(r2_Exons_annot_composite[r2_Exons_annot_composite['splicing_event'] == 'constitutive']) + len(r2_Exons_annot_composite[r2_Exons_annot_composite['splicing_event'] == 'constitutive(-)'])
  497. skipped = len(r2_Exons_annot_composite[r2_Exons_annot_composite['splicing_event'] == 'skipped_exon']) + len(r2_Exons_annot_composite[r2_Exons_annot_composite['splicing_event'] == 'skipped_exon(-)'])
  498. alt_5 = len(r2_Exons_annot_composite[r2_Exons_annot_composite['splicing_event'] == 'alt_5_prime']) + len(r2_Exons_annot_composite[r2_Exons_annot_composite['splicing_event'] == 'alt_5_prime(-)'])
  499. alt_3 = len(r2_Exons_annot_composite[r2_Exons_annot_composite['splicing_event'] == 'alt_3_prime']) + len(r2_Exons_annot_composite[r2_Exons_annot_composite['splicing_event'] == 'alt_3_prime(-)'])
  500. composite = len(r2_Exons_annot_composite[r2_Exons_annot_composite['splicing_event'] == 'composite_alt_3_skipped']) + len(r2_Exons_annot_composite[r2_Exons_annot_composite['splicing_event'] == 'composite_alt_3_skipped(-)']) + len(r2_Exons_annot_composite[r2_Exons_annot_composite['splicing_event'] == 'composite_alt_5_skipped']) + len(r2_Exons_annot_composite[r2_Exons_annot_composite['splicing_event'] == 'composite_alt_5_skipped(-)'])
  501. print(f'Total number of constitutive exons: {constitutive}')
  502. print(f'Total number of skipped exons: {skipped}')
  503. print(f'Total number of alternative 5\'ss exons: {alt_5}')
  504. print(f'Total number of alternative 3\'ss exons: {alt_3}')
  505. print(f'Total number of composite alternative 5\'ss or alternative 3\'ss containing and skipped exons: {composite}')
  506. print(f'Total number of retained introns: {retained_introns}')
  507. df_final = r2_Exons_annot_composite.groupby(['gene_id']).apply(lambda x: intron_filter(x))
  508. df_final.reset_index(drop=True, inplace=True)
  509. all_annot_df = df_final.groupby(['gene_id']).apply(lambda x: intron_cat(x))
  510. df_final.to_csv('./Exonslabelled_intronsnot.csv', sep='\t')
  511. print(all_annot_df.head(10))
  512. all_annot_df.reset_index(drop=True, inplace=True)
  513. all_annot_df.sort_values(by=['gene_id', 'transcript_id', 'order_of_appearance'], ascending=True, inplace=True)
  514. ############################################################# The functions below, scaled_coordinates () and scale_group () were written for cases where we only have sequence fasta files of orthologues and reference sps
  515. # For example, the analysis I did on C.elegans switch like splicing events. I had relative coordinates that were inferred from the fasta files. I didn't have absolute coordinates ######## If this isn't the case, the lines
  516. # where these functions are being called can be commented out. ##### The lines are only to represent everything in terms of sclaed or relative coordinates.#################################################################
  517. if coordinate_type == 'relative':
  518. def scale_coordinates(row, start, end):# removed strand from args, since same function works for both strands.
  519. max_length = start - end
  520. qstart = 0
  521. scaled_rstart = qstart + (row['start'] - start)
  522. scaled_rend = qstart + (row['end'] - start)
  523. return pd.Series([scaled_rstart, scaled_rend], index=['scaled_rstart', 'scaled_rend'])
  524. # Group by 'gene' and apply scaling function
  525. def scale_group(group):
  526. # For each group (gene), calculate min and max start and end, works for both strands since start and ends are always
  527. # smaller start and greater end, only the order in negative strand is reversed, i.e., exon with smallest start is the
  528. # last exon. Draw it out to avoid confusion.
  529. strand = group['strand'].iloc[0]
  530. min_rstart = group['start'].min()
  531. max_rend = group['end'].max()
  532. group[['scaled_rstart', 'scaled_rend']] = group.apply(scale_coordinates, axis=1, args=(min_rstart, max_rend))
  533. group = group.rename(columns={'start': 'absolute_start', 'end': 'absolute_end'})
  534. group = group.rename(columns={'scaled_rstart': 'start', 'scaled_rend': 'end'})
  535. return group
  536. # Assuming 'Parent' identifies different genes
  537. scaled_df = all_annot_df.groupby('Parent').apply(scale_group).reset_index(drop=True)
  538. # Assuming 'Parent' identifies different genes
  539. all_annot_Introns = scaled_df[scaled_df['group'] == 'intron']
  540. elif coordinate_type =='absolute':
  541. all_annot_Introns = all_annot_df[all_annot_df['group'] == 'intron']
  542. all_annot_Introns = all_annot_Introns.copy()
  543. #Unknown_Intron_indices = all_annot_Introns[all_annot_Introns['splicing_event_y_y'] == 'intron'].index
  544. #all_annot_Introns.drop(Unknown_Intron_indices, inplace=True)
  545. all_annot_Introns['ID'] = all_annot_Introns['Chr'].astype(str) + '_' + all_annot_Introns['start'].astype(str) + '_' + \
  546. all_annot_Introns['end'].astype(str)
  547. all_annot_Introns.groupby(['ID', 'gene_id', 'splicing_event'])['splicing_event'].nunique()
  548. Intron_df = all_annot_Introns
  549. # 1. Calculating size of introns
  550. all_annot_Introns['size'] = abs(all_annot_Introns['start'] - all_annot_Introns['end'])
  551. print('The median size of introns is : ')
  552. print(all_annot_Introns['size'].median())
  553. median_size = all_annot_Introns['size'].median()
  554. def round_to_nearest_multiple_of_10(number):
  555. return round(number / 10) * 10
  556. if median == 0:
  557. median = round_to_nearest_multiple_of_10(median_size)
  558. print('The introns bigger than the median size are being resized to - %d bp. \n' % median)
  559. # 2. Eliminating extremely small introns
  560. small_introns = all_annot_Introns[all_annot_Introns['size'] < 10].index
  561. all_annot_Introns = all_annot_Introns.drop(small_introns)
  562. # 3. Creating a separate dataframe for introns smaller than median bp in length
  563. Intron_size_median = all_annot_Introns[all_annot_Introns['size'] < median]
  564. # 4. Processing introns greater than median bp in length
  565. Intron_size_great_median = all_annot_Introns[all_annot_Introns['size'] >= median]
  566. Intron_size_great_median['End_medianbp_apart'] = Intron_size_great_median['start'] + median
  567. Intron_size_great_median['Start_medianbp_apart'] = Intron_size_great_median['end'] - median
  568. # Creating new ID columns for starting median bp and ending median bp of introns
  569. Intron_size_great_median['ID_Starting_median'] = Intron_size_great_median['Chr'].astype(str) + '_' + \
  570. Intron_size_great_median[
  571. 'strand'] + '_' + Intron_size_great_median['start'].astype(
  572. str) + '_' + Intron_size_great_median[
  573. 'End_medianbp_apart'].astype(str)
  574. Intron_size_great_median['ID_Ending_median'] = Intron_size_great_median['Chr'].astype(str) + '_' + \
  575. Intron_size_great_median[
  576. 'strand'] + '_' + Intron_size_great_median[
  577. 'Start_medianbp_apart'].astype(str) + '_' + Intron_size_great_median[
  578. 'end'].astype(str)
  579. merged_intron_df = pd.concat([Intron_size_great_median, Intron_size_median], ignore_index=True)
  580. merged_intron_df.drop_duplicates(inplace=True)
  581. merged_intron_df.to_csv(intron_annot_file, sep='\t')
  582. # Extracting the coordinates and arranging them based on their strands. ##
  583. # NOTE: THESE NEED TO BE CONVERTED TO BED FILE ###
  584. # CAN BE CONVERTED TO BED FILE EASILY WITH EXCEL AND R - GTF-to-bed.r###
  585. intron_beginningmedian = Intron_size_great_median[
  586. ['Parent','Chr','group', 'start', 'End_medianbp_apart', 'strand', 'ID_Starting_median']]
  587. intron_endingmedian = Intron_size_great_median[['Parent','Chr','group', 'Start_medianbp_apart', 'end', 'strand', 'ID_Ending_median']]
  588. small_intron_coordinates = Intron_size_median[['Parent','Chr','group', 'start', 'end', 'strand', 'ID']]
  589. intron_beginningmedian.rename(columns={'End_medianbp_apart': 'end', 'ID_Starting_median': 'ID'}, inplace=True)
  590. intron_endingmedian.rename(columns={'Start_medianbp_apart': 'start', 'ID_Ending_median': 'ID'}, inplace=True)
  591. big_introns = pd.concat([intron_beginningmedian, intron_endingmedian], ignore_index=True)
  592. all_intron_coordinates = pd.concat([small_intron_coordinates, big_introns], ignore_index=True)
  593. all_intron_coordinates.drop_duplicates(inplace=True)
  594. all_intron_coordinates.to_csv(intron_cords_file, sep='\t')
  595. if coordinate_type == 'relative':
  596. all_exon_coordinates = scaled_df[scaled_df['group']=='exon'][['gene_id','Parent','Chr','group','start', 'end','strand', 'ID']]
  597. all_coordinates = pd.concat([all_intron_coordinates, all_exon_coordinates], ignore_index=True)
  598. all_coordinates.sort_values(by=['gene_id', 'start'], ascending=[True, True], inplace=True)
  599. all_coordinates.to_csv('./CelsWS15_Exon_IntronFragment_coordinates_April2025.tsv', sep='\t', index=False)
  600. scaled_df.to_csv(exon_intron_annot_file, sep='\t')
  601. elif coordinate_type == 'absolute':
  602. all_exon_coordinates = all_annot_df[all_annot_df['group']=='exon'][['gene_id','Parent','Chr','group','start', 'end','strand', 'ID']]
  603. all_coordinates = pd.concat([all_intron_coordinates, all_exon_coordinates], ignore_index=True)
  604. all_coordinates.sort_values(by=['gene_id', 'start'], ascending=[True, True], inplace=True)
  605. all_coordinates.to_csv('./Exon_IntronFragment_April2025_coordinates.tsv', sep='\t', index=False)
  606. all_annot_df.to_csv(exon_intron_annot_file, sep='\t')
  607. # The end - this will give an annotated intron coordinates file which can be further analyzed in excel.###
  608. #%%

gff_exon-intron_annotations.py, under Apache-2.0 · at the source

Overview

Authors: Sanjana Bhatnagar1, Jade Ho1, Nour H Sadek1, Isha Singh1, Michael Zoberman1, Bina Koterniak1, Yufang Liu1, Daniel D Fusca2, Asher D Cutter2, Alan M Moses1, John A Calarco1
  1. Department of Cell and Systems Biology, 25 Harbord Street, Toronto, Ontario, M5S 3G5, Canada
  2. Department of Ecology and Evolutionary Biology, 25 Willcocks Street, Toronto, Ontario, M5S 3B2, Canada
Institutions: University of Toronto (Canada); Mayo Clinic (United States); Hospital for Sick Children (Canada)
Journal: Nucleic acids research, volume 54, issue 10, article gkag451
Dates: received 27 June 2025; accepted 22 April 2026; published online 25 May 2026; in print May 2026
Type: Research article · Language: English
License: CC BY-NC
Identifiers: DOI 10.1093/nar/gkag451 · PMID 42179040 · PMCID PMC13199693 · OpenAlex W4413385803
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: C. elegans (organism), cellular / molecular (subfield)
Methods: Statistics, Machine learning
MeSH: Alternative Splicing*, Caenorhabditis elegans*, Genes, Reporter*, Introns*, Animals, Enhancer Elements, Genetic, Muscle Cells, Neurons, Nucleotide Motifs, RNA-Binding Proteins, Silencer Elements, Transcriptional (* major topic)
Topic: RNA Research and Splicing (Molecular Biology, Biochemistry, Genetics and Molecular Biology), according to OpenAlex
Funding: CIHR (180365, 156300); Canadian Institutes of Health Research (180365, 156300); Natural Sciences and Engineering Research Council of Canada (RGPIN-2017-06573)
Citations: not cited yet (Europe PMC); 137 references in the paper

Abstract

Introns play a critical role in regulating alternative splicing. However, identifying functional intronic motifs is challenging due to their short and degenerate sequence composition. Massively parallel reporter assays have provided insights into cis-regulatory logic governing alternative splicing, but these approaches are generally performed in cell culture, limiting their ability to capture tissue-specific contexts. Here, we implemented in vivo parallelized reporter assays (PRA) in Caenorhabditis elegans neurons and muscle cells to screen for intronic enhancer and silencer motifs among thousands of randomized sequences. We identified nearly 200 sequences regulating splicing in these tissues. We uncovered core sub-sequences with tissue-biased enhancing and silencing activity, including motifs recognized by well-characterized RNA-binding proteins, and unmapped motifs with no obvious cognate binding protein. Mapping our PRA-derived motifs to native introns flanking tissue-biased alternative exons revealed their conservation across nematodes, supporting their functional relevance. Additionally, individual intronic regions frequently contained diverse combinations of these motifs, indicative of complex engagement of these sequences by RNA-binding proteins. Finally, we performed targeted mutagenesis of PRA-derived intronic enhancers flanking a neuronal microexon, identifying key cis-regulatory determinants of microexon splicing. Together, our study provides a framework to explore the role of intronic regions in tissue-specific splicing regulation within a multicellular organism.

Reproduced under the paper's license (CC BY-NC), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above, with 1 match between paragraphs and lines of code.

Zenodo 15757714

License: Apache-2.0
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: “Data availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: Matplotlib (1 file), NumPy (1 file), pandas (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
4 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 2 scripts, each with its path and the digest of its content;
  • 1 match between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Data availability

The raw sequence data (fastq files) are available at the NCBI SRA:

https://www.ncbi.nlm.nih.gov/sra/PRJNA1359015

The code and additional data are available through Zenodo:

https://doi.org/10.5281/zenodo.17593183

Inferring Exon and Intron Metadata from .gff file (v1.0.1).

https://doi.org/10.5281/zenodo.15757714

Reproduced under the paper's license (CC BY-NC), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 11 authors, 11 MeSH terms, 3 funders, 134 references.

Cite

This paper

Bhatnagar, S., Ho, J., Sadek, N. H., Singh, I., Zoberman, M., Koterniak, B., Liu, Y., Fusca, D. D., Cutter, A. D., Moses, A. M., & Calarco, J. A. (2026). An in vivo parallelized reporter assay to uncover tissue-specific splicing regulatory sequences in a multicellular animal. Nucleic acids research, 54(10), gkag451. https://doi.org/10.1093/nar/gkag451

BibTeX

@article{bhatnagar2026vivo,
author = {Bhatnagar, Sanjana and Ho, Jade and Sadek, Nour H and Singh, Isha and Zoberman, Michael and Koterniak, Bina and Liu, Yufang and Fusca, Daniel D and Cutter, Asher D and Moses, Alan M and Calarco, John A},
title = {{An in vivo parallelized reporter assay to uncover tissue-specific splicing regulatory sequences in a multicellular animal}},
journal = {Nucleic acids research},
year = {2026},
month = may,
volume = {54},
number = {10},
pages = {gkag451},
publisher = {Oxford University Press},
issn = {0305-1048},
doi = {10.1093/nar/gkag451},
url = {https://doi.org/10.1093/nar/gkag451},
pmid = {42179040},
pmcid = {PMC13199693}
}

RIS

TY - JOUR
AU - Bhatnagar, Sanjana
AU - Ho, Jade
AU - Sadek, Nour H
AU - Singh, Isha
AU - Zoberman, Michael
AU - Koterniak, Bina
AU - Liu, Yufang
AU - Fusca, Daniel D
AU - Cutter, Asher D
AU - Moses, Alan M
AU - Calarco, John A
TI - An in vivo parallelized reporter assay to uncover tissue-specific splicing regulatory sequences in a multicellular animal
T2 - Nucleic acids research
J2 - Nucleic Acids Res
PY - 2026
DA - 2026/05/01
VL - 54
IS - 10
SP - gkag451
SN - 0305-1048
PB - Oxford University Press
DO - 10.1093/nar/gkag451
UR - https://doi.org/10.1093/nar/gkag451
LA - en
ER -

CSL-JSON

{
"id": "10.1093/nar/gkag451",
"type": "article-journal",
"title": "An in vivo parallelized reporter assay to uncover tissue-specific splicing regulatory sequences in a multicellular animal",
"container-title": "Nucleic acids research",
"author": [
{
"family": "Bhatnagar",
"given": "Sanjana"
},
{
"family": "Ho",
"given": "Jade"
},
{
"family": "Sadek",
"given": "Nour H"
},
{
"family": "Singh",
"given": "Isha"
},
{
"family": "Zoberman",
"given": "Michael"
},
{
"family": "Koterniak",
"given": "Bina"
},
{
"family": "Liu",
"given": "Yufang"
},
{
"family": "Fusca",
"given": "Daniel D"
},
{
"family": "Cutter",
"given": "Asher D"
},
{
"family": "Moses",
"given": "Alan M"
},
{
"family": "Calarco",
"given": "John A"
}
],
"container-title-short": "Nucleic Acids Res",
"volume": "54",
"issue": "10",
"page": "gkag451",
"DOI": "10.1093/nar/gkag451",
"PMID": "42179040",
"PMCID": "PMC13199693",
"ISSN": "0305-1048",
"publisher": "Oxford University Press",
"URL": "https://doi.org/10.1093/nar/gkag451",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
1
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1038/s41467-026-76675-1 [code]
Long-read proteogenomic atlas of human neuronal differentiation reveals isoform diversity informing neurodevelopmental risk mechanisms.
Journal: Nature communications
In common: pandas, Matplotlib, NumPy, 2 references, author John A Calarco
[2] doi:10.1038/s41467-026-76320-x [code]
Intrinsic and non-cell-autonomous roles for the neurodevelopmental syndrome-linked transcription factor UNC-3/EBF.
Journal: Nature communications
In common: C. elegans, 4 references
[3] doi:10.1186/s13024-026-00944-2
TDP-43: [GU]-ardian of the transcriptome.
Journal: Molecular neurodegeneration
In common: cellular / molecular, 4 references
[4] doi:10.1038/s41467-026-75352-7 [code]
Mechanosensory encoding of surface mechanics optimizes locomotion.
Journal: Nature communications
In common: pandas, Matplotlib, NumPy, C. elegans, cellular / molecular, 2 references
[5] doi:10.1126/sciadv.aec9329
Cohesin and NuRD antagonistically drive alternative neuronal fates via PLZF transcription factors.
Journal: Science advances
In common: C. elegans, cellular / molecular, 4 references
[6] doi:10.1038/s41586-026-10501-y [code]
Long-term editing of brain circuits using an engineered electrical synapse.
Journal: Nature
In common: pandas, Matplotlib, NumPy, C. elegans, cellular / molecular, 2 references
[7] doi:10.1016/j.celrep.2026.117288
Interlocked transcription factor feedback loops maintain and restore adult touch sensation.
Journal: Cell reports
In common: cellular / molecular, 4 references
[8] doi:10.1371/journal.pcbi.1013441 [code]
Large vision model framework for automated C. elegans analysis: From static morphometry to dynamic neural activity.
Journal: PLoS computational biology
In common: pandas, Matplotlib, NumPy, C. elegans, 2 references
[9] doi:10.1016/j.xhgg.2026.100629 [code]
Positive selection on brain cis-regulatory elements in the human lineage drives changes in gene expression and susceptibility to neuropsychiatric disorders.
Journal: HGG advances
In common: pandas, Matplotlib, NumPy, cellular / molecular, 2 references
[10] doi:10.1038/s41586-026-10348-3 [code]
An enteric neuron ionotropic receptor regulates salt stress resistance.
Journal: Nature
In common: pandas, Matplotlib, NumPy, C. elegans, cellular / molecular, 1 reference

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.