tabtk 1.0.6__tar.gz → 1.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tabtk-1.0.6 → tabtk-1.0.7}/PKG-INFO +1 -1
- {tabtk-1.0.6 → tabtk-1.0.7}/tabtk/__init__.py +1 -1
- {tabtk-1.0.6 → tabtk-1.0.7}/tabtk/tabtk.py +12 -10
- {tabtk-1.0.6 → tabtk-1.0.7}/tabtk.egg-info/PKG-INFO +1 -1
- {tabtk-1.0.6 → tabtk-1.0.7}/LICENSE +0 -0
- {tabtk-1.0.6 → tabtk-1.0.7}/README.md +0 -0
- {tabtk-1.0.6 → tabtk-1.0.7}/pyproject.toml +0 -0
- {tabtk-1.0.6 → tabtk-1.0.7}/setup.cfg +0 -0
- {tabtk-1.0.6 → tabtk-1.0.7}/tabtk/__main__.py +0 -0
- {tabtk-1.0.6 → tabtk-1.0.7}/tabtk.egg-info/SOURCES.txt +0 -0
- {tabtk-1.0.6 → tabtk-1.0.7}/tabtk.egg-info/dependency_links.txt +0 -0
- {tabtk-1.0.6 → tabtk-1.0.7}/tabtk.egg-info/entry_points.txt +0 -0
- {tabtk-1.0.6 → tabtk-1.0.7}/tabtk.egg-info/requires.txt +0 -0
- {tabtk-1.0.6 → tabtk-1.0.7}/tabtk.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tabtk
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.7
|
|
4
4
|
Summary: tabtk: A toolkit for sequence similarity analysis based on tabular data
|
|
5
5
|
Author-email: Chrispin Chaguza <chrispin.chaguza@gmail.com>
|
|
6
6
|
Maintainer-email: Chrispin Chaguza <chrispin.chaguza@gmail.com>
|
|
@@ -172,25 +172,24 @@ def blastSimilarity(cmdValues):
|
|
|
172
172
|
Cmd2 = f"makeblastdb -in {tmpOut} -dbtype nucl"
|
|
173
173
|
|
|
174
174
|
subprocess.call(Cmd2,shell=True,stdout=subprocess.DEVNULL,stderr=subprocess.STDOUT)
|
|
175
|
-
|
|
175
|
+
|
|
176
176
|
print("Calculating percent similarity... may take longer... be patient...")
|
|
177
177
|
|
|
178
178
|
tmpOut1 = f"blast.{str(datetime.datetime.now()).replace(" ","").replace("-",".").replace(":",".")}"
|
|
179
179
|
tmpOut2 = f"blast.{str(datetime.datetime.now()).replace(" ","").replace("-",".").replace(":",".")}"
|
|
180
180
|
|
|
181
181
|
blastCmd1 = f"echo \'qseqid sseqid length pident qcovs\' | tr \' \' \'\\t\' > {tmpOut2}"
|
|
182
|
-
blastCmd2 = f"blastn -db {tmpOut} -query {tmpOut} -word_size {cmdValues["length"]} -num_threads {cmdValues["threads"]} -outfmt \'6 qseqid sseqid length pident qcovs\' -evalue
|
|
182
|
+
blastCmd2 = f"blastn -db {tmpOut} -query {tmpOut} -word_size {cmdValues["length"]} -num_threads {cmdValues["threads"]} -outfmt \'6 qseqid sseqid length pident qcovs\' -evalue {cmdValues["evalue"]} >> {tmpOut2}"
|
|
183
183
|
|
|
184
184
|
subprocess.call(blastCmd1,shell=True,stdout=subprocess.DEVNULL,stderr=subprocess.STDOUT)
|
|
185
185
|
subprocess.call(blastCmd2,shell=True,stdout=subprocess.DEVNULL,stderr=subprocess.STDOUT)
|
|
186
186
|
|
|
187
|
-
blastData = pd.read_csv(tmpOut2,delimiter="\t",dtype={'pident': float,'qcovs': float})
|
|
187
|
+
blastData = pd.read_csv(tmpOut2,delimiter="\t",dtype={'pident': float,'qcovs': float, 'length': int})
|
|
188
188
|
blastData["tmp"] = blastData.apply(lambda x: (x["length"] * x["pident"]),axis=1)
|
|
189
189
|
|
|
190
|
-
|
|
191
|
-
blastData["tmp"] = blastData.apply(lambda x: (((x["tmp"] / x["length"]) * x["qcovs"]) / 100),axis=1)
|
|
190
|
+
blastData = blastData[["qseqid","sseqid","tmp","length","qcovs"]].groupby(['qseqid','sseqid']).agg({'tmp':'sum','length':'sum','qcovs':'mean'}).reset_index()
|
|
192
191
|
|
|
193
|
-
|
|
192
|
+
blastData["tmp1"] = blastData.apply(lambda x: (((x["tmp"] / x["length"]) * x["qcovs"]) / 100),axis=1)
|
|
194
193
|
|
|
195
194
|
blastData["qseqidR"] = blastData.apply(lambda x: x["qseqid"] if x["qseqid"] > x["sseqid"] else x["sseqid"],axis=1)
|
|
196
195
|
blastData["sseqidR"] = blastData.apply(lambda x: x["sseqid"] if x["qseqid"] > x["sseqid"] else x["qseqid"],axis=1)
|
|
@@ -198,10 +197,9 @@ def blastSimilarity(cmdValues):
|
|
|
198
197
|
blastData["qseqid"] = blastData["qseqidR"]
|
|
199
198
|
blastData["sseqid"] = blastData["sseqidR"]
|
|
200
199
|
|
|
201
|
-
blastDataR = blastData[["qseqid","sseqid","
|
|
202
|
-
blastDataR = blastDataR.reset_index()
|
|
200
|
+
blastDataR = blastData[["qseqid","sseqid","tmp1"]].groupby(['qseqid','sseqid']).agg({'tmp1':'min'}).reset_index()
|
|
203
201
|
|
|
204
|
-
blastDataFinal = blastDataR[["sseqid","qseqid","
|
|
202
|
+
blastDataFinal = blastDataR[["sseqid","qseqid","tmp1"]].rename(columns={"sseqid":"seq1","qseqid":"seq2","tmp1":"pid"}).values.tolist()
|
|
205
203
|
|
|
206
204
|
bar = ChargingBar("Cleaning temporary files", max=len(fileNames))
|
|
207
205
|
for fileName in tmpFileNames:
|
|
@@ -334,7 +332,7 @@ def similarity(cmdValues):
|
|
|
334
332
|
|
|
335
333
|
bar = ChargingBar('Writing similarity values', max=len(similarityResults))
|
|
336
334
|
for itemPair in similarityResults:
|
|
337
|
-
simData.write(f"{"\t".join([str(r) for r in itemPair])}\n")
|
|
335
|
+
simData.write(f"{"\t".join([str(r).strip() for r in itemPair])}\n")
|
|
338
336
|
|
|
339
337
|
bar.next()
|
|
340
338
|
bar.finish()
|
|
@@ -1365,6 +1363,9 @@ def tabtkMain():
|
|
|
1365
1363
|
similarityOptions.add_argument('--fragment','-r',action='store',required=False,nargs=1,
|
|
1366
1364
|
metavar='fragment',dest='fragment',default=500,type=int,
|
|
1367
1365
|
help='Fragment length for calculating ANI; use with --fastani (default: 500)')
|
|
1366
|
+
similarityOptions.add_argument('--evalue','-e',action='store',required=False,nargs=1,
|
|
1367
|
+
metavar='evalue',dest='evalue',default=0.001,type=float,
|
|
1368
|
+
help='Minimum evalue for hits; use with --blast (default: 0.001)')
|
|
1368
1369
|
similarityOptions.add_argument('--threads','-t',action='store',required=False,nargs=1,
|
|
1369
1370
|
metavar='threads',dest='threads',default=5,type=int,
|
|
1370
1371
|
help='Number of threads (default: 5)')
|
|
@@ -1590,6 +1591,7 @@ def tabtkMain():
|
|
|
1590
1591
|
'fastani': options.fastani,
|
|
1591
1592
|
'blast': options.blast,
|
|
1592
1593
|
'aln': options.aln,
|
|
1594
|
+
'evalue': float(options.evalue[0:][0]) if isinstance(options.evalue,list) else float(options.evalue),
|
|
1593
1595
|
'threads': int(options.threads[0:][0]) if isinstance(options.threads,list) else int(options.threads)
|
|
1594
1596
|
}
|
|
1595
1597
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tabtk
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.7
|
|
4
4
|
Summary: tabtk: A toolkit for sequence similarity analysis based on tabular data
|
|
5
5
|
Author-email: Chrispin Chaguza <chrispin.chaguza@gmail.com>
|
|
6
6
|
Maintainer-email: Chrispin Chaguza <chrispin.chaguza@gmail.com>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|