Exemplo n.º 1
0
def get_filenames_from_pool(all_samples):

    # get a list of the files
    files_list = get_roofiles_in_dir(all_samples)

    if len(files_list) == 0:
        print("Zero files found in directory %s!" % all_samples)
        return [], []

    # Are they an even number?
    for name in files_list:
        print("* ", name)
    if len(files_list) % 2 != 0:
        print(
            "The numbuer of file is not even... Trying to recover a catastrophe."
        )

    files_list = make_files_pairs(files_list)

    # Try to couple them according to their sample
    ref_filenames = []
    test_filenames = []
    #files_list.sort(key=name2version)
    #files_list.sort(key=name2sample)
    #files_list.sort(key=name2run)
    for iname in xrange(len(files_list)):
        filename = files_list[iname]
        if iname % 2 == 0:
            ref_filenames.append(filename)
        else:
            test_filenames.append(filename)

    print("The guess would be the following:")
    for ref, test in zip(ref_filenames, test_filenames):
        refbasedir = os.path.dirname(ref)
        testbasedir = os.path.dirname(test)
        dir_to_print = refbasedir
        if refbasedir != testbasedir:
            dir_to_print = "%s and %s" % (refbasedir, testbasedir)
        print("* Directory: %s " % dir_to_print)
        refname = os.path.basename(ref)
        testname = os.path.basename(test)
        print("  o %s" % refname)
        print("  o %s" % testname)

    #is_ok=ask_ok("Is that ok?")
    #if not is_ok:
    #print "Manual input needed then!"
    #exit(2)

    return ref_filenames, test_filenames
Exemplo n.º 2
0
def get_filenames_from_pool(all_samples):
  
  # get a list of the files
  files_list=get_roofiles_in_dir(all_samples)
  
  if len(files_list)==0:
    print "Zero files found in directory %s!" %all_samples
    return [],[]
  
  # Are they an even number?
  for name in files_list:
    print "* ",name  
  if len(files_list)%2!=0:
    print "The numbuer of file is not even... Trying to recover a catastrophe."
    
  files_list=make_files_pairs(files_list)
  
  # Try to couple them according to their sample
  ref_filenames=[]
  test_filenames=[]
  #files_list.sort(key=name2version)
  #files_list.sort(key=name2sample) 
  #files_list.sort(key=name2run)
  for iname in xrange(len(files_list)):
    filename=files_list[iname]
    if iname%2==0:
      ref_filenames.append(filename)
    else:
      test_filenames.append(filename)
      
  print "The guess would be the following:"
  for ref,test in zip(ref_filenames,test_filenames):
    refbasedir=os.path.dirname(ref)
    testbasedir=os.path.dirname(test)
    dir_to_print=refbasedir
    if refbasedir!=testbasedir:
      dir_to_print="%s and %s" %(refbasedir,testbasedir)
    print "* Directory: %s " %dir_to_print
    refname=os.path.basename(ref)
    testname=os.path.basename(test)
    print "  o %s" %refname
    print "  o %s" %testname
  
  #is_ok=ask_ok("Is that ok?")
  #if not is_ok:
    #print "Manual input needed then!"
    #exit(2)
      
  
  return ref_filenames,test_filenames