@@ -229,7 +229,14 @@ static void init_data(args_t *args)
229229 args -> hdr = args -> files -> readers [0 ].header ;
230230 args -> isample = -1 ;
231231 if ( !args -> sample )
232+ {
232233 args -> smpl = smpl_ilist_init (args -> hdr ,NULL ,0 ,SMPL_NONE |SMPL_VERBOSE );
234+ if ( !args -> smpl -> n )
235+ {
236+ smpl_ilist_destroy (args -> smpl );
237+ args -> smpl = NULL ;
238+ }
239+ }
233240 else if ( args -> sample && strcmp ("-" ,args -> sample ) )
234241 {
235242 args -> smpl = smpl_ilist_init (args -> hdr ,args -> sample ,0 ,SMPL_NONE |SMPL_VERBOSE );
@@ -244,12 +251,22 @@ static void init_data(args_t *args)
244251 {
245252 if ( args -> haplotype || args -> allele )
246253 {
247- if ( args -> smpl -> n > 1 ) error ("Too many samples, only one can be used with -H\n" );
254+ if ( args -> smpl -> n > 1 ) error ("Too many samples, only one can be used with -H; check the -s,-S options \n" );
248255 args -> isample = args -> smpl -> idx [0 ];
249256 }
250257 else
258+ {
251259 args -> iupac_GTs = 1 ;
260+ if ( args -> smpl -> n == 1 )
261+ fprintf (stderr ,"Note: applying IUPAC codes based on FORMAT/GT in sample %s\n" ,bcf_hdr_int2id (args -> hdr ,BCF_DT_SAMPLE ,args -> smpl -> idx [0 ]));
262+ else
263+ fprintf (stderr ,"Note: applying IUPAC codes based on FORMAT/GT in %d samples\n" ,args -> smpl -> n );
264+ }
252265 }
266+ else if ( args -> output_iupac )
267+ fprintf (stderr ,"Note: applying IUPAC codes based on REF,ALT%s\n" ,bcf_hdr_nsamples (args -> hdr )?", ignoring samples" :"" );
268+ else
269+ fprintf (stderr ,"Note: applying REF,ALT variants%s\n" ,bcf_hdr_nsamples (args -> hdr )?", ignoring samples" :"" );
253270 int i ;
254271 for (i = 0 ; i < args -> nmask ; i ++ )
255272 {
@@ -272,7 +289,6 @@ static void init_data(args_t *args)
272289 if ( ! args -> fp_out ) error ("Failed to create %s: %s\n" , args -> output_fname , strerror (errno ));
273290 }
274291 else args -> fp_out = stdout ;
275- if ( args -> isample < 0 && !args -> iupac_GTs ) fprintf (stderr ,"Note: the --samples option not given, applying all records regardless of the genotype\n" );
276292 if ( args -> filter_str )
277293 args -> filter = filter_init (args -> hdr , args -> filter_str );
278294 args -> rid = -1 ;
0 commit comments