Skip to content

Commit

Permalink
Protect against same input/output file for trim.py
Browse files Browse the repository at this point in the history
  • Loading branch information
davidemms committed Jul 8, 2021
1 parent cf3bcc9 commit 1b3f37c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions scripts_of/trim.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ def main(infn, outfn, f=0.1, n_min=500, c=0.75):
print("ERROR, input file does not exist: %s" % infn)
sys.exit()
try:
with open(outfn, 'w') as outfile:
outfile.write("\n")
# BEWARE: Input and output files may be the same
with open(outfn, 'a') as outfile:
outfile.write(" ")
except:
print("ERROR, cannot write to output file: %s" % outfn)
sys.exit()
Expand Down
2 changes: 1 addition & 1 deletion scripts_of/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
SequencesInfo = namedtuple("SequencesInfo", "nSeqs nSpecies speciesToUse seqStartingIndices nSeqsPerSpecies") # speciesToUse - list of ints

picProtocol = 1
version = "2.5.3"
version = "2.5.4"

def PrintNoNewLine(text):
parallel_task_manager.PrintNoNewLine(text)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_orthofinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
goldResultsDir_smallExample = baseDir + "ExpectedOutput/SmallExampleDataset/"
goldPrepareBlastDir = baseDir + "ExpectedOutput/SmallExampleDataset_PreparedForBlast/"

version = "2.5.2"
version = "2.5.4"
requiredBlastVersion = "2.2.28+"

standard_new_files = ("Orthogroups.csv Orthogroups.GeneCount.csv SingleCopyOrthogroups.txt Orthogroups_UnassignedGenes.csv Orthogroups.txt clusters_OrthoFinder_I1.5.txt_id_pairs.txt clusters_OrthoFinder_I1.5.txt OrthoFinder_graph.txt Statistics_PerSpecies.csv Statistics_Overall.csv Orthogroups_SpeciesOverlaps.csv").split()
Expand Down

0 comments on commit 1b3f37c

Please sign in to comment.