Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(114)  |  Call(114)  |  Derive(0)  |  Import(0)
Turns an alignment file into a single MultipleSeqAlignment object.

Arguments:
 - handle    - handle to the file, or the filename as a string
               (note older versions of Biopython only took a handle).
 - format    - string describing the file format.
 - alphabet  - optional Alphabet object, useful when the sequence type
               cannot be automatically inferred from the file itself
               (e.g. fasta, phylip, clustal)
 - seq_count - Optional integer, number of sequences expected in each(more...)

        def read(handle, format, seq_count=None, alphabet=None):
    """Turns an alignment file into a single MultipleSeqAlignment object.

    Arguments:
     - handle    - handle to the file, or the filename as a string
                   (note older versions of Biopython only took a handle).
     - format    - string describing the file format.
     - alphabet  - optional Alphabet object, useful when the sequence type
                   cannot be automatically inferred from the file itself
                   (e.g. fasta, phylip, clustal)
     - seq_count - Optional integer, number of sequences expected in each
                   alignment.  Recommended for fasta format files.

    If the handle contains no alignments, or more than one alignment,
    an exception is raised.  For example, using a PFAM/Stockholm file
    containing one alignment:

    >>> from Bio import AlignIO
    >>> filename = "Clustalw/protein.aln"
    >>> format = "clustal"
    >>> alignment = AlignIO.read(filename, format)
    >>> print("Alignment of length %i" % alignment.get_alignment_length())
    Alignment of length 411

    If however you want the first alignment from a file containing
    multiple alignments this function would raise an exception.

    >>> from Bio import AlignIO
    >>> filename = "Emboss/needle.txt"
    >>> format = "emboss"
    >>> alignment = AlignIO.read(filename, format)
    Traceback (most recent call last):
        ...
    ValueError: More than one record found in handle

    Instead use:

    >>> from Bio import AlignIO
    >>> filename = "Emboss/needle.txt"
    >>> format = "emboss"
    >>> alignment = next(AlignIO.parse(filename, format))
    >>> print("First alignment has length %i" % alignment.get_alignment_length())
    First alignment has length 124

    You must use the Bio.AlignIO.parse() function if you want to read multiple
    records from the handle.
    """
    iterator = parse(handle, format, seq_count, alphabet)
    try:
        first = next(iterator)
    except StopIteration:
        first = None
    if first is None:
        raise ValueError("No records found in handle")
    try:
        second = next(iterator)
    except StopIteration:
        second = None
    if second is not None:
        raise ValueError("More than one record found in handle")
    if seq_count:
        assert len(first) == seq_count
    return first
        


src/b/i/biopython-HEAD/Doc/examples/make_subsmat.py   biopython(Download)
 
# get an alignment object from a Clustalw alignment output
c_align = AlignIO.read('protein.aln', 'clustal',
                       alphabet=Gapped(IUPAC.protein))
summary_align = AlignInfo.SummaryInfo(c_align)

src/b/i/biopython-HEAD/Doc/examples/clustal_run.py   biopython(Download)
 
# Parse the output
alignment = AlignIO.read("test.aln", "clustal",
                         alphabet=Gapped(IUPAC.unambiguous_dna))
 

src/b/i/biopython-1.63/Doc/examples/make_subsmat.py   biopython(Download)
 
# get an alignment object from a Clustalw alignment output
c_align = AlignIO.read('protein.aln', 'clustal',
                       alphabet=Gapped(IUPAC.protein))
summary_align = AlignInfo.SummaryInfo(c_align)

src/b/i/biopython-1.63/Doc/examples/clustal_run.py   biopython(Download)
 
# Parse the output
alignment = AlignIO.read("test.aln", "clustal",
                         alphabet=Gapped(IUPAC.unambiguous_dna))
 

