Skip to content
Snippets Groups Projects

Multiple input

Merged Thibault Lavigne requested to merge feature_multiple_input into master

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
533 538 return scores
534 539
535 540
541 def run_multiple(file_csv, annot_folder, predict_folder, threshold):
542 """Run the program for multiple file (correlation indicated in the csv file)"""
  • 564 602 default=THRESHOLD,
    565 603 type=threshold_float_type,
    566 604 )
    605 parser.add_argument(
    606 "-c",
    607 "--csv",
    608 help="csv with the correlation between the annotation bio file and the predict bio file",
  • 81 84 try:
    82 85 word, label = line.split()
    83 86 except ValueError:
    87 print(index)
    88 print(line)
    84 89 raise (Exception(f"The file {path} given in input is not in BIO format."))
  • 535 540
    541 def run_multiple(file_csv, annot_folder, predict_folder, threshold):
    542 """Run the program for multiple file (correlation indicated in the csv file)"""
    543 # Read the csv in a dataframe
    544 df_cor = pd.read_csv(file_csv)
    545
    546 # Check if the variable given are folder
    547 if os.path.isdir(annot_folder) and os.path.isdir(predict_folder):
    548 list_bio_annot = glob.glob(annot_folder + "/**/*.bio", recursive=True)
    549 list_bio_predict = glob.glob(predict_folder + "/**/*.bio", recursive=True)
    550
    551 for index, row in df_cor.iterrows():
    552 annot = None
    553 predict = None
    554
    555 # Check if the file exist
  • 565 603 type=threshold_float_type,
    566 604 )
    605 parser.add_argument(
    606 "-c",
    607 "--csv",
    608 help="csv with the correlation between the annotation bio file and the predict bio file",
    609 required=False,
    610 type=Path,
    611 )
    567 612 args = parser.parse_args()
    568 613
    569 run(args.annot, args.predict, args.threshold)
    614 if args.csv:
    615 run_multiple(args.csv, args.annot, args.predict, args.threshold)
    616 else:
    617 run(args.annot, args.predict, args.threshold)
    • Comment on lines +555 to +617

      Est-ce que l'utilisation ne serait pas plus pratique avec un seul répertoire "bio_files" plutôt que deux séparés ? Avec un nouvel argument en paramètres uniquement pour ça, et en vérifiant la cohérence des arguments en les parsant.

      Dans tous les cas, pas besoin de dédoubler les fichiers de test dans la demo. Même en gardant deux paramètres, tu peux juste passer le répertoire demo en argument.

      By Blanche Miret on 2021-12-23T09:10:41 (imported from GitLab)

    • Je rajoute un argument pour le dossier et je passe '--annot' et '--predict' à False ou j'en considère un comme l'input folder ?

      By Charlotte Mauvezin on 2021-12-23T10:02:08 (imported from GitLab)

    • Thibault Lavigne changed this line in version 7 of the diff

      changed this line in version 7 of the diff

      By Charlotte Mauvezin on 2022-01-03T10:34:28 (imported from GitLab)

    • Please register or sign in to reply
  • 556 for file_annot in list_bio_annot:
    557 if row["annot"] == os.path.basename(file_annot):
    558 annot = file_annot
    559 for file_predict in list_bio_predict:
    560 if row["predict"] == os.path.basename(file_predict):
    561 predict = file_predict
    562
    563 # Apply the evaluation
    564 if annot and predict:
    565 run(annot, predict, threshold)
    566 print("")
    567 else:
    568 print(f"No file found for row {index}")
    569
    570 else:
    571 print("Error this is no folder")
  • 551 for index, row in df_cor.iterrows():
    552 annot = None
    553 predict = None
    554
    555 # Check if the file exist
    556 for file_annot in list_bio_annot:
    557 if row["annot"] == os.path.basename(file_annot):
    558 annot = file_annot
    559 for file_predict in list_bio_predict:
    560 if row["predict"] == os.path.basename(file_predict):
    561 predict = file_predict
    562
    563 # Apply the evaluation
    564 if annot and predict:
    565 run(annot, predict, threshold)
    566 print("")
  • Peux-tu aussi ajouter la description de la nouvelle utilisation dans le README ?

    By Blanche Miret on 2021-12-23T09:14:25 (imported from GitLab)

  • added 1 commit

    Compare with previous version

    By Charlotte Mauvezin on 2021-12-23T11:27:54 (imported from GitLab)

  • 533 540 return scores
    534 541
    535 542
    543 def run_multiple(file_csv, folder, threshold):
    544 """Run the program for multiple files (correlation indicated in the csv file)"""
    545 # Read the csv in a dataframe
    546 df_cor = pd.read_csv(file_csv)
  • demo/cor.csv 0 → 100644
    1 annot,predict
  • added 1 commit

    Compare with previous version

    By Charlotte Mauvezin on 2021-12-24T12:38:25 (imported from GitLab)

  • added 1 commit

    Compare with previous version

    By Charlotte Mauvezin on 2021-12-24T12:40:00 (imported from GitLab)

  • 560 562 predict = file
    561 563
    562 564 if annot and predict:
    565 print(os.path.basename(predict))
    563 566 run(annot, predict, threshold)
    564 567 print()
    565 568 else:
    566 raise f"No file found for row {index}"
    567
    569 raise f"No file found for files {annot}, {predict}"
    568 570 else:
    569 571 raise "This is no folder"
  • 560 562 predict = file
    561 563
    562 564 if annot and predict:
    565 print(os.path.basename(predict))
    563 566 run(annot, predict, threshold)
    564 567 print()
    565 568 else:
    566 raise f"No file found for row {index}"
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading