tabtk 1.0.2__tar.gz → 1.0.3__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.2 → tabtk-1.0.3}/PKG-INFO +1 -1
- {tabtk-1.0.2 → tabtk-1.0.3}/tabtk/__init__.py +1 -1
- {tabtk-1.0.2 → tabtk-1.0.3}/tabtk/tabtk.py +18 -8
- {tabtk-1.0.2 → tabtk-1.0.3}/tabtk.egg-info/PKG-INFO +1 -1
- {tabtk-1.0.2 → tabtk-1.0.3}/LICENSE +0 -0
- {tabtk-1.0.2 → tabtk-1.0.3}/README.md +0 -0
- {tabtk-1.0.2 → tabtk-1.0.3}/pyproject.toml +0 -0
- {tabtk-1.0.2 → tabtk-1.0.3}/setup.cfg +0 -0
- {tabtk-1.0.2 → tabtk-1.0.3}/tabtk/__main__.py +0 -0
- {tabtk-1.0.2 → tabtk-1.0.3}/tabtk.egg-info/SOURCES.txt +0 -0
- {tabtk-1.0.2 → tabtk-1.0.3}/tabtk.egg-info/dependency_links.txt +0 -0
- {tabtk-1.0.2 → tabtk-1.0.3}/tabtk.egg-info/entry_points.txt +0 -0
- {tabtk-1.0.2 → tabtk-1.0.3}/tabtk.egg-info/requires.txt +0 -0
- {tabtk-1.0.2 → tabtk-1.0.3}/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.3
|
|
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>
|
|
@@ -182,7 +182,7 @@ def blastSimilarity(cmdValues):
|
|
|
182
182
|
blastData["tmp"] = blastData.apply(lambda x: (x["qcovs"] * x["pident"])/100,axis=1)
|
|
183
183
|
|
|
184
184
|
blastData["qseqidR"] = blastData.apply(lambda x: x["qseqid"] if x["qseqid"] > x["sseqid"] else x["sseqid"],axis=1)
|
|
185
|
-
blastData["sseqidR"] = blastData.apply(lambda x: x["
|
|
185
|
+
blastData["sseqidR"] = blastData.apply(lambda x: x["sseqid"] if x["qseqid"] > x["sseqid"] else x["qseqid"],axis=1)
|
|
186
186
|
|
|
187
187
|
blastData["qseqid"] = blastData["qseqidR"]
|
|
188
188
|
blastData["sseqid"] = blastData["sseqidR"]
|
|
@@ -237,18 +237,28 @@ def fastaniSimilarity(cmdValues):
|
|
|
237
237
|
|
|
238
238
|
tmpOut = f"mash.{str(datetime.datetime.now()).replace(" ","").replace("-",".").replace(":",".")}"
|
|
239
239
|
|
|
240
|
-
fastaniCmd = f"fastANI --rl {cmdValues["data"]} --ql {cmdValues["data"]}
|
|
240
|
+
fastaniCmd = f"fastANI --rl {cmdValues["data"]} --ql {cmdValues["data"]} --kmer {cmdValues["length"]} --matrix --fragLen {cmdValues["fragment"]} --minFraction {cmdValues["fraction"]} --output {tmpOut} --threads {cmdValues["threads"]}"
|
|
241
241
|
|
|
242
242
|
print("Calculating percent similarity... may take longer... be patient...")
|
|
243
243
|
|
|
244
244
|
subprocess.call(fastaniCmd,shell=True,stdout=subprocess.DEVNULL,stderr=subprocess.STDOUT)
|
|
245
245
|
|
|
246
246
|
fastaniResults = []
|
|
247
|
-
|
|
247
|
+
|
|
248
248
|
with open(tmpOut,"r") as fastaniFile:
|
|
249
249
|
for itemPos,fastaniOutput in enumerate(fastaniFile):
|
|
250
250
|
item = fastaniOutput.strip().split("\t")
|
|
251
|
-
fastaniResults.append(
|
|
251
|
+
fastaniResults.append([Path(item[0]).stem,Path(item[1]).stem,float(item[2])])
|
|
252
|
+
|
|
253
|
+
fastaniData = pd.DataFrame(fastaniResults, columns=["seq1R","seq2R","pidR"])
|
|
254
|
+
fastaniData['pidR'] = fastaniData['pidR'].astype(float)
|
|
255
|
+
|
|
256
|
+
fastaniData["seq1RR"] = fastaniData.apply(lambda x: x["seq1R"] if x["seq1R"] > x["seq2R"] else x["seq2R"],axis=1)
|
|
257
|
+
fastaniData["seq2RR"] = fastaniData.apply(lambda x: x["seq2R"] if x["seq1R"] > x["seq2R"] else x["seq1R"],axis=1)
|
|
258
|
+
|
|
259
|
+
fastaniData = fastaniData[["seq1RR","seq2RR","pidR"]].groupby(['seq1RR','seq2RR']).agg({'pidR':min})
|
|
260
|
+
fastaniDataR = fastaniData.reset_index()
|
|
261
|
+
fastaniDataFinal = fastaniDataR[["seq1RR","seq2RR","pidR"]].rename(columns={"seq1RR":"seq1","seq2RR":"seq2","pid":"pidR"}).values.tolist()
|
|
252
262
|
|
|
253
263
|
if os.path.exists(tmpOut):
|
|
254
264
|
os.remove(tmpOut)
|
|
@@ -260,7 +270,7 @@ def fastaniSimilarity(cmdValues):
|
|
|
260
270
|
else:
|
|
261
271
|
pass
|
|
262
272
|
|
|
263
|
-
return(
|
|
273
|
+
return(fastaniDataFinal)
|
|
264
274
|
|
|
265
275
|
|
|
266
276
|
def similarity(cmdValues):
|
|
@@ -314,7 +324,7 @@ def similarity(cmdValues):
|
|
|
314
324
|
|
|
315
325
|
bar = ChargingBar('Writing similarity values', max=len(similarityResults))
|
|
316
326
|
for itemPair in similarityResults:
|
|
317
|
-
simData.write(f"{itemPair}\n")
|
|
327
|
+
simData.write(f"{"\t".join([str(r) for r in itemPair])}\n")
|
|
318
328
|
|
|
319
329
|
bar.next()
|
|
320
330
|
bar.finish()
|
|
@@ -1564,8 +1574,8 @@ def tabtkMain():
|
|
|
1564
1574
|
'output': options.output[0:][0] if isinstance(options.output,list) else options.output,
|
|
1565
1575
|
'length': int(options.length[0:][0]) if isinstance(options.length,list) else int(options.length),
|
|
1566
1576
|
'fragment': int(options.fragment[0:][0]) if isinstance(options.fragment,list) else int(options.fragment),
|
|
1567
|
-
'fraction':
|
|
1568
|
-
'size':
|
|
1577
|
+
'fraction': float(options.fraction[0:][0]) if isinstance(options.fraction,list) else float(options.fraction),
|
|
1578
|
+
'size': float(options.size[0:][0]) if isinstance(options.size,list) else float(options.size),
|
|
1569
1579
|
'mash': options.mash,
|
|
1570
1580
|
'fastani': options.fastani,
|
|
1571
1581
|
'blast': options.blast,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tabtk
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
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
|