Mercurial > repos > yhoogstrate > samtools_parallel_mpileup
annotate test-data/generate_reads.py @ 0:460f0749aac5 draft default tip
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
author | yhoogstrate |
---|---|
date | Thu, 05 Nov 2015 07:49:02 -0500 |
parents | |
children |
rev | line source |
---|---|
0
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
1 #!/usr/bin/env python |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
2 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
3 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
4 import random |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
5 import math |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
6 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
7 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
8 __version_info__ = ('1', '0', '0') |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
9 __version__ = '.'.join(__version_info__) |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
10 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
11 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
12 class Region: |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
13 def __init__(self,start,stop,sequence): |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
14 self.start = start |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
15 self.stop = stop |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
16 self.sequence = sequence.strip().replace("\n","").replace(" ","") |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
17 if(len(self.sequence) != self.getSpanningLength()): |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
18 print "ERROR: sequence length: "+str(len(self.sequence))+", while spanning region is: "+str(self.getSpanningLength()) |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
19 import sys |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
20 sys.exit() |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
21 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
22 def getSpanningLength(self): |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
23 return abs(self.stop-self.start+1) |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
24 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
25 class ReadSynthesizer: |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
26 def __init__(self,chromosome): |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
27 self.regions = [] |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
28 self.chromosome = chromosome |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
29 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
30 def addRegion(self,region): |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
31 self.regions.append(region) |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
32 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
33 def produceReads(self,readDensity = 1,read_length = 50): |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
34 """ |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
35 Produces uniform reads by walking iteratively over self.regions |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
36 """ |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
37 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
38 mRNA = self.getTotalmRNA() |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
39 spanning_length = self.getRegionSpanningLength() |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
40 n = spanning_length['total'] - read_length + 1 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
41 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
42 j = 0 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
43 k = 0 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
44 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
45 for i in range(n): |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
46 # "alpha is playing the role of k and beta is playing the role of theta" |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
47 dd = max(0,int(round(random.lognormvariate(math.log(readDensity),0.5))))# Notice this is NOT a binomial distribution!! |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
48 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
49 for d in range(dd): |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
50 sequence = mRNA[i:i+read_length] |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
51 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
52 if(random.randint(0,1) == 0): |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
53 strand = 0 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
54 else: |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
55 strand = 16 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
56 flag = strand + 0 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
57 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
58 print "read_"+str(j)+"."+str(i)+"."+str(d)+"\t"+str(flag)+"\t"+self.chromosome+"\t"+str(self.regions[j].start + k)+"\t60\t"+self.getMappingString(read_length,j,k)+"\t*\t0\t0\t"+str(sequence.upper())+"\t*" |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
59 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
60 spanning_length['iter'][j] -= 1 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
61 if(k >= self.regions[j].getSpanningLength()-1): |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
62 j += 1 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
63 k = 0 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
64 else: |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
65 k += 1 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
66 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
67 def getMappingString(self,length,j,offset): |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
68 m = 0 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
69 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
70 out = "" |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
71 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
72 for i in range(length): |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
73 k = i + offset |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
74 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
75 if(k >= self.regions[j].getSpanningLength()): |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
76 j += 1 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
77 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
78 out += str(m)+"M" |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
79 out += (str(self.regions[j].start - self.regions[j-1].stop-1))+"N" |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
80 m = 1 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
81 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
82 offset = -k |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
83 else: |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
84 m += 1 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
85 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
86 out += str(m) + "M" |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
87 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
88 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
89 return out |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
90 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
91 def getRegionSpanningLength(self): |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
92 length = {'total':0,'iter':[]} |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
93 for r in self.regions: |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
94 l = r.getSpanningLength() |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
95 length['iter'].append(l) |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
96 length['total'] += l |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
97 return length |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
98 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
99 def getTotalmRNA(self): |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
100 mRNA = "" |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
101 for r in self.regions: |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
102 mRNA += r.sequence |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
103 return mRNA |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
104 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
105 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
106 |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
107 if __name__ == "__main__": |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
108 # Artificial SNP |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
109 rs = ReadSynthesizer('chr1') |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
110 rs.addRegion(Region( 0+1, 59+1,'aaataggtcccaaacgttacgca'+'G'+'tctatgcctgacaaagttgcgaccacttcctctgcc'))#c -> G |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
111 rs.addRegion(Region( 60+1,119+1,'ttgtgtgacacgccggagatagg'+'A'+'catcagcaagtacgttaagtacactgaacgaactgg'))#g -> A |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
112 rs.addRegion(Region(120+1,179+1,'aggtttctacatcgtgcgtgatggc'+'C'+'ctaggagaagtgggtgtatctgcacagcataagt'))#t -> C |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
113 rs.addRegion(Region(180+1,239+1,'tataagacggaagtaaagcgtcttc'+'G'+'ccgttcagcaccccacgctcatagtcaatgctgg'))#a -> G |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
114 #rs.addRegion(Region(240+1,299+1,'ttcagcatagtcaagcgccggtggcctccaaaaagacgcactgagtagcttagctacttt')) |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
115 #rs.addRegion(Region(300+1,359+1,'gctccgcttgcggaagcactaagaggagattgaatttccaaatcccccccgatacctgtg')) |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
116 #rs.addRegion(Region(360+1,419+1,'cggtcgctacgtaagtgcgaagttctgttagatacgctccccttagtatatgggcgttaa')) |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
117 #rs.addRegion(Region(420+1,479+1,'tcggaccgtcggtactcactgcattccaggtctcatatagttcgccctagaagcctggga')) |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
118 rs.addRegion(Region(480+1,539+1,'tgaacgttgaacta'+'GCC'+'ctgatgtaaaccccgcgtgccaattccaggcgtcatgggggca'))#tag -> gcc |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
119 #rs.addRegion(Region(540+1,599+1,'acccctcgcagcctccctcttgctgttggtgcctagtatttcatgatttcgagccgacat')) |
460f0749aac5
planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/samtools_parallel_mpileup_galaxy_wrapper commit ede01f67a8def5be7c88d5c31c2435b3946f1523-dirty
yhoogstrate
parents:
diff
changeset
|
120 rs.produceReads(2,35) |