@@ -245,6 +245,8 @@ public void doNimbleAlign(File bam, PipelineStepOutput output, Readset rs, Strin
245245 List <NimbleGenome > genomes = getGenomes ();
246246 List <File > jsons = new ArrayList <>();
247247
248+ String nimbleVersion = getVersion (output );
249+
248250 for (NimbleGenome genome : genomes )
249251 {
250252 File genomeCsv = getGenomeCsv (genome .getGenomeId ());
@@ -280,7 +282,12 @@ public void doNimbleAlign(File bam, PipelineStepOutput output, Readset rs, Strin
280282 throw new PipelineJobException ("Unable to find file: " + results .getPath ());
281283 }
282284
283- String description = genome .getScorePercent () > 0 ? "score_percent: " + genome .getScorePercent () : null ;
285+ String description = "Nimble version: " + nimbleVersion ;
286+ if (genome .getScorePercent () > 0 )
287+ {
288+ description += "\n score_percent: " + genome .getScorePercent ();
289+ }
290+
284291 output .addSequenceOutput (results , basename + ": nimble align" , "Nimble Alignment" , rs .getRowId (), null , genome .getGenomeId (), description );
285292
286293 File outputBam = new File (results .getPath ().replaceAll ("results." + genome .genomeId + ".txt.gz" , "nimbleAlignment." + genome .genomeId + ".bam" ));
@@ -688,4 +695,34 @@ public Integer getNumMismatches()
688695 return numMismatches ;
689696 }
690697 }
698+
699+ private String getVersion (PipelineStepOutput output ) throws PipelineJobException
700+ {
701+ List <String > nimbleArgs = new ArrayList <>();
702+ nimbleArgs .add ("/bin/bash" );
703+ nimbleArgs .add ("-c" );
704+ nimbleArgs .add ("python3 -m nimble -v > /work/nimbleVersion.txt" );
705+
706+ runUsingDocker (nimbleArgs , output , null );
707+
708+ File outFile = new File (getPipelineCtx ().getWorkingDirectory (), "nimbleVersion.txt" );
709+ if (!outFile .exists ())
710+ {
711+ throw new PipelineJobException ("Unable to find file: " + outFile .getPath ());
712+ }
713+
714+ String ret ;
715+ try (BufferedReader reader = Readers .getReader (outFile ))
716+ {
717+ ret = reader .readLine ();
718+ }
719+ catch (IOException e )
720+ {
721+ throw new PipelineJobException (e );
722+ }
723+
724+ outFile .delete ();
725+
726+ return ret ;
727+ }
691728}
0 commit comments