File tree 5 files changed +35
-5
lines changed
tests/integration/alignment
5 files changed +35
-5
lines changed Original file line number Diff line number Diff line change @@ -377,7 +377,12 @@ Command line interface: pk_faidx; pk_get_entry; pk_ge
377
377
Extracts sequence entry from fasta file.
378
378
379
379
This function works similarly to the faidx function
380
- in samtools, but does not requiring an indexing function.
380
+ in samtools, but does not requiring an indexing step.
381
+
382
+ To obtain multiple entries, input multiple entries separated
383
+ by a comma (,). For example, if you want entries
384
+ named "seq_0" and "seq_1", the string "seq_0,seq_1"
385
+ should be associated with the -e argument.
381
386
382
387
.. code-block :: shell
383
388
Original file line number Diff line number Diff line change @@ -738,7 +738,12 @@ def faidx(argv):
738
738
Extracts sequence entry from fasta file.
739
739
740
740
This function works similarly to the faidx function
741
- in samtools, but does not requiring an indexing function.
741
+ in samtools, but does not requiring an indexing step.
742
+
743
+ To obtain multiple entries, input multiple entries separated
744
+ by a comma (,). For example, if you want entries
745
+ named "seq_0" and "seq_1", the string "seq_0,seq_1"
746
+ should be associated with the -e argument.
742
747
743
748
Aliases:
744
749
faidx, get_entry; ge
Original file line number Diff line number Diff line change @@ -9,7 +9,9 @@ def __init__(self, args) -> None:
9
9
10
10
def run (self ):
11
11
record_dict = SeqIO .index (self .fasta , "fasta" )
12
- print (f">{ record_dict [self .entry ].name } \n { record_dict [self .entry ].seq } " )
12
+ entry = self .entry .split (',' )
13
+ for e in entry :
14
+ print (f">{ record_dict [e ].name } \n { record_dict [e ].seq } " )
13
15
14
16
def process_args (self , args ):
15
17
return dict (fasta = args .fasta , entry = args .entry )
Original file line number Diff line number Diff line change 1
- __version__ = "1.19.7 "
1
+ __version__ = "1.19.8 "
Original file line number Diff line number Diff line change @@ -65,4 +65,22 @@ def test_faidx_alias1(self, mocked_print):
65
65
]
66
66
with patch .object (sys , "argv" , testargs ):
67
67
Phykit ()
68
- assert mocked_print .mock_calls == [call (expected_result )]
68
+ assert mocked_print .mock_calls == [call (expected_result )]
69
+
70
+ @patch ("builtins.print" )
71
+ def test_faidx_multiple_entries (self , mocked_print ):
72
+ expected_result0 = ">1\n A-GTAT"
73
+ expected_result1 = ">2\n A-G-AT"
74
+ testargs = [
75
+ "phykit" ,
76
+ "faidx" ,
77
+ f"{ here .parent .parent .parent } /sample_files/simple.fa" ,
78
+ '-e' ,
79
+ '1,2'
80
+ ]
81
+ with patch .object (sys , "argv" , testargs ):
82
+ Phykit ()
83
+ assert mocked_print .mock_calls == [
84
+ call (expected_result0 ),
85
+ call (expected_result1 )
86
+ ]
You can’t perform that action at this time.
0 commit comments