Commit 87f88de6 authored by Mathieu Giraud's avatar Mathieu Giraud Committed by Vidjil Team
Browse files

scripts/ option -a, yield one analysis file per patient

parent d7074f72
......@@ -9,6 +9,7 @@ parser = argparse.ArgumentParser(description='Output shell commands to link sequ
parser.add_argument('--sequences', '-s', action='store_true', help='link sequence files')
parser.add_argument('--results', '-r', action='store_true', help='link results files')
parser.add_argument('--diag', '-d', action='store_true', help='link only diagnosis results (first sample per patient)')
parser.add_argument('--analysis', '-a', action='store_true', help='link analysis files (last file per patient)')
parser.add_argument('--filter', '-f', type=str, default='', help='filter on patient name or info (%(default)s), only for -s or -d')
parser.add_argument('--raw', '-w', action='store_true', help='do not link, only display the list of raw files')
args = parser.parse_args()
......@@ -101,5 +102,32 @@ if gen_results:
not args.raw)
if args.analysis:
print "### Analysis"
last_id = None
for res in db( == db.analysis_file.patient_id).select(|~db.analysis_file.analyze_date):
# Only last saved analysis:
if == last_id:
last_id =
if args.filter:
if not vidjil_utils.advanced_filter([res.patient.first_name,res.patient.last_name,], args.filter):
our_id = "pat-%04d--%3s" % (, res.patient.last_name[:3])
our_id = our_id.replace(' ', '-')
link("%s/%-20s" % (defs.DIR_RESULTS, res.analysis_file.analysis_file),
"%s.analysis" % our_id,
"%s" % res.analysis_file.analyze_date
+ "\t# %s" % patient_string(res.patient),
not args.raw)
log.debug("=== completed ===")
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