Skip to content

Commit

Permalink
add simulation of normal sampl and pycharm file
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderKononov committed Dec 20, 2017
1 parent 7989f7c commit 59b9a08
Show file tree
Hide file tree
Showing 9 changed files with 284 additions and 10 deletions.
13 changes: 13 additions & 0 deletions .idea/NGS-emulator.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/libraries/R_User_Library.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

198 changes: 198 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions Cover_emulator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#This script run with 3 arguments first is comand '-normal',
# second is lengh of DNA data
# and third is mean resd depth of normal sample.
#Then script create template for data with 3 chromosome and with noted summery DNA lengh and mean read depth.

import sys

def createNormalTemplate(simulation, DNAlengh, meanDP):
project_file=open(simulation, 'w')
project_file.write('# '+simulation+'\n# start\tend\tmeanDP\n')
project_file.write(str(1)+'\t'+str(DNAlengh)+'\t'+str(meanDP))
project_file.close()

def test_createNormalTemplate():
createNormalTemplate('test_createNormalTemplate', 20, 10)
test_file=open('test_createNormalTemplate', 'r')
for i in test_file:
if i[0]!='#':
result = i.strip().split()
assert result[0] == '1'
assert result[1] == '20'
assert result[2] == '10'

arg=sys.argv

if arg[1]=='-normal':
createNormalTemplate('current_project', arg[2], arg[3])


27 changes: 17 additions & 10 deletions Emulatior_v0.1.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@

# coding: utf-8

# In[16]:

import numpy as np
import random
import copy
import sys

#N_observ=10
#N_subclones=2
N_observ=int(raw_input('Size of emulated data?'))
N_subclones=int(raw_input('Number of emulated subclones?'))
norm_data=np.zeros((N_observ,4))
N_observations=100
N_subclones=2
exprestion=20
non-abberant_cells=0.2
#N_observ=int(raw_input('Size of emulated data?'))
#N_subclones=int(raw_input('Number of emulated subclones?'))
norm_data=np.zeros((N_observations,4))

change_frame=N_observations/(N_subclones+2)

normal_CNA=np.random.poisson(exprestion, N_observations)
subclon_CNA_data={}
for i in range(N_subclones):
current_subclone_data=normal_CNA
current_subclone_data[j]+=i*exprestion for j in range(i*change_frame,(i+1)*change_frame)

subclon_CNA_data[1]=[]
# DP Emulate
for i in norm_data:
i[0]=1
Expand Down
3 changes: 3 additions & 0 deletions current_project
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# current_project
# start end meanDP
1 30 10

0 comments on commit 59b9a08

Please sign in to comment.