@@ -112,6 +112,10 @@ def test_vquest(self):
112112 "AGCCGGGTGGAAGCTGAGGATGTTGGGGTGTATTACTGTATGCAAAGTATAGAGTTTCCT"
113113 "CC" ).lower (),
114114 seq )
115+ seq_analysis_cat = result ["vquest_airr.tsv" ].splitlines ()[1 ].split ("\t " )[118 ]
116+ deletions = result ["vquest_airr.tsv" ].splitlines ()[1 ].split ("\t " )[123 ]
117+ self .assertEqual (seq_analysis_cat , "1 (noindelsearch)" )
118+ self .assertEqual (deletions , "" )
115119
116120 def test_vquest_main (self ):
117121 """Test that the command-line interface gives the expected response."""
@@ -150,3 +154,80 @@ def test_vquest_main(self):
150154 vquest .__main__ .main ([])
151155 self .assertNotEqual (out .getvalue (), "" )
152156 self .assertEqual (err .getvalue (), "" )
157+
158+
159+ class TestVquestCustom (TestVquest ):
160+ """Try changing one of the configuration options.
161+
162+ Note that most of the configuration options in the Excel section actually
163+ don't seem to change the results when AIRR output is selected. The "Search
164+ for insertions and deletions in V-REGION" option does change the output
165+ though.
166+ """
167+
168+ def setUp (self ):
169+ self .case = "custom"
170+ self .set_up_mock_post ()
171+
172+ def test_vquest (self ):
173+ """We should see a change in Parameters and the AIRR table."""
174+ config = {
175+ "species" : "rhesus-monkey" ,
176+ "receptorOrLocusType" : "IG" ,
177+ "resultType" : "excel" ,
178+ "xv_outputtype" : 3 ,
179+ "v_regionsearchindel" : True ,
180+ "sequences" : """>IGKV2-ACR*02
181+ GACATTGTGATGACCCAGACTCCACTCTCCCTGCCCGTCACCCCTGGAGAGCCAGCCTCCATCTCCTGCAGGTCTAGTCA
182+ GAGCCTCTTGGATAGTGACGGGTACACCTGTTTGGACTGGTACCTGCAGAAGCCAGGCCAGTCTCCACAGCTCCTGATCT
183+ ATGAGGTTTCCAACCGGGTCTCTGGAGTCCCTGACAGGTTCAGTGGCAGTGGGTCAGNCACTGATTTCACACTGAAAATC
184+ AGCCGGGTGGAAGCTGAGGATGTTGGGGTGTATTACTGTATGCAAAGTATAGAGTTTCCTCC""" }
185+ result = vquest .vquest (config )
186+ parameters = [("Date" , "Wed Dec 02 19:18:14 CET 2020" ),
187+ ("IMGT/V-QUEST program version" , "3.5.21" ),
188+ ("IMGT/V-QUEST reference directory release" , "202049-2" ),
189+ ("Species" , "Macaca mulatta" ),
190+ ("Receptor type or locus" , "IG" ),
191+ ("IMGT/V-QUEST reference directory set" , "F+ORF+ in-frame P" ),
192+ ("Search for insertions and deletions" , "yes" ),
193+ ("Nb of nucleotides to add (or exclude) in 3' "
194+ "of the V-REGION for the evaluation of the alignment score" , "0" ),
195+ ("Nb of nucleotides to exclude in 5' "
196+ "of the V-REGION for the evaluation of the nb of mutations" , "0" ),
197+ ("Analysis of scFv" , "no" ),
198+ ("Number of submitted sequences" , "1" )]
199+ self .assertEqual (
200+ "\n " .join (["%s\t %s\t " % param for param in parameters ]) + "\n \n " ,
201+ result ["Parameters.txt" ])
202+ seq = result ["vquest_airr.tsv" ].splitlines ()[1 ].split ("\t " )[1 ]
203+ self .assertEqual (
204+ ("GACATTGTGATGACCCAGACTCCACTCTCCCTGCCCGTCACCCCTGGAGAGCCAGCCTCC"
205+ "ATCTCCTGCAGGTCTAGTCAGAGCCTCTTGGATAGTGACGGGTACACCTGTTTGGACTGG"
206+ "TACCTGCAGAAGCCAGGCCAGTCTCCACAGCTCCTGATCTATGAGGTTTCCAACCGGGTC"
207+ "TCTGGAGTCCCTGACAGGTTCAGTGGCAGTGGGTCAGNCACTGATTTCACACTGAAAATC"
208+ "AGCCGGGTGGAAGCTGAGGATGTTGGGGTGTATTACTGTATGCAAAGTATAGAGTTTCCT"
209+ "CC" ).lower (),
210+ seq )
211+ seq_analysis_cat = result ["vquest_airr.tsv" ].splitlines ()[1 ].split ("\t " )[118 ]
212+ deletions = result ["vquest_airr.tsv" ].splitlines ()[1 ].split ("\t " )[123 ]
213+ self .assertEqual (seq_analysis_cat , "2 (indelcorr)" )
214+ self .assertEqual (
215+ deletions ,
216+ ("in CDR1-IMGT, from codon 33 of V-REGION: 3 nucleotides "
217+ "(from position 97 in the user submitted sequence), (do not cause frameshift)" ))
218+
219+ def test_vquest_main (self ):
220+ """Test how the command-line interface handles no arguments.
221+
222+ It should exit with a nonzero exit code and write the help text to
223+ stdout.
224+ """
225+ out = StringIO ()
226+ err = StringIO ()
227+ with redirect_stdout (out ), redirect_stderr (err ):
228+ with self .assertRaises (SystemExit ):
229+ with tempfile .TemporaryDirectory () as tempdir :
230+ os .chdir (tempdir )
231+ vquest .__main__ .main ([])
232+ self .assertNotEqual (out .getvalue (), "" )
233+ self .assertEqual (err .getvalue (), "" )
0 commit comments