Commit 9e758030 authored by Celine Noirot's avatar Celine Noirot
Browse files

directory in db start again with a /

parent 71c0f556
......@@ -105,7 +105,7 @@ class Analysis (Component):
"""
# The directories structure into ng6
DIRECTORIES_STRUCTURE = "analyze/"
DIRECTORIES_STRUCTURE = "analyze"
ANALYSIS_CONFIG_FILE_NAME = "analysis.cfg"
def __init__(self, name="", description="", software="",
......@@ -183,7 +183,7 @@ class Analysis (Component):
break
directory_name = uuid.uuid4().hex[:9]
self.directory = os.path.join(ng6conf.get_space_directory(self.space_id), self.DIRECTORIES_STRUCTURE, directory_name)
self.directory = "/" + os.path.join(ng6conf.get_space_directory(self.space_id), self.DIRECTORIES_STRUCTURE, directory_name)
# first create the output directory
if not os.path.isdir(self.output_directory):
......@@ -649,7 +649,7 @@ class Analysis (Component):
Return the full path of the analysis directory into the save dir
"""
ng6conf = NG6ConfigReader()
return os.path.join( ng6conf.get_save_directory(), self.directory)
return ng6conf.get_save_directory() + self.directory
def __get_work_directory(self):
......@@ -657,7 +657,7 @@ class Analysis (Component):
Return the full path of the analysis directory into the work dir
"""
ng6conf = NG6ConfigReader()
return os.path.join( ng6conf.get_work_directory(), self.directory)
return ng6conf.get_work_directory() + self.directory
@staticmethod
......
......@@ -41,7 +41,7 @@ class Run(object):
"""
# The directories structure into ng6
DIRECTORIES_STRUCTURE = "run/"
DIRECTORIES_STRUCTURE = "run"
SEQUENCERS = ["454", "454 GS FLX Titanium", "454 GS FLX+", "454 GS FLX XL+", "HiSeq 2000", "MiSeq"]
def __init__(self, name, date, species, data_nature, type, description, sequencer, space_id="default", id = None ):
......@@ -82,15 +82,19 @@ class Run(object):
uniq = False
directory_name = uuid.uuid4().hex[:9]
while True:
save_dir = os.path.join(ng6conf.get_save_directory(), ng6conf.get_space_directory(self.space_id), self.DIRECTORIES_STRUCTURE, directory_name)
work_dir = os.path.join(ng6conf.get_work_directory(), ng6conf.get_space_directory(self.space_id), self.DIRECTORIES_STRUCTURE, directory_name)
save_dir = os.path.join(ng6conf.get_save_directory(), \
ng6conf.get_space_directory(self.space_id), self.DIRECTORIES_STRUCTURE, directory_name)
work_dir = os.path.join(ng6conf.get_work_directory(), ng6conf.get_space_directory(self.space_id), \
self.DIRECTORIES_STRUCTURE, directory_name)
print (work_dir)
print (os.path.isdir(work_dir))
if not os.path.isdir(save_dir) and not os.path.isdir(work_dir):
break
directory_name = uuid.uuid4().hex[:9]
# Then make directories
work_dir = os.path.join(ng6conf.get_work_directory(), ng6conf.get_space_directory(self.space_id), self.DIRECTORIES_STRUCTURE, directory_name)
os.makedirs(work_dir, 0o751)
self.directory = os.path.join(ng6conf.get_space_directory(self.space_id), self.DIRECTORIES_STRUCTURE, directory_name)
self.directory = "/" + os.path.join(ng6conf.get_space_directory(self.space_id),self.DIRECTORIES_STRUCTURE, directory_name)
def process_raw_files(self, total_size, total_seq):
"""
......@@ -370,21 +374,21 @@ class Run(object):
Return the full path of the run directory into the work dir
"""
ng6conf = NG6ConfigReader()
return os.path.join(ng6conf.get_work_directory(), self.directory)
return ng6conf.get_work_directory() + self.directory
def get_work_directory(self):
"""
Return the full path of the run directory into the work dir
"""
ng6conf = NG6ConfigReader()
return os.path.join(ng6conf.get_work_directory(), self.directory)
return self.__get_work_directory()
def __get_save_directory(self):
"""
Return the full path of the run directory into the save dir
"""
ng6conf = NG6ConfigReader()
return os.path.join(ng6conf.get_save_directory(), self.directory)
return ng6conf.get_save_directory() + self.directory
@staticmethod
def get_from_id (id):
......
......@@ -138,11 +138,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{block name=download}
{if $nb_files != 0}
<p><ul>
{$dir=$data_folder|cat:'/'|cat:$analyse.directory}
{$dir=$data_folder|cat:$analyse.directory}
{assign var="nb_files" value=0}
{foreach $dir|scandir as $file}
{if $file != "." and $file != "" and $file != ".." and ($file|substr:-strlen(".png")) != ".png"}
{$link=(('fileadmin'|cat:'/'|cat:$analyse.directory)|cat:'/')|cat:$file}
{$link=(('fileadmin'|cat:$analyse.directory)|cat:'/')|cat:$file}
<li class="filelist"><a href="{$link}">{$file}</a> </li>
{$nb_files = $nb_files + 1}
{/if}
......
......@@ -109,9 +109,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<div class="tab-pane fade" id="downloads">
{block name=download}
{assign var="nb_files" value=0}
{$dir=$data_folder|cat:'/'|cat:$analyse.directory}
{$dir=$data_folder|cat:$analyse.directory}
{foreach $dir|scandir as $file}
{assign var="link" value=(('fileadmin'|cat:'/'|cat:$analyse.directory)|cat:'/')|cat:$file}
{assign var="link" value=(('fileadmin'|cat:$analyse.directory)|cat:'/')|cat:$file}
{if $file != "." and $file != "" and $file != ".." and ($file|substr:-strlen(".png")) != ".png" and !is_dir($link)}
{$nb_files = $nb_files + 1}
{/if}
......
......@@ -173,11 +173,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{block name=download}
{if $nb_files != 0}
<p><ul>
{$dir=$data_folder|cat:'/'|cat:$analyse.directory}
{$dir=$data_folder|cat:$analyse.directory}
{assign var="nb_files" value=0}
{foreach $dir|scandir as $file}
{if $file != "." and $file != "" and $file != ".." and ($file|substr:-strlen(".png")) != ".png"}
{$link=(('fileadmin'|cat:'/'|cat:$analyse.directory)|cat:'/')|cat:$file}
{$link=(('fileadmin'|cat:$analyse.directory)|cat:'/')|cat:$file}
<li class="filelist"><a href="{$link}">{$file}</a> </li>
{$nb_files = $nb_files + 1}
{/if}
......
......@@ -249,9 +249,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<div class="tab-pane fade" id="downloads">
{block name=download}
{assign var="nb_files" value=0}
{$dir=$data_folder|cat:'/'|cat:$analyse.directory}
{$dir=$data_folder|cat:$analyse.directory}
{foreach $dir|scandir as $file}
{assign var="link" value=(('fileadmin'|cat:'/'|cat:$analyse.directory)|cat:'/')|cat:$file}
{assign var="link" value=(('fileadmin'|cat:$analyse.directory)|cat:'/')|cat:$file}
{if $file != "." and $file != "" and $file != ".." and ($file|substr:-strlen(".png")) != ".png" and !is_dir($link)}
{$nb_files = $nb_files + 1}
{/if}
......@@ -263,7 +263,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{else}
<ul>
{foreach $dir|scandir as $file}
{assign var="link" value=(('fileadmin'|cat:'/'|cat:$analyse.directory)|cat:'/')|cat:$file}
{assign var="link" value=(('fileadmin'|cat:$analyse.directory)|cat:'/')|cat:$file}
{if $file != "." and $file != "" and $file != ".." and ($file|substr:-strlen(".png")) != ".png" and !is_dir($link)}
<li class="filelist"><a href="{$link}">{$file}</a> </li>
{/if}
......
......@@ -391,11 +391,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<div class="tab-pane fade" id="downloads">
<ul>
{$dir=$data_folder|cat:'/'|cat:$analyse.directory}
{$dir=$data_folder|cat:$analyse.directory}
{assign var="nb_files" value=0}
{foreach $dir|scandir as $file}
{if $file != "." and $file != "" and $file != ".." and ($file|substr:-strlen(".png")) != ".png"}
{$link=(('fileadmin'|cat:'/'|cat:$analyse.directory)|cat:'/')|cat:$file}
{$link=(('fileadmin'|cat:$analyse.directory)|cat:'/')|cat:$file}
<li class="filelist"><a href="{$link}">{$file}</a> </li>
{$nb_files = $nb_files + 1}
{/if}
......
......@@ -120,12 +120,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div>
<div class="tab-pane fade" id="downloads">
{$dir=$data_folder|cat:'/'|cat:$runs[key($runs)].directory}
{$dir=$data_folder|cat:$runs[key($runs)].directory}
{assign var="nb_files" value=0}
<ul>
{foreach $dir|scandir as $file}
{if $file != "." and $file !="" and $file != ".." and ($file|substr:-strlen(".png")) != ".png"}
{$link=(('fileadmin'|cat:'/'|cat:$runs[key($runs)].directory)|cat:'/')|cat:$file}
{$link=(('fileadmin'|cat:$runs[key($runs)].directory)|cat:'/')|cat:$file}
<li class="filelist"><a href="{$link}">{$file}</a> <br /></li>
{$nb_files = $nb_files + 1}
{/if}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment