details: http://www.bx.psu.edu/hg/galaxy/rev/e93da066b847 changeset: 2826:e93da066b847 user: Kelly Vincent <kpvincent@bx.psu.edu> date: Mon Oct 05 10:35:39 2009 -0400 description: Several small changes to Samtools pileup tool to get it to work with user-supplied reference genome 1 file(s) affected in this change: tools/samtools/sam_pileup.py diffs (39 lines): diff -r a60c55fb0d76 -r e93da066b847 tools/samtools/sam_pileup.py --- a/tools/samtools/sam_pileup.py Sun Oct 04 10:55:43 2009 -0400 +++ b/tools/samtools/sam_pileup.py Mon Oct 05 10:35:39 2009 -0400 @@ -68,14 +68,16 @@ stop_err( "No sequences are available for '%s', request them by reporting this error." % options.dbkey ) cmd3 = cmd3 % (opts, seq_path, tmpf0bam, options.output1) elif options.ref == 'history': - cmd1 = 'cp %s %s; cp %s.fai %s' % (options.ownFile, tmpf1.name, options.ownFile, tmpf1fai) + cmd1 = 'cp %s %s; samtools faidx %s' % (options.ownFile, tmpf1.name, tmpf1.name) cmd3 = cmd3 % (opts, tmpf1.name, tmpf0bam, options.output1) # index reference if necessary if cmd1: try: os.system(cmd1) + if options.ref == 'history' and not os.path.exists( tmpf1fai ): + stop_err( "Problem creating index file from history item." ) except Exception, eq: - stop_err('Error moving reference sequence\n' + str(eq)) + stop_err('Error handling reference sequence\n' + str(eq)) # copy bam index to working directory try: os.system(cmd2) @@ -85,7 +87,7 @@ try: os.system(cmd3) except Exception, eq: - stop_err('Error running SAMtools merge tool\n' + str(eq)) + stop_err('Error running SAMtools pileup tool\n' + str(eq)) # clean up temp files tmpf1.close() tmpf0.close() @@ -94,6 +96,6 @@ if os.path.exists(tmpf0bambai): os.remove(tmpf0bambai) if os.path.exists(tmpf1fai): - os.remove(tmpf0bambai) + os.remove(tmpf1fai) if __name__ == "__main__" : __main__()