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

All Samples(188)  |  Call(188)  |  Derive(0)  |  Import(0)
Turns a sequence file into a single SeqRecord.

 - 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. format="fasta" or "tab")

This function is for use parsing sequence files containing(more...)

        def read(handle, format, alphabet=None):
    """Turns a sequence file into a single SeqRecord.

     - 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. format="fasta" or "tab")

    This function is for use parsing sequence files containing
    exactly one record.  For example, reading a GenBank file:

    >>> from Bio import SeqIO
    >>> record = SeqIO.read("GenBank/arab1.gb", "genbank")
    >>> print("ID %s" % record.id)
    ID AC007323.5
    >>> print("Sequence length %i" % len(record))
    Sequence length 86436
    >>> print("Sequence alphabet %s" % record.seq.alphabet)
    Sequence alphabet IUPACAmbiguousDNA()

    If the handle contains no records, or more than one record,
    an exception is raised.  For example:

    >>> from Bio import SeqIO
    >>> record = SeqIO.read("GenBank/cor6_6.gb", "genbank")
    Traceback (most recent call last):
        ...
    ValueError: More than one record found in handle

    If however you want the first record from a file containing
    multiple records this function would raise an exception (as
    shown in the example above).  Instead use:

    >>> from Bio import SeqIO
    >>> record = next(SeqIO.parse("GenBank/cor6_6.gb", "genbank"))
    >>> print("First record's ID %s" % record.id)
    First record's ID X55053.1

    Use the Bio.SeqIO.parse(handle, format) function if you want
    to read multiple records from the handle.
    """
    iterator = parse(handle, format, 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")
    return first
        


src/b/i/biopython-1.63/Doc/examples/Proux_et_al_2002_Figure_6.py   biopython(Download)
#complement to match the strand orientation of the other two phage:
 
A_rec = SeqIO.read("NC_002703.gbk", "gb")
B_rec = SeqIO.read("AF323668.gbk", "gb")
C_rec = SeqIO.read("NC_003212.gbk", "gb")[2587879:2625807].reverse_complement(name=True)

src/b/i/biopython-HEAD/Doc/examples/Proux_et_al_2002_Figure_6.py   biopython(Download)
#complement to match the strand orientation of the other two phage:
 
A_rec = SeqIO.read("NC_002703.gbk", "gb")
B_rec = SeqIO.read("AF323668.gbk", "gb")
C_rec = SeqIO.read("NC_003212.gbk", "gb")[2587879:2625807].reverse_complement(name=True)

src/b/i/biopython-1.63/Doc/examples/ACT_example.py   biopython(Download)
records = dict()
for f, format in genomes:
    records[f] = SeqIO.read(f, format)
    tracks[f] = gd_diagram.new_track(1, name=f, start=0, end=len(records[f]),
                                     scale_smalltick_interval=1000,

src/b/i/biopython-HEAD/Doc/examples/ACT_example.py   biopython(Download)
records = dict()
for f, format in genomes:
    records[f] = SeqIO.read(f, format)
    tracks[f] = gd_diagram.new_track(1, name=f, start=0, end=len(records[f]),
                                     scale_smalltick_interval=1000,

src/p/y/python-dna-0.1.2/pydna/dsdna.py   python-dna(Download)
        handle = StringIO.StringIO(rawseq)
        try:
            parsed = SeqIO.read(handle, "embl", alphabet=IUPACAmbiguousDNA())
            original_format = "embl"
            if "circular" in rawseq.splitlines()[0]:
                circular = True
        except ValueError:
            handle.seek(0)
            try:
                parsed = SeqIO.read(handle, "genbank", alphabet=IUPACAmbiguousDNA())
                handle.seek(0)
                try:
                    parsed = SeqIO.read(handle, "fasta", alphabet=IUPACAmbiguousDNA())
                    original_format = "fasta"
                    if "circular" in rawseq.splitlines()[0]:

src/p/y/pydna-0.6.1/pydna/dsdna.py   pydna(Download)
 
        try:
            parsed = SeqIO.read(handle, "embl", alphabet=IUPACAmbiguousDNA())
            original_format = "embl"
            if "circular" in rawseq.splitlines()[0]:
                circular = True
        except ValueError:
            handle.seek(0)
            try:
                parsed = SeqIO.read(handle, "genbank", alphabet=IUPACAmbiguousDNA())
                handle.seek(0)
                try:
                    parsed = SeqIO.read(handle, "fasta", alphabet=IUPACAmbiguousDNA())
                    original_format = "fasta"
                    if "circular" in rawseq.splitlines()[0]:

src/p/i/picobio-HEAD/fetch_viruses/merge_viruses.py   picobio(Download)
    for name in names:
        acc = (name + ".").split(".")[0]
        record = SeqIO.read("GenBank/%s.gbk" % acc, "gb")
        gi = record.annotations["gi"]
        #Convert to NCBI style FASTA identifier...
                    print("%s %s" % (filename, record.annotations["raw_location"]))
                    if parent is None :
                        parent = SeqIO.read(open(filename),"gb")
                    nuc = get_nuc(parent.seq, record.annotations["raw_location"])
                    if "transl_table" in record.annotations :
            filename = "GenBank/%s.gbk" % name
            #print(name)
            parent = SeqIO.read(open(filename),"genbank")
            for f in parent.features :
                if f.type != "CDS" : continue

src/h/e/helperlibs-0.1.4/helperlibs/bio/seqio.py   helperlibs(Download)
        elif seqtype == "fasta":
            handle = sanity_check_fasta(handle)
    return SeqIO.read(handle, seqtype)
 
 

src/t/a/taxtastic-0.5.2/taxtastic/refpkg.py   taxtastic(Download)
        with self.open_resource('aln_fasta') as f:
            try:
                Bio.SeqIO.read(f, 'fasta')
            except ValueError, v:
                if v[0] == 'No records found in handle':
        with self.open_resource('aln_sto') as f:
            try:
                Bio.SeqIO.read(f, 'stockholm')
            except ValueError, v:
                if v[0] == 'No records found in handle':

src/p/y/py-genome-0.01/pygenome/saccharomyces_cerevisiae.py   py-genome(Download)
            self.gene_to_syst={}
            for f in self.chromosome_files.values():
                krom  =  SeqIO.read(os.path.join(self.data_dir, f), "gb")       
                features = [f for f in krom.features if f.type=="CDS"]
                self.feature_list.extend( [f.qualifiers['locus_tag'][0] for f in features] )
    def chromosome(self, id):
        try:
            id=int(id)-1
            return SeqIO.read(os.path.join(self.data_dir, self.chromosome_files.values()[id]),"gb")
        except ValueError:
            pass
        if 1 <= (ord(id.lower())-96) <= 16:
            return SeqIO.read(os.path.join(self.data_dir, self.chromosome_files[id.upper()]),"gb")
    def chromosomes(self):
        return ( SeqIO.read(os.path.join(self.data_dir, f),"gb")
                 for f in self.chromosome_files.values())
 
    def download(self, missing_files=None):        
            return
 
        krom = SeqIO.read(os.path.join(self.data_dir,self.chromosome_files[gene[1]]),"gb")
 
        cds ={f.qualifiers['locus_tag'][0] :  f for f in [f for f in krom.features if f.type=="CDS"]}

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