@@ -123,6 +123,7 @@ def scorefile(input_file, algorithm, do_subtype=False, program='post'):
123123 file_genes , sequence_lengths , file_trims , subtypes , na_sequence , ambiguous , gene_order
124124
125125def sierralocal (fasta , outfile , xml = None , json = None , cleanup = False , forceupdate = False ,
126+ apobec_csv = None , unusual_csv = None , sdrms_csv = None , mutation_csv = None ,
126127 program = 'post' , do_subtype = False ): # pragma: no cover
127128 """
128129 Contains all initializing and processing calls.
@@ -134,13 +135,17 @@ def sierralocal(fasta, outfile, xml=None, json=None, cleanup=False, forceupdate=
134135 @param json: <optional> str, path to local copy of HIVdb algorithm APOBEC DRM file
135136 @param cleanup: <optional> bool, to delete alignment file
136137 @param forceupdate: <optional> bool, forces sierralocal to update its local copy of the HIVdb algorithm
138+ @param apobec_csv: str <optional>, Path to CSV APOBEC csv file (default: apobecs.csv)
139+ @param unusual_csv: str <optional>, Path to CSV file to determine if is unusual (default: rx-all_subtype-all.csv)
140+ @param sdrms_csv: str <optional>, Path to CSV file to determine SDRM mutations (default: sdrms_hiv1.csv)
141+ @param mutation_csv: str <optional>, Path to CSV file to determine mutation type (default: mutation-type-pairs_hiv1.csv)
137142 @return: tuple, a tuple of (number of records processed, time elapsed initializing algorithm)
138143 """
139144
140145 # initialize algorithm and jsonwriter
141146 time0 = time .time ()
142147 algorithm = HIVdb (asi2 = xml , apobec = json , forceupdate = forceupdate )
143- writer = JSONWriter (algorithm )
148+ writer = JSONWriter (algorithm , apobec_csv , unusual_csv , sdrms_csv , mutation_csv )
144149 time_elapsed = time .time () - time0
145150
146151 # accommodate single file path argument
@@ -197,10 +202,18 @@ def parse_args(): # pragma: no cover
197202 help = 'Forces update of HIVdb algorithm. Requires network connection.' )
198203 parser .add_argument ('-alignment' , default = 'post' , choices = ['post' , 'nuc' ],
199204 help = 'Alignment program to use, "post" for post align and "nuc" for nucamino' )
205+ parser .add_argument ('-apobec_csv' , default = None ,
206+ help = '<optional> Path to CSV APOBEC csv file (default: apobecs.csv)' )
207+ parser .add_argument ('-unusual_csv' , default = None ,
208+ help = '<optional> Path to CSV file to determine if is unusual (default: rx-all_subtype-all.csv)' )
209+ parser .add_argument ('-sdrms_csv' , default = None ,
210+ help = '<optional> Path to CSV file to determine SDRM mutations (default: sdrms_hiv1.csv)' )
211+ parser .add_argument ('-mutation_csv' , default = None ,
212+ help = '<optional> Path to CSV file to determine mutation type (default: mutation-type-pairs_hiv1.csv)' )
213+
200214 args = parser .parse_args ()
201215 return args
202216
203-
204217def main (): # pragma: no cover
205218 """
206219 Main function called from CLI.
@@ -216,6 +229,8 @@ def main(): # pragma: no cover
216229 time_start = time .time ()
217230 count , time_elapsed = sierralocal (args .fasta , args .outfile , xml = args .xml ,
218231 json = args .json , cleanup = args .cleanup , forceupdate = args .forceupdate ,
232+ apobec_csv = args .apobec_csv , unusual_csv = args .unusual_csv ,
233+ sdrms_csv = args .sdrms_csv , mutation_csv = args .mutation_csv ,
219234 program = args .alignment )
220235 time_diff = time .time () - time_start
221236
0 commit comments