src/i/v/ivy-phylo-20120228/ivy/align.py   ivy-phylo(Download)
        write(">%s\n%s\n" % (x.id, x.seq))
    out = p.communicate()[0]
    aln = AlignIO.read(StringIO(out), 'fasta', alphabet=IUPAC.ambiguous_dna)
    return aln
 
    p = Popen(cmd.split(), stdout=PIPE)
    out = p.communicate()[0]
    aln = AlignIO.read(StringIO(out), 'fasta', alphabet=IUPAC.ambiguous_dna)
    f1.file.close(); f2.file.close()
    return aln
            name = strip(data)
            with open(data) as f:
                return AlignIO.read(f, format, alphabet=IUPAC.ambiguous_dna)
        else:
            f = StringIO(data)
            return AlignIO.read(f, format, alphabet=IUPAC.ambiguous_dna)
 
    elif (hasattr(data, "tell") and hasattr(data, "read")):
        treename = strip(getattr(data, "name", None))
        return AlignIO.read(data, format, alphabet=IUPAC.ambiguous_dna)

src/m/d/MDAnalysis-0.8.1/MDAnalysis/analysis/align.py   MDAnalysis(Download)
        logger.info("Using provided alignment %r", fastafilename)
        with open(fastafilename) as fasta:
            alignment = Bio.AlignIO.read(fasta, "fasta", alphabet=protein_gapped)
    else:
        from Bio.Align.Applications import ClustalwCommandline
            raise
        with open(alnfilename) as aln:
            alignment = Bio.AlignIO.read(aln, "clustal", alphabet=protein_gapped)
        logger.info("Using clustalw sequence alignment %r" % alnfilename)
        logger.info("ClustalW Newick guide tree was also produced: %r" % treefilename)

src/b/i/biopython-HEAD/Bio/PDB/StructureAlignment.py   biopython(Download)
 
    # The alignment
    fa=AlignIO.read(open(sys.argv[1]), "fasta", generic_protein)
 
    pdb_file1=sys.argv[2]

src/b/i/biopython-1.63/Bio/PDB/StructureAlignment.py   biopython(Download)
 
    # The alignment
    fa=AlignIO.read(open(sys.argv[1]), "fasta", generic_protein)
 
    pdb_file1=sys.argv[2]

src/p/h/phyloGenerator-HEAD/phyloGenerator.py   phyloGenerator(Download)
                #Need to put the sequences back in order (...)
                try:
                    newSeqs = AlignIO.read(outputFile, 'fasta')
                except:
                    raise RuntimeError("MUSCLE unable to run:\n\tcan you write files where pG is installed?\tcheck your input sequences don't need trimming!")
            if not pipe.failure:
                try:
                    geneOutput.append(AlignIO.read(outputFile, 'fasta'))
                except:
                    raise RuntimeError("MAFFT unable to run:\n\tcan you write files where pG is installed?\tcheck your input sequences don't need trimming!")
            if not pipe.failure:
                try:
                    clustalAlign = geneOutput.append(AlignIO.read(outputFile, 'fasta'))
                    os.remove(outputFile)
                    alignedSomething = True
            if not pipe.failure:
                try:
                    geneOutput.append(AlignIO.read(outputFile+".best.fas", 'fasta'))
                except:
                    raise RuntimeError("PRANK unable to run:\n\tcan you write files where pG is installed?\tcheck your input sequences don't need trimming!")
                    pipe.run()
                    if not pipe.failure:
                        geneOutput.append(AlignIO.read(tempStem + "Output.fasta", "fasta"))
                        os.remove(tempStem + "Output.fasta")
                        os.remove(tempStem + "Input.fasta")

src/f/a/fammer-0.2/fammerlib/cluster.py   fammer(Download)
def load_tree(seqfname):
    """Load an alignment, build & prep a tree, return the tree object."""
    if seqfname.endswith('.aln'):
        aln = AlignIO.read(seqfname, 'clustal')
    elif seqfname.endswith('.fasta'):
        # Run MAFFT quickly
        alndata = subprocess.check_output(['mafft', '--quiet', '--auto',
                                           seqfname])
        aln = AlignIO.read(StringIO(alndata), 'fasta')

  1 | 2 | 3 | 4 | 5 | 6  Next