Code Monkey home page Code Monkey logo

pysim's Introduction

pysim

A python package to simulate structural variation Pysim-sv is a package for simulating high-throughput sequencing (HTS) data to evaluate perfor-mance of structural variation (SV) detection algorithms. Pysim-sv can introduce a wide spectrum of germline and somatic genomic variations, making simulated genomes more similar to real ge-nomes. The package contains functionalities to simulate aneuploidy as well as heterogeneous tumor data, which is very useful in assessing performance of algorithms in tumor studies. Further-more, Pysim-sv can introduce GC-biases, the most important and the most prevalent bias in HTS data, in the simulated HTS bias. Pysim-sv provides an unbiased toolkit for evaluating HTS-based SV detection algorithms.

pysim's People

Contributors

xyc0813 avatar

Stargazers

Dandan avatar Weixiang Wang avatar jag2231 avatar Jeremiah Liu avatar Eric T. Dawson avatar HHHIT avatar Ruining Dong avatar

Watchers

 avatar HHHIT avatar  avatar

pysim's Issues

Key error while trying to simulate variants

Hi everyone,

I'm trying to simulate variants running pysim_main.py but I keep getting key error in script pysim1.py in line 194:

if len(snp_dic[key])>=num:
KeyError: '1'

Is anyone able to solve this issue?

specify_ploidy.py does not result in a fasta file of same order

Generating a fasta file with the specify_ploidy.py does not result in a fasta file in the same order. Although this is not a huge issue, it seems like it should be a quick fix and would result in more consistent data.

Input:

>chrM
>chr1
>chr2
>chr3
>chr4
>chr5
>chr6
>chr7
>chr8
>chr9
>chr10
>chr11
>chr12
>chr13
>chr14
>chr15
>chr16
>chr17
>chr18
>chr19
>chr20
>chr21
>chr22
>chrX
>chrY

Result:

>chr1-hap-1
>chr1-hap-2
>chr10-hap-1
>chr10-hap-2
>chr11-hap-1
>chr11-hap-2
>chr12-hap-1
>chr12-hap-2
>chr13-hap-1
>chr13-hap-2
>chr14-hap-1
>chr14-hap-2
>chr15-hap-1
>chr15-hap-2
>chr16-hap-1
>chr16-hap-2
>chr17-hap-1
>chr17-hap-2
>chr18-hap-1
>chr18-hap-2
>chr19-hap-1
>chr19-hap-2
>chr2-hap-1
>chr2-hap-2
>chr20-hap-1
>chr20-hap-2
>chr21-hap-1
>chr21-hap-2
>chr22-hap-1
>chr22-hap-2
>chr3-hap-1
>chr3-hap-2
>chr4-hap-1
>chr4-hap-2
>chr5-hap-1
>chr5-hap-2
>chr6-hap-1
>chr6-hap-2
>chr7-hap-1
>chr7-hap-2
>chr8-hap-1
>chr8-hap-2
>chr9-hap-1
>chr9-hap-2
>chrM-hap-1
>chrM-hap-2
>chrX-hap-1
>chrX-hap-2
>chrY-hap-1
>chrY-hap-2

Where to specify the ploidy in the ini.config

Hello,

I am following the tutorial in the manual, and I see that for the, simulate_SV.py, stage, we supply a ini.config file containing:

[pysim_settings]
SV_config_file = /projects/bioinformatics/mattk_mgc/pysim_test/config_test
ref_fasta=/projects/bioinformatics/mattk_mgc/pysim_test/hg19_chr1_chr2-2.1.0.fa
dbsnp=/data/qfxing/sim/snp/dbsnp_138.hg19.vcf
chrome=chr22
somatic=Y
germline_num=10
somatic_num=10
db=N
somatic_SNP_db=''
hyp_rate=0.5
up_down_stream=50
snp_rate=0.1
indel_prob=1
min_indel_length=5
max_indel_length=15
out_prex=test_chr22_new_
sub_clone=2
sub_sub_clone=0
germ_ratio=0

I am just using chromosome1 from the human reference, and simulated the ploidy for my reference as 3-ploid. Do I use the output file generated from the specify_ploidy.py step as my reference if I did that?

Sub_sub_clone broken

pysim_main fails for sub_sub_clone != 0. Pretty sure it's because you use variable ref_somatic_new in a function call but never define it.

KeyError

python specify_ploidy.py -i ~/annotations/GRCh37-lite.fa -c config -o grch37-lite.chr10.fa
2018-06-01 10:01:22
simulation begins at:0.029685
^[]Traceback (most recent call last):
  File "specify_ploidy.py", line 80, in <module>
    main()
  File "specify_ploidy.py", line 74, in main
    ref_dic=ploidy(ref_dic,config_dic)
  File "specify_ploidy.py", line 20, in ploidy
    ref_dic_new[key+'-hap-'+str(n+1)]=ref_dic[key]
KeyError: '10'
#chromName	ploidy
10	2

Recommended fix for FASTA headers in specify_ploidy.py

I kept getting key errors when running specifyploidy. I fixed the issues with the addition of the following commands. I would recommend changing your script to be more generalizable, the FASTA I am using is the one provided by 1000 Genomes.

Add this command under def read_config

newline=line.rstrip().split('\t')
# added command below ensures the keys from the cofig file and FASTA will match
if 'chr' not in newline[0]: newline[0] = 'chr'+str(newline[0])

In read_fasta

chr_name=newline.split('>')[1].split(' ').pop(0)
# previously it was chr_name=newline.split('>')[1]
# This is the pattern of the FASTA header I am using ">1 dna:chromosome chromosome:GRCh37:1:1:249250621:1" 

Thanks!

bugs

Hi,
I am not a python specialist, but I tried to simulate germline SV using this code. Although the program is promising, it didn't run very smoothly in my case using python 3. What I struggled with was

  1. I had to update some scripts from python 2 to 3 (e.g. pysim1.py)
  2. I had to install ART function art_illumina from https://www.niehs.nih.gov/research/resources/software/biostatistics/art/index.cfm (make sure path to art_illumina in run_art.py is correct)
  3. I had to change the way GC_bias.py reads the options for -g (GC file) to make GC_v1.0.?.py create the GC_content.txt file. The main code indicates that if no file is provided ("opts.input_GC is None") input_GC should be "GC_content.txt", however the GC_v1.0.?.py file expect input_GC to be None, need to make it matching. (I changed line 295 in GC_v1.0.2.py from " if opts.input_GC == None: "
    into " if opts.input_GC == 'GC_content.txt': ")

Now it finally seems to work well, so I hope this will help future users in running this (in python 3). Very pleased with a program to simulate SV from reference genomes. So many thanks to the developers!

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.