def test_newtree_files(self): """Test requesting a guide tree.""" input_file = "Fasta/f002" output_file = "temp_test.aln" newtree_file = "temp_test.dnd" cline = ClustalOmegaCommandline( clustalo_exe, infile=input_file, outfile=output_file, guidetree_out=newtree_file, outfmt="clustal" ) self.standard_test_procedure(cline) cline.guidetree_out = "temp with space.dnd" self.standard_test_procedure(cline)
def test_newtree_files(self): """Test requesting a guide tree.""" input_file = "Fasta/f002" output_file = "temp_test.aln" newtree_file = "temp_test.dnd" cline = ClustalOmegaCommandline(clustalo_exe, infile=input_file, outfile=output_file, guidetree_out=newtree_file, outfmt="clustal") self.standard_test_procedure(cline) cline.guidetree_out = "temp with space.dnd" self.standard_test_procedure(cline)
% (repr(input_file), len(input_records)) print "using output file %s" % repr(output_file) if newtree_file is not None: print "requesting output guide tree file %s" % repr(newtree_file) #Any filesnames with spaces should get escaped with quotes automatically. #Using keyword arguments here, force=True to over-write the output file. cline = ClustalOmegaCommandline(clustalo_exe, infile=input_file, outfile=output_file, outfmt="clustal", force=True) assert str(eval(repr(cline)))==str(cline) if newtree_file is not None: #Test using a property: cline.guidetree_out = newtree_file assert str(eval(repr(cline)))==str(cline) #print cline output, error = cline() #assert output, "No output from: %s\n%s" % (cline, error) assert not output or output.strip().startswith("CLUSTAL"), output assert error.strip() == "" or \ error.startswith("WARNING: Sequence type is DNA."), error #Check the output... align = AlignIO.read(output_file, "clustal") #The length of the alignment will depend on the version of clustalw #(clustalw 2.0.10 and clustalw 1.83 are certainly different). print "Got an alignment, %i sequences" % (len(align)) output_records = SeqIO.to_dict(SeqIO.parse(output_file,"clustal")) assert len(set(input_records.keys())) == len(set(output_records.keys())), \ "%r vs %r" %(sorted(input_records.keys()), sorted(output_records.keys()))