Skip to content

Commit 5d3cd99

Browse files
authored
Merge pull request #86 from J35P312/master
3.1.0
2 parents 26360ab + 16d7a51 commit 5d3cd99

File tree

5 files changed

+83
-69
lines changed

5 files changed

+83
-69
lines changed

README.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ On a 30X human genome, the TIDDIT SV module typically completetes within 5 hours
88

99
INSTALLATION
1010
==============
11-
TIDDIT requires python3, cython, pysam, and Numpy; as well as bwa and fermikit (fermi2 and ropebwt2).
11+
TIDDIT requires python3, cython, pysam, and Numpy.
12+
13+
By default, tiddit will require, bwa, fermi2 and ropebwt2 for local assembly; local assembly may be disabled through the "--skip_assembly" parameter.
1214

1315
Installation
1416

17+
Cloning from Git Hub:
18+
1519
```
1620
git clone https://github.com/SciLifeLab/TIDDIT.git
1721
```
@@ -22,39 +26,38 @@ cd tiddit
2226
pip install -e .
2327
```
2428

25-
Next install fermikit, I recommend using conda:
29+
Next install fermi2, ropebwt2, and bwa, I recommend using conda:
2630

27-
```
28-
conda install fermikit
29-
```
31+
conda install fermi2 ropebwt2 bwa
3032

3133
You may also compile bwa, fermi2, and ropebwt2 yourself. Remember to add executables to path, or provide path through the command line parameters.
32-
3334
```
34-
3535
tiddit --help
36-
tiddit --sv --help
37-
tiddit --cov --help
36+
tiddit --sv --help
37+
tiddit --cov --help
3838
```
3939

4040
TIDDIT may be installed using bioconda:
41-
42-
conda install tiddit
41+
```
42+
conda install tiddit
43+
```
4344

4445
Next, you may run TIDDIT like this:
45-
46-
tiddit --help
47-
tiddit --sv
48-
tiddit --cov
46+
```
47+
tiddit --help
48+
tiddit --sv
49+
tiddit --cov
50+
```
4951

5052
TIDDIT is also distributed with a Docker container (http://singularity.lbl.gov/index.html). Type the following command to download the container:
51-
52-
singularity pull --name TIDDIT.simg
53+
```
54+
singularity pull --name TIDDIT.simg
55+
```
5356

5457
Type the following to run tiddit:
55-
56-
singularity exec TIDDIT.simg tiddit
57-
58+
```
59+
singularity exec TIDDIT.simg tiddit
60+
```
5861

5962
The SV module
6063
=============
@@ -80,6 +83,7 @@ TIDDIT may be fine-tuned by altering these optional parameters:
8083
-z minimum variant size (default=50), variants smaller than this will not be printed ( z < 10 is not recomended)
8184
--force_ploidy force the ploidy to be set to -n across the entire genome (i.e skip coverage normalisation of chromosomes)
8285
--n_mask exclude regions from coverage calculation if they contain more than this fraction of N (default = 0.5)
86+
--skip_assembly Skip running local assembly, tiddit will perform worse, but wont require fermi2, bwa, ropebwt and bwa indexed ref
8387
--bwa path to bwa executable file(default=bwa)
8488
--fermi2 path to fermi2 executable file (default=fermi2)
8589
--ropebwt2 path to ropebwt2 executable file (default=ropebwt2)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
setup(
2222
name = 'tiddit',
23-
version = '3.0.0',
23+
version = '3.1.0',
2424
url = "https://github.com/J35P312/SVDB",
2525
author = "Jesper Eisfeldt",
2626
author_email= "[email protected]",

tiddit/__main__.py

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import tiddit.tiddit_contig_analysis as tiddit_contig_analysis
1717

1818
def main():
19-
version="3.0.0"
19+
version="3.1.0"
2020
parser = argparse.ArgumentParser("""tiddit-{}""".format(version),add_help=False)
2121
parser.add_argument("--sv" , help="call structural variation", required=False, action="store_true")
2222
parser.add_argument("--cov" , help="generate a coverage bed file", required=False, action="store_true")
@@ -45,6 +45,7 @@ def main():
4545
parser.add_argument('--bwa', type=str,default="bwa", help="path to bwa executable file(default=bwa)")
4646
parser.add_argument('--fermi2', type=str,default="fermi2", help="path to fermi2 executable file (default=fermi2)")
4747
parser.add_argument('--ropebwt2', type=str , default="ropebwt2", help="path to ropebwt2 executable file (default=ropebwt2)")
48+
parser.add_argument('--skip_assembly', action="store_true", help="Skip running local assembly, tiddit will perform worse, but wont require fermi2, bwa, ropebwt and bwa indexed ref")
4849
parser.add_argument('--p_ratio', type=float,default=0.1, help="minimum discordant pair/normal pair ratio at the breakpoint junction(default=0.1)")
4950
parser.add_argument('--r_ratio', type=float,default=0.1, help="minimum split read/coverage ratio at the breakpoint junction(default=0.1)")
5051
parser.add_argument('--max_coverage', type=float,default=4, help="filter call if X times higher than chromosome average coverage (default=4)")
@@ -55,24 +56,29 @@ def main():
5556
print ("error, too low --l value!")
5657
quit()
5758

58-
if not os.path.isfile(args.bwa) and not shutil.which(args.bwa):
59-
print("error, BWA executable missing, add BWA to path, or specify using --bwa")
60-
61-
if not os.path.isfile(args.fermi2) and not shutil.which(args.fermi2):
62-
print("error, fermi2 executable missing, add fermi2 to path, or specify using --fermi2")
59+
if not args.skip_assembly:
60+
if not os.path.isfile(args.bwa) and not shutil.which(args.bwa):
61+
print("error, BWA executable missing, add BWA to path, or specify using --bwa")
62+
quit()
6363

64-
if not os.path.isfile(args.ropebwt2) and not shutil.which(args.ropebwt2):
65-
print("error, ropebwt2 executable missing, add ropebwt2 to path, or specify using --ropebwt2")
64+
if not os.path.isfile(args.fermi2) and not shutil.which(args.fermi2):
65+
print("error, fermi2 executable missing, add fermi2 to path, or specify using --fermi2")
66+
quit()
6667

67-
if args.ref:
68-
if not os.path.isfile(args.ref):
69-
print ("error, could not find the reference file")
68+
if not os.path.isfile(args.ropebwt2) and not shutil.which(args.ropebwt2):
69+
print("error, ropebwt2 executable missing, add ropebwt2 to path, or specify using --ropebwt2")
7070
quit()
7171

7272
if not os.path.isfile(args.ref+".bwt") and not os.path.isfile(args.ref+".64.bwt"):
7373
print ("error, The reference must be indexed using bwa index")
7474
quit()
7575

76+
77+
if not os.path.isfile(args.ref):
78+
print ("error, could not find the reference file")
79+
quit()
80+
81+
7682
if not (args.bam.endswith(".bam") or args.bam.endswith(".cram")):
7783
print ("error, the input file is not a bam file, make sure that the file extension is .bam or .cram")
7884
quit()
@@ -134,18 +140,20 @@ def main():
134140
print(time.time()-t)
135141

136142

137-
t=time.time()
138-
tiddit_contig_analysis.main(prefix,sample_id,library,contigs,coverage_data,args)
139-
print("Clip read assembly in:")
140-
print(time.time()-t)
143+
if not args.skip_assembly:
144+
145+
t=time.time()
146+
tiddit_contig_analysis.main(prefix,sample_id,library,contigs,coverage_data,args)
147+
print("Clip read assembly in:")
148+
print(time.time()-t)
141149

142150
vcf_header=tiddit_vcf_header.main( bam_header,library,sample_id,version )
143151

144152
if not args.e:
145153
args.e=int(library["avg_insert_size"]/2.0)
146154

147155
t=time.time()
148-
sv_clusters=tiddit_cluster.main(prefix,contigs,contig_length,samples,library["mp"],args.e,args.l,max_ins_len,args.min_contig)
156+
sv_clusters=tiddit_cluster.main(prefix,contigs,contig_length,samples,library["mp"],args.e,args.l,max_ins_len,args.min_contig,args.skip_assembly)
149157

150158
print("generated clusters in")
151159
print(time.time()-t)

tiddit/tiddit_cluster.pyx

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def find_discordant_pos(fragment,is_mp):
3737

3838
return(posA,posB)
3939

40-
def main(prefix,chromosomes,contig_length,samples,is_mp,epsilon,m,max_ins_len,min_contig):
40+
def main(prefix,chromosomes,contig_length,samples,is_mp,epsilon,m,max_ins_len,min_contig,skip_assembly):
4141

4242
discordants={}
4343
contigs=set([])
@@ -103,38 +103,39 @@ def main(prefix,chromosomes,contig_length,samples,is_mp,epsilon,m,max_ins_len,mi
103103
positions[chrA][chrB].append([int(posA),int(posB),i])
104104
i+=1
105105

106-
for line in open("{}_tiddit/contigs_{}.tab".format(prefix,sample)):
107-
content=line.rstrip().split("\t")
108-
chrA=content[1]
109-
chrB=content[2]
106+
if not skip_assembly:
107+
for line in open("{}_tiddit/contigs_{}.tab".format(prefix,sample)):
108+
content=line.rstrip().split("\t")
109+
chrA=content[1]
110+
chrB=content[2]
110111

111-
if contig_length[chrA] < min_contig or contig_length[chrB] < min_contig:
112-
continue
112+
if contig_length[chrA] < min_contig or contig_length[chrB] < min_contig:
113+
continue
113114

114115

115-
if not chrA in positions:
116-
positions[chrA]={}
117-
if not chrB in positions[chrA]:
118-
positions[chrA][chrB]=[]
116+
if not chrA in positions:
117+
positions[chrA]={}
118+
if not chrB in positions[chrA]:
119+
positions[chrA][chrB]=[]
119120

120-
if not chrA in discordants:
121-
discordants[chrA]={}
122-
if not chrB in discordants[chrA]:
123-
discordants[chrA][chrB]=[]
121+
if not chrA in discordants:
122+
discordants[chrA]={}
123+
if not chrB in discordants[chrA]:
124+
discordants[chrA][chrB]=[]
124125

125126

126-
posA=content[3]
127-
posB=content[5]
127+
posA=content[3]
128+
posB=content[5]
128129

129-
if int(posA) > contig_length[chrA]:
130-
posA=contig_length[chrA]
131-
if int(posB) > contig_length[chrB]:
132-
posB=contig_length[chrB]
130+
if int(posA) > contig_length[chrA]:
131+
posA=contig_length[chrA]
132+
if int(posB) > contig_length[chrB]:
133+
posB=contig_length[chrB]
133134

134-
discordants[chrA][chrB].append([content[0],sample,"A",posA,content[4],posB,content[6],i])
135-
positions[chrA][chrB].append([int(posA),int(posB),i])
136-
contigs.add(i)
137-
i+=1
135+
discordants[chrA][chrB].append([content[0],sample,"A",posA,content[4],posB,content[6],i])
136+
positions[chrA][chrB].append([int(posA),int(posB),i])
137+
contigs.add(i)
138+
i+=1
138139

139140
candidates={}
140141
for chrA in chromosomes:

tiddit/tiddit_variant.pyx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,16 @@ def main(str bam_file_name,dict sv_clusters,args,dict library,int min_mapq,sampl
176176

177177
contig_seqs={}
178178
new_seq=False
179-
for line in open("{}_tiddit/clips.fa.assembly.clean.mag".format(args.o)):
179+
if not args.skip_assembly:
180+
for line in open("{}_tiddit/clips.fa.assembly.clean.mag".format(args.o)):
180181

181-
if not new_seq and line[0] == "@" and "\t" in line:
182-
name=line.split("\t")[0][1:]
183-
new_seq=True
182+
if not new_seq and line[0] == "@" and "\t" in line:
183+
name=line.split("\t")[0][1:]
184+
new_seq=True
184185

185-
elif new_seq:
186-
contig_seqs[name]=line.strip("\n")
187-
new_seq=False
186+
elif new_seq:
187+
contig_seqs[name]=line.strip("\n")
188+
new_seq=False
188189

189190
for chrA in sv_clusters:
190191
variants[chrA]=[]

0 commit comments

Comments
 (0)