def test_properties(self): """Test passing options via properties.""" cline = ClustalwCommandline(clustalw_exe) cline.infile = "Fasta/f002" cline.outfile = "temp_test.aln" cline.align = True self.standard_test_procedure(cline)
if newtree_file is not None: print "requesting output guide tree file %s" % repr(newtree_file) # Any filenames with spaces should get escaped with quotes automatically. # Using keyword arguments here. if clustalw_exe == "clustalw2": # By using the stats keyword, we require ClustalW 2.0.10 or higher. cline = ClustalwCommandline(clustalw_exe, infile=input_file, outfile=output_file, stats=statistics_file) else: cline = ClustalwCommandline(clustalw_exe, infile=input_file, outfile=output_file) assert str(eval(repr(cline))) == str(cline) if newtree_file is not None: # Test using a property: cline.newtree = newtree_file # I don't just want the tree, also want the alignment: cline.align = True assert str(eval(repr(cline))) == str(cline) output, error = cline() assert output.strip().startswith("CLUSTAL") assert error.strip() == "" # 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)) if clustalw_exe == "clustalw2": assert os.path.isfile(statistics_file) os.remove(statistics_file) output_records = SeqIO.to_dict(SeqIO.parse(output_file, "clustal")) assert set(input_records.keys()) == set(output_records.keys()) for record in align:
% (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. cline = ClustalwCommandline(clustalw_exe, infile=input_file, outfile=output_file) assert str(eval(repr(cline))) == str(cline) if newtree_file is not None: #Test using a property: cline.newtree = newtree_file #I don't just want the tree, also want the alignment: cline.align = True assert str(eval(repr(cline))) == str(cline) #print cline output, error = cline() assert output.strip().startswith("CLUSTAL") assert error.strip() == "" #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 set(input_records.keys()) == set(output_records.keys()) for record in align: assert str(record.seq) == str(output_records[record.id].seq) assert str(record.seq).replace("-","") == \