File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,22 @@ def nsamples
4343 LibHTS . bcf_hdr_nsamples ( @bcf_hdr )
4444 end
4545
46+ def target_count
47+ target_names . size
48+ end
49+
50+ def get_tid ( name )
51+ name2id ( name )
52+ end
53+
54+ def target_name ( rid )
55+ id2name ( rid )
56+ end
57+
58+ def target_names
59+ seqnames
60+ end
61+
4662 def samples
4763 # bcf_hdr_id2name is macro function
4864 @bcf_hdr [ :samples ]
Original file line number Diff line number Diff line change @@ -36,6 +36,26 @@ def test_nsamples
3636 assert_equal 2 , @hdr . nsamples
3737 end
3838
39+ def test_target_count
40+ assert_equal 4 , @hdr . target_count
41+ end
42+
43+ def test_target_name
44+ assert_equal "1" , @hdr . target_name ( 0 )
45+ assert_equal "4" , @hdr . target_name ( 3 )
46+ assert_nil @hdr . target_name ( 4 )
47+ end
48+
49+ def test_target_names
50+ assert_equal %w[ 1 2 3 4 ] , @hdr . target_names
51+ end
52+
53+ def test_get_tid
54+ assert_equal 0 , @hdr . get_tid ( "1" )
55+ assert_equal 3 , @hdr . get_tid ( "4" )
56+ assert_equal ( -1 , @hdr . get_tid ( "5" ) )
57+ end
58+
3959 def test_samples
4060 assert_equal %w[ A B ] , @hdr . samples
4161 end
You can’t perform that action at this time.
0 commit comments