예제 #1
0
    def test_newtree(self):
        """Test newtree files."""
        input_file = "Registry/seqs.fasta"
        output_file = "temp_test.aln"
        newtree_file = "temp_test.dnd"
        cline = ClustalwCommandline(
            clustalw_exe, infile=input_file, outfile=output_file, newtree=newtree_file, align=True
        )

        self.standard_test_procedure(cline)
        cline.newtree = "temp with space.dnd"
        self.standard_test_procedure(cline)
예제 #2
0
    def test_newtree(self):
        """Test newtree files."""
        input_file = "Registry/seqs.fasta"
        output_file = "temp_test.aln"
        newtree_file = "temp_test.dnd"
        cline = ClustalwCommandline(clustalw_exe,
                                    infile=input_file,
                                    outfile=output_file,
                                    newtree=newtree_file,
                                    align=True)

        self.standard_test_procedure(cline)
        cline.newtree = "temp with space.dnd"
        self.standard_test_procedure(cline)
예제 #3
0
    print "Calling clustalw on %s (with %i records)" % (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 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"))
예제 #4
0
        os.remove(output_file)
    print "Calling clustalw on %s (with %i records)" \
          % (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: