diff --git a/.github/ISSUE_TEMPLATE/metaxcan-errors.md b/.github/ISSUE_TEMPLATE/metaxcan-errors.md new file mode 100644 index 0000000..7989539 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/metaxcan-errors.md @@ -0,0 +1,27 @@ +--- +name: Metaxcan errors +about: Use this template to raise an issue on error related to MetaXcan software family +title: '' +labels: '' +assignees: '' + +--- + +# Instant help +Search your error message on the [FAQ](https://predictdb.org/categories/faq/) for instant help. If you can't find it proceed with the next steps below. + +# System info +- Operating system : [Mac, Linux, Windows] +- OS version: +- Did you install and use this [conda env](https://github.com/hakyimlab/MetaXcan/blob/master/software/conda_env.yaml)? + +# Error info +- Paste the specific command you used + +- Rerun the command and set `--verbosity 7` and paste the error log here + +- Headers of your input files + +- Genome build of your input files + +- Any other important info diff --git a/software/Predict.py b/software/Predict.py index 95a3fcf..ec679c5 100644 --- a/software/Predict.py +++ b/software/Predict.py @@ -161,6 +161,10 @@ def run(args): logging.info("Loading model") model, weights, extra = model_structure(args) + + if args.shuffle_weights: + logging.info("Shuffling weights in model") + weights["weight"] = weights.groupby("gene")["weight"].transform(numpy.random.permutation) variant_mapping = get_variant_mapping(args, weights) @@ -256,6 +260,7 @@ def add_arguments(parser): parser.add_argument("--sub_batch", help="compute on a specific slice of data", type=int, default=None) parser.add_argument("--only_entries", help="Compute only these entries in the models (e.g. a whitelist of genes)", nargs="+") parser.add_argument("--capture") + parser.add_argument('--shuffle_weights', action="store_true", help="shuffle model weights to check for inflation") if __name__ == "__main__": import argparse diff --git a/software/SPrediXcan.py b/software/SPrediXcan.py index 8011c3d..df3494a 100755 --- a/software/SPrediXcan.py +++ b/software/SPrediXcan.py @@ -56,6 +56,7 @@ def run(args): parser.add_argument("--overwrite", help="If set, will overwrite the results file if it exists.", action="store_true", default=False) parser.add_argument("--additional_output", help="If set, will output additional information.", action="store_true", default=False) parser.add_argument("--MAX_R", help="Run only for the first R genes", type=int, default=None) + parser.add_argument('--shuffle_weights', action="store_true", help="shuffle model weights to check for inflation") args = parser.parse_args() diff --git a/software/metax/metaxcan/Utilities.py b/software/metax/metaxcan/Utilities.py index 9c00f64..e49fa5b 100644 --- a/software/metax/metaxcan/Utilities.py +++ b/software/metax/metaxcan/Utilities.py @@ -250,6 +250,10 @@ def build_context(args, gwas): logging.info("Loading model from: %s", args.model_db_path) model = load_model(args.model_db_path, args.model_db_snp_key) + if args.shuffle_weights: + logging.info("Shuffling weights in model") + model.weights["weight"] = model.weights.groupby("gene")["weight"].transform(numpy.random.permutation) + if not args.single_snp_model: if not args.stream_covariance: logging.info("Loading covariance data from: %s", args.covariance)