#NEWLINE# def find_genome_directory( dirname ) : #NEWLINE# #INDENT# 'Handle external non-docker installed biodata located relative to config directory.\n    ' #NEWLINE# mounts = [ ] #NEWLINE# sam_loc = os . path . join ( dirname , 'tool-data' , 'sam_fa_indices.loc' ) #NEWLINE# genome_dirs = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if os . path . exists ( sam_loc ) : #NEWLINE# #INDENT# with open ( sam_loc ) as in_handle : #NEWLINE# #INDENT# for line in in_handle : #NEWLINE# #INDENT# if line . startswith ( 'index' ) : #NEWLINE# #INDENT# parts = line . split ( ) #NEWLINE# genome_dirs [ parts [ 1 ] . strip ( ) ] = parts [ ( - 1 ) ] . strip ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# for genome_dir in sorted ( list ( set ( genome_dirs . values ( ) ) ) ) : #NEWLINE# #INDENT# if ( line and ( not os . path . isabs ( genome_dir ) ) ) : #NEWLINE# #INDENT# rel_genome_dir = os . path . dirname ( os . path . dirname ( os . path . dirname ( genome_dir ) ) ) #NEWLINE# full_genome_dir = os . path . normpath ( os . path . join ( os . path . dirname ( sam_loc ) , rel_genome_dir ) ) #NEWLINE# mounts . append ( ( '%s:%s' % ( full_genome_dir , full_genome_dir ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return mounts