@@ -64,10 +64,10 @@ def remove_short_exons(genes, options):
6464 short_exon_skipped += 1
6565 j += 1
6666
67- keep_idx = np .where (~ np .in1d (np .array (np .arange (genes [i ].splicegraph .vertices .shape [1 ])), exons_remove_idx ))[0 ]
67+ keep_idx = np .where (~ np .isin (np .array (np .arange (genes [i ].splicegraph .vertices .shape [1 ])), exons_remove_idx ))[0 ]
6868 genes [i ].splicegraph .subset (keep_idx )
6969
70- keep_idx = np .where (~ np .in1d (np .arange (len (genes )), rm_idx ))[0 ]
70+ keep_idx = np .where (~ np .isin (np .arange (len (genes )), rm_idx ))[0 ]
7171 genes = genes [keep_idx ]
7272
7373 if options .verbose :
@@ -165,7 +165,7 @@ def reduce_splice_graph(genes):
165165 ### <--- test_exon ----> <---- test_exon ---->>>>>>>>>>>>
166166 if ((vertices [1 , exon_idx ] >= vertices [0 , test_exon_idx ]) and (vertices [0 , exon_idx ] <= vertices [0 , test_exon_idx ])) or \
167167 ((vertices [1 , test_exon_idx ] >= vertices [0 , exon_idx ]) and (vertices [0 , test_exon_idx ] <= vertices [0 , exon_idx ])) and \
168- (np .sum (np .in1d (np .arange (min (vertices [0 , exon_idx ], vertices [0 , test_exon_idx ]), max (vertices [1 , exon_idx ], vertices [1 , test_exon_idx ])), intron_loc )) == 0 ):
168+ (np .sum (np .isin (np .arange (min (vertices [0 , exon_idx ], vertices [0 , test_exon_idx ]), max (vertices [1 , exon_idx ], vertices [1 , test_exon_idx ])), intron_loc )) == 0 ):
169169
170170 ### merge exons if they overlap and they do not span any intronic position
171171 vertices [0 , exon_idx ] = min (vertices [0 , exon_idx ], vertices [0 , test_exon_idx ])
@@ -184,7 +184,7 @@ def reduce_splice_graph(genes):
184184 ### ----- exon -----<
185185 ### --- test_exon --<
186186 if (vertices [1 , exon_idx ] == vertices [1 , test_exon_idx ]) and \
187- (np .sum (np .in1d (np .arange (min (vertices [0 , exon_idx ], vertices [0 , test_exon_idx ]), vertices [1 , exon_idx ]), intron_loc )) == 0 ):
187+ (np .sum (np .isin (np .arange (min (vertices [0 , exon_idx ], vertices [0 , test_exon_idx ]), vertices [1 , exon_idx ]), intron_loc )) == 0 ):
188188
189189 ### merge exons if they share the same right boundary and do not span intronic positions
190190 vertices [0 , exon_idx ] = min (vertices [0 , exon_idx ], vertices [0 , test_exon_idx ])
@@ -204,7 +204,7 @@ def reduce_splice_graph(genes):
204204 ### >---- exon ------
205205 ### >-- test_exon ---
206206 if (vertices [0 , exon_idx ] == vertices [0 , test_exon_idx ]) and \
207- (np .sum (np .in1d (np .arange (vertices [0 , exon_idx ], max (vertices [1 , exon_idx ], vertices [1 , test_exon_idx ])), intron_loc )) == 0 ):
207+ (np .sum (np .isin (np .arange (vertices [0 , exon_idx ], max (vertices [1 , exon_idx ], vertices [1 , test_exon_idx ])), intron_loc )) == 0 ):
208208
209209 ### merge exons if they share the same left boundary and do not span intronic positions
210210 vertices [1 , exon_idx ] = max (vertices [1 , exon_idx ], vertices [1 , test_exon_idx ])
@@ -257,8 +257,8 @@ def filter_by_edgecount(genes, options):
257257 genes [i ].splicegraph .edges = (genes [i ].edge_count >= options .sg_min_edge_count ).astype ('int' )
258258 ### remove all exons that have no incoming or outgoing edges (caused by validation, keep single exon transcripts that occured before)
259259 k_idx2 = np .where (genes [i ].splicegraph .edges .sum (axis = 1 ) > 0 )[0 ]
260- #rm_idx = np.where(~np.in1d (k_idx2, k_idx))[0]
261- #keep_idx = np.where(~np.in1d (np.arange(genes[i].splicegraph.edges.shape[0]), rm_idx))[0]
260+ #rm_idx = np.where(~np.isin (k_idx2, k_idx))[0]
261+ #keep_idx = np.where(~np.isin (np.arange(genes[i].splicegraph.edges.shape[0]), rm_idx))[0]
262262 keep_idx = np .union1d (k_idx , k_idx2 ).astype ('int' )
263263 if keep_idx .shape [0 ] > 0 :
264264 genes [i ].splicegraph .subset (keep_idx )
@@ -279,7 +279,7 @@ def insert_intron_retentions(genes, bam_fnames, options):
279279
280280 ### ignore contigs not present in bam files
281281 # TODO
282- #keepidx = np.where(np.in1d (np.array([options.chrm_lookup[x.chr] for x in genes[chunk_idx]]), np.array([x.chr_num for x in regions])))[0]
282+ #keepidx = np.where(np.isin (np.array([options.chrm_lookup[x.chr] for x in genes[chunk_idx]]), np.array([x.chr_num for x in regions])))[0]
283283 #genes = genes[keepidx]
284284
285285 c = 0
@@ -509,7 +509,6 @@ def insert_intron_edges(genes, bam_fnames, options):
509509 genes [i ].splicegraph .vertices [1 , - 2 ], genes [i ].splicegraph .vertices [0 , - 1 ],
510510 genes [i ].splicegraph .vertices [1 , - 1 ]), file = fd_log )
511511 intron_used = True
512-
513512 if not intron_used :
514513 unused_introns .append (j )
515514 continue # with next intron
@@ -672,6 +671,9 @@ def insert_intron_edges(genes, bam_fnames, options):
672671 tracks += tmp_
673672 tracks = np .asarray (tracks )
674673 else :
674+ #if i == 11:
675+ # import pdb
676+ # pdb.set_trace()
675677 tracks = add_reads_from_bam (np .array ([gg ], dtype = 'object' ), bam_fnames , ['exon_track' ], options .read_filter , options .var_aware , options .primary_only , options .ignore_mismatches , mm_tag = options .mm_tag , cram_ref = options .ref_genome )
676678
677679 ### TODO: make configurable
@@ -835,7 +837,7 @@ def insert_cassette_exons(genes, bam_fnames, options):
835837
836838 ### ignore contigs not present in bam files
837839 # TODO TODO
838- #keepidx = np.where(np.in1d (np.array([CFG['chrm_lookup'][x.chr] for x in genes]), np.array([x.chr_num for x in regions])))[0]
840+ #keepidx = np.where(np.isin (np.array([CFG['chrm_lookup'][x.chr] for x in genes]), np.array([x.chr_num for x in regions])))[0]
839841 #genes = genes[keepidx]
840842
841843 c = 0
0 commit comments