GithubHelp home page GithubHelp logo

simuscopr's Introduction

Wrap-up R package to coordinate SimusCop simulations.

Also, here we present a easy conversion of VCF files in variations and snp files for SimuSCoP simuReads. This tools is useful if you want to simulate Illumina reads based on empirical variations already stored in a VCF file.

Install simuscopR

Install from GitHub:

library(devtools)

install_github("Cristianetaniguti/simuscopR")

It also requires samtools installed.

Or use the Docker image:

docker pull cristaniguti/simuscopr:latest

Input files

All inputs must have information for just one chromosome and one sample.

  • Reference genome and indexes from picard, bwa and samtools
  • Sorted BAM file from real data
  • VCF file
  • BED file

If you need to filter the files to keep only one chromosome, we suggest:

docker run -v $(pwd):/opt cristaniguti/r-samtools samtools view -b /opt/your_bam_file Chr10 > filtered_bam

docker run -v $(pwd):/opt cristaniguti/vcftools vcftools --gzvcf /opt/vcf.file.gz --indv ID1 --chr Chr01 --recode --out vcf_filt

To obtain the BED file from the BAM file

docker run -it -v $(pwd):/data  biocontainers/bedtools:v2.28.0_cv1 bamtobed -i /data/PT_F.chr.sorted.bam > /data/PT_F.sorted_filt.bed

Create profile

docker run -it -v $(pwd):/opt cristaniguti/simuscopr 

You can find these test files here system.file("extdata", package="simuscopR").

setwd("/opt")
seqToProfile("PT_F.chr.sorted.bam", "PT_F.sorted_filt.bed", "gatk_chr10_PT_F.recode.vcf",
             "reference/Chr10.populus.fa", "PT_F.profile")

Variants files

library(vcfR)

vcfR.object <- read.vcfR("gatk_chr10_PT_F.recode.vcf")

variants <- vcf2variants(vcfR.object, sample = "PT_F", chrom = "Chr10")

write.table(variants$SNVs, file = "SNVs.txt", sep = "\t", quote = F, col.names = F, row.names = F)
write.table(variants$indels, file = "indels.txt", sep = "\t", quote = F, col.names = F, row.names = F)
write.table(variants$insertions, file = "insertions.txt", sep = "\t", quote = F, col.names = F, row.names = F)

system("cat SNVs.txt indels.txt insertions.txt > variants.txt")

Run simulation

simuReads(ref = "reference/Chr10.populus.fa",
          profile = "PT_F.profile",
          variation = "variants.txt",
          target = "PT_F.sorted_filt.bed",
          name = "PT_F",
          output = ".",
          layout = "SE",
          threads = 6,
          verbose = 1,
          coverage = 15)

Test to see if worked

docker run -v $(pwd):/data  kfdrc/bwa-picard:latest-dev  bin/bwa mem -t 2  \
/data/reference/Chr10.populus.fa /data/PT_F.fq  > file.bam

docker run -v $(pwd):/data  kfdrc/bwa-picard:latest-dev java -jar /picard.jar SortSam \
I="/data/file.bam" \
O="/data/PT_F.simulated.bam" \
TMP_DIR=./tmp \
SORT_ORDER=coordinate \
CREATE_INDEX=true

# Check images on IGV

simuscopr's People

Contributors

cristianetaniguti avatar

Watchers

 avatar  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.