File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,14 @@ impl<'a> Layers<'a> {
7474
7575 for i in self . layer . iter ( ) {
7676 total += i. 2 . len ( ) + 1 ;
77- let transcripts = self . mapper . get ( & i. 1 ) . unwrap ( ) ;
77+
78+ let transcripts = if let Some ( transcripts) = self . mapper . get ( & i. 1 ) {
79+ transcripts
80+ } else {
81+ // log::warn!("Transcript not found in mapper for gene {} -> {}", i.1, i.2);
82+ & vec ! [ ]
83+ } ;
84+
7885 for j in transcripts. iter ( ) {
7986 total += self . helper . get ( j) . unwrap ( ) . len ( ) + 1 ;
8087 let exons = self . inner . get ( j) . unwrap ( ) ;
@@ -243,7 +250,14 @@ pub fn write_obj_mmaped<'a, P: AsRef<Path> + Debug>(
243250 for i in chr. layer . iter ( ) {
244251 writeln ! ( output, "{}" , i. 2 ) ?;
245252
246- let transcripts = chr. mapper . get ( & i. 1 ) . unwrap ( ) ;
253+ // INFO: catching potential error expansion from mapper.get(&i.1)
254+ // INFO: that may occur in gene lines without transcript_id
255+ let transcripts = if let Some ( transcripts) = chr. mapper . get ( & i. 1 ) {
256+ transcripts
257+ } else {
258+ & vec ! [ ]
259+ } ;
260+
247261 for j in transcripts. iter ( ) {
248262 writeln ! ( output, "{}" , chr. helper. get( j) . unwrap( ) ) ?;
249263 let exons = chr. inner . get ( j) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments