Commit 7ce6a47b authored by Penom Nom's avatar Penom Nom
Browse files

No commit message

No commit message
parent 39b0c4a0
......@@ -307,4 +307,24 @@ class Utils(object):
arg_pattern += " $" + str(next_number)
next_number += 1
return [arg_pattern, next_number]
\ No newline at end of file
return [arg_pattern, next_number]
@staticmethod
def get_filepath_by_prefix( path_list, prefixes ):
"""
Gather files path with same prefix. Ex :
list [/home/sample1_L002.fastq, /home/sample2_L002.fastq, /home/sample1_L003.fastq]
with prefixes [sample1, sample2]
return {'sample1':[/home/sample1_L002.fastq, /home/sample1_L003.fastq], 'sample2':[/home/sample2_L002.fastq]}
@param path_list : the list of files
@param prefixes : prefix to gather
"""
path_groups = {}
for current_prefix in prefixes:
path_groups[current_prefix] = []
for file_path in path_list:
if os.path.basename(file_path).startswith(current_prefix):
path_groups[current_prefix].append(file_path)
return path_groups
\ No newline at end of file
Supports Markdown
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