CONTROL = args.control_dict[GROUPING_VAR] # control strain to use

    IS_NORMAL = args.is_normal 
    # Perform t-tests/ANOVA if True, ranksum/kruskal if False. If None, Shapiro-Wilks tests for 
    # normality are perofrmed to decide between parametric/non-parametric tests

    TEST_NAME = args.test # str, Choose between 'LMM' (if >1 day replicate), 'ANOVA' or 'Kruskal' 
    # Kruskal tests are performed instead of ANOVA if check_normal and data is not normally distributed) 
    # If significant features are found, pairwise t-tests are performed

    #%% Compile and clean results
        
    # Process metadata    
    metadata, metadata_path = process_metadata(aux_dir=AUX_DIR,
                                               imaging_dates=args.dates, 
                                               add_well_annotations=args.add_well_annotations)
    
    # Process feature summary results
    features, metadata = process_feature_summaries(metadata_path, 
                                                   RESULTS_DIR,
                                                   compile_day_summaries=args.compile_day_summaries,
                                                   imaging_dates=args.dates,
                                                   align_bluelight=args.align_bluelight)
    
    # Clean: remove data with too many NaNs/zero std and impute remaining NaNs
    features, metadata = clean_summary_results(features, 
                                               metadata,
                                               feature_columns=None,
                                               imputeNaN=args.impute_nans,
                                               nan_threshold=args.nan_threshold,
Esempio n. 2
0
        description="Analyse acute response videos to investigate how \
    fast the food takes to influence worm behaviour")
    parser.add_argument('-j',
                        '--json',
                        help="Path to JSON parameters file",
                        default=JSON_PARAMETERS_PATH)
    args = parser.parse_args()
    args = load_json(args.json)

    aux_dir = Path(args.project_dir) / 'AuxiliaryFiles'
    results_dir = Path(args.project_dir) / 'Results'

    # load metadata
    metadata, metadata_path = process_metadata(
        aux_dir,
        imaging_dates=args.dates,
        add_well_annotations=args.add_well_annotations,
        n_wells=6)

    features, metadata = process_feature_summaries(metadata_path,
                                                   results_dir,
                                                   compile_day_summaries=False,
                                                   imaging_dates=args.dates,
                                                   align_bluelight=False,
                                                   window_summaries=True,
                                                   n_wells=6)

    # Subset results (rows) to remove entries for wells with unknown strain data for 'gene_name'
    n = metadata.shape[0]
    metadata = metadata.loc[~metadata['gene_name'].isna(), :]
    features = features.reindex(metadata.index)