Skip to content

Commit

Permalink
add code to remove temporary files
Browse files Browse the repository at this point in the history
  • Loading branch information
xiezhq committed Mar 26, 2021
1 parent 862bf8a commit 7186c32
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ Let's try an example, NC_012624.fna.

<a name="Release"></a>
## Release History
- 1.7.2.2.2
- add code to remove temporary files (created by tempfile.NamedTemporaryFile()) once blastn search completes in case that large amounts of temporary files consume too much space. (Thanks Biancamaria for the suggestion)
- 1.7.2.2
- ISEScan can output .csv (columns are separated by `,`) and .tsv (columns are separated by `tab`) result files, which are much easier for users to parse the results (Thanks oschwengers for his suggestion)
- add command options `--seqfile` and `--output` to remove the positional parmater `seqfile`, `proteome` and `hmm` (Thanks oschwengers for his suggestion)
Expand Down
2 changes: 1 addition & 1 deletion isescan.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

# ISEScan version
version = '1.7.2.2.1'
version = '1.7.2.2.2'

import argparse
import os
Expand Down
2 changes: 2 additions & 0 deletions pred.py
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,8 @@ def getFullIS4seqOnStream(args):
query = orfExtSeqFile
blastOut4orfExt, err = tools.doBlastn2seqOnStream(nthread, query, fp.name, strand='both', task='megablast',
perc_ident=constants.SIM4ISO)
tools.deleteFile(fp.name)

if len(err) > 0:
#e = 'Blastn ISs in {} against {}: {}'.format(seqid, db, err)
e = 'Blastn ISs in {} against {}: {}'.format(seqid, seqid, err)
Expand Down
9 changes: 9 additions & 0 deletions tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,15 @@ def seq2blastdb(seqFile, db):
do_cmd = shlex.split(' '.join(cmdline))
subprocess.check_call(do_cmd, shell=False, universal_newlines=False, stdout=subprocess.DEVNULL)

# delete the file pointing by full path f.
# f: /path/to/file, a character string
def deleteFile(f):
cmd = 'rm'
cmdline = [cmd, f]
do_cmd = shlex.split(' '.join(cmdline))
subprocess.check_call(do_cmd, shell=False, universal_newlines=False, stdout=subprocess.DEVNULL)


# Search all IS elements (Tpase) ORFs against IS element (Tpase ORF) database.
# command: blastn -query /home/data/insertion_sequence/output4FragGeneScan1.19_illumina_5/NC_002754.1.fna.ffn \
# -db /home/data/insertion_sequence/blastdb/NC_002754.1.fna.ffn -out blast.6 \
Expand Down

0 comments on commit 7186c32

Please sign in to comment.