Giter Site home page Giter Site logo

justicengom / compensatory_mutations Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ninamercedes/compensatory_mutations

0.0 0.0 0.0 6.99 MB

A systematic framework to identify compensatory mutations from M. tuberculosis whole genome sequences

License: MIT License

R 100.00%

compensatory_mutations's Introduction

Compensatory_Mutations

A systematic framework to identify compensatory mutations from M. tuberculosis whole genome sequences.

Packages

Implemented in R version 3.6.1. Requirements include BCFtools (v1.9) and R packages: lavaan (v0.6-10), data.table, optparse, and dplyr.

The Framework

Stage 1- Pre-process Data (pre_process.R)

This stage takes gene sequence variations in Variant Call Format (vcf.gz), removes lineage-specific SNPs and samples with missing phenotypes to create a genotype file for downstream analysis. There is also the option to use only missense mutations. Note the metadata file must contain columns 'id' and 'lineage', and name of drug (e.g. 'rifampicin'). Example of how to use below.

Rscript pre_process.R --vcf_gz "tb.vcf.gz" --region "rpoB_region.tsv" ----filter_vcf TRUE --out_vcf "rpoB_filtered.vcf.gz" --make_geno TRUE --out_geno "rpoB.geno" --sample_names "sample_names.txt" --metadata "metadata.csv" --drug "rifampicin" --rem_lineage TRUE --out_geno_nolin "rpoB_nolin.geno" --missense TRUE

Rscript pre_process.R --vcf_gz "tb.vcf.gz" --region "rpoC_region.tsv" ----filter_vcf TRUE --out_vcf "rpoC_filtered.vcf.gz" --make_geno TRUE --out_geno "rpoC.geno" --sample_names "sample_names.txt" --metadata "metadata.csv" --drug "rifampicin" --rem_lineage TRUE --out_geno_nolin "rpoC_nolin.geno" --missense TRUE

Stage 2- Analysis (assoc_test.R and med_test.R)

This stage uses genotype files created in stage 1 and performs association and mediation tests to identify putative compensatory mutations. Example of how to use below.

Rscript assoc_test.R --geno_a "rpoB_nolin.geno" --geno_b "rpoC_nolin.geno" --assoc_test TRUE --chi_file "rpoB_rpoC_chi.csv" --metatdata "metadata.csv" --drug "rifampicin"

Rscript med_test.R --geno_a "rpoB_nolin.geno" --geno_b "rpoC_nolin.geno" --med_test TRUE --chi_file "rpoB_rpoC_chi.csv"  --med_file "rpoB_rpoC_med.csv" --metatdata "metadata.csv" --drug "rifampicin"

Stage 3- Interpretation (interpret_results.R)

This stage interprets the results from stage 2 analyses. How decisions are made are shown in summary figure below. The information files for snps in region 1 should contain the headers 'snp1_pos', 'snp1_ref_allele', 'snp1_alt_allele, 'snp1_amino_change', and the equivalent headers for region 2. Example of how to use below.

Rscript assoc_test.R --interpret_results TRUE --med_file "rpoB_rpoC_med.csv" --info_file_r1 "rpoB_info.csv" --info_file_r2 "rpoC_info.csv"  --out_file "significant_mediation_rpoB_rpoC.csv" --chi_only "significant_chi_only_rpoB_rpoC.csv"

Overview

Supplementary File 1

compensatory_mutations's People

Contributors

ninamercedes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.