diff data_manager/data_manager_snpEff_databases.py @ 6:a329eda0cdff draft default tip

Uploaded
author jjohnson
date Wed, 09 Dec 2015 13:49:55 -0500
parents 78bcf4ac437c
children
line wrap: on
line diff
--- a/data_manager/data_manager_snpEff_databases.py	Tue Jan 13 12:54:20 2015 -0600
+++ b/data_manager/data_manager_snpEff_databases.py	Wed Dec 09 13:49:55 2015 -0500
@@ -18,28 +18,6 @@
     sys.stderr.write(msg)
     sys.exit(1)
 
-def getSnpeffVersion(jar_path):
-    snpeff_version = 'SnpEff ?.?'
-    (snpEff_dir,snpEff_jar) = os.path.split(jar_path)
-    stderr_path = 'snpeff.err'
-    stderr_fh = open(stderr_path,'w')
-    args = [ 'java','-jar', ]
-    args.append( snpEff_jar )
-    args.append( '-h' )
-    proc = subprocess.Popen( args=args, shell=False, cwd=snpEff_dir, stderr=stderr_fh.fileno() )
-    return_code = proc.wait()
-    if return_code != 255:
-        sys.exit( return_code )
-    stderr_fh.close()
-    fh = open(stderr_path,'r')
-    for line in fh:
-        m = re.match('^[Ss]npEff version (SnpEff)\s*(\d+\.\d+).*$',line)
-        if m:
-            snpeff_version = m.groups()[0] + m.groups()[1]
-            break
-    fh.close()
-    return snpeff_version
-
 def fetch_databases(data_manager_dict, target_directory, jar_path):
     (snpEff_dir,snpEff_jar) = os.path.split(jar_path)
     if not os.path.exists(target_directory):
@@ -57,10 +35,9 @@
     if return_code:
         sys.exit( return_code )
     databases_output.close()
-    snpeff_version = getSnpeffVersion(jar_path)
     try:
         data_manager_dict['data_tables'] = data_manager_dict.get( 'data_tables', {} )
-        data_manager_dict['data_tables']['snpeffv_databases'] = data_manager_dict['data_tables'].get( 'snpeffv_databases', [] )
+        data_manager_dict['data_tables']['snpeff4_databases'] = data_manager_dict['data_tables'].get( 'snpeff4_databases', [] )
         data_table_entries = []
         fh = open(databases_path,'r')
         for i,line in enumerate(fh):
@@ -73,9 +50,8 @@
                 if genome_version == '30c2c903' or fields[1].strip() == 'TestCase' or fields[1].strip().startswith('Test_'):
                     continue
                 description = fields[1].strip() + ' : ' + genome_version
-                key = snpeff_version + '_' + genome_version
-                data_table_entries.append(dict(key=key, version=snpeff_version, value=genome_version, name=description))
-        data_manager_dict['data_tables']['snpeffv_databases'] = data_table_entries
+                data_table_entries.append(dict(value=genome_version, name=description))
+        data_manager_dict['data_tables']['snpeff4_databases'] = data_table_entries
     except Exception, e:
         stop_err( 'Error parsing %s %s\n' % (config,str( e )) )
     else: