Skip to content
Snippets Groups Projects
Commit c44ea033 authored by Celine Noirot's avatar Celine Noirot
Browse files

Get species from swissprot definition

Force creation of symbolic link in addinstance.
parent 545b4e51
No related branches found
No related tags found
No related merge requests found
......@@ -86,7 +86,7 @@ class AddInstance (Workflow):
subprocess.check_call( self.get_exec_path("sed") + " -i -e 's,^session\.connection.*,session.connection = jdbc:mysql://{host}:{port}/biomart_sessions?user={user}\&password={passwd},' {propfile}".format(
propfile = os.path.join( NGSPIPELINES_DIST, 'biomart.properties'), **ngs_reader.get_database_info() ), shell = True)
#create link data
subprocess.check_call( self.get_exec_path("ln") + ' -s ' + os.path.join( instance_directory , 'data') + ' ' + os.path.join( NGSPIPELINES_DIST_PLUGIN, 'ngspipelines', 'public','ngspipelines' ) , shell = True)
subprocess.check_call( self.get_exec_path("ln") + ' -f -s ' + os.path.join( instance_directory , 'data') + ' ' + os.path.join( NGSPIPELINES_DIST_PLUGIN, 'ngspipelines', 'public','ngspipelines' ) , shell = True)
if self.instance_url :
url = re.sub(r':\d+$', '', re.sub( r'\/$', '', str(self.instance_url))) + ':' + str(self.instance_port)
if not url.startswith("http") :
......
......@@ -62,15 +62,7 @@ def spFromHit( alignment ):
@param alignment : [Bio::blast::Record::Alignment] the alignment.
"""
species = None
# GI
if re.match("gi\|\d+\|[^\|]+\|.+", alignment.hit_id) is not None:
try:
matches = re.search('\[([^\]]+)\]', alignment.hit_def)
species = matches.group(1)
except: # swissprot
pass
# GNL
elif re.match('gnl\|\w+\|\d+', alignment.hit_id) is not None:
if re.match(".*OS=.*", alignment.hit_def) is not None:
try:
matches = re.search("OS=([^=]+)", alignment.hit_def)
if matches is not None:
......@@ -79,13 +71,13 @@ def spFromHit( alignment ):
clean_matches = re.search("(.+) [A-Z][A-Z]$", species)
if clean_matches is not None:
species = clean_matches.group(1)
else:
matches = re.search('^gi\|\d+\|', alignment.hit_def)
if matches is not None:
cross_references = re.split("gi\|\d+\|", alignment.hit_def )
matches = re.search( '\[([^\]]+)\][^\[]*$', cross_references[1] )
species = matches.group(1)
except: # ensembl
except:
pass
else :
try:
matches = re.search('\[([^\]]+)\]', alignment.hit_def)
species = matches.group(1)
except:
species = None
pass
# Others databases are not implemented
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment