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

All Samples(23)  |  Call(16)  |  Derive(0)  |  Import(7)
It writes the given sequences

        def write_seqs(seqs, fhand=None, file_format=None):
    'It writes the given sequences'
    if fhand is None:
        fhand = NamedTemporaryFile(suffix='.' + file_format.replace('-', '_'))

    seqs, seqs2 = tee(seqs)
        seq = seqs2.next()
    except StopIteration:
        # No sequences to write, so we're done
        return fhand
    del seqs2
    seq_class = seq.kind
    if seq_class == SEQITEM:
        _write_seqitems(seqs, fhand, file_format)
    elif seq_class == SEQRECORD:
        seqs = (seq.object for seq in seqs)
        _write_seqrecords(seqs, fhand, file_format)
        raise ValueError('Unknown class for seq: ' + seq_class)
    return fhand

src/s/e/seq_crumbs-HEAD/crumbs/filters.py   seq_crumbs(Download)
                            get_or_create_bwa_index, map_with_bwamem,
from crumbs.seqio import write_seqs, read_seqs
from crumbs.pairs import group_pairs, group_pairs_by_name, deinterleave_pairs
        # we create a blastdb for these reads and then we use the oligos
        # as the blast query
        db_fhand = write_seqs(seqs, file_format='fasta')
        params = {'task': 'blastn-short', 'expect': '0.0001'}
        reads_fhand = NamedTemporaryFile(suffix=file_format)
        write_seqs(seqs, reads_fhand, file_format=file_format)
        if kind is NON_CHIMERIC:
            write_seqs(pair, out_fhand)
        elif kind is CHIMERA and chimeras_fhand is not None:
            write_seqs(pair, chimeras_fhand)

src/s/e/seq_crumbs-HEAD/crumbs/annotation.py   seq_crumbs(Download)
from crumbs.utils.tags import FIVE_PRIME, THREE_PRIME
from crumbs.seq import get_description, get_name, get_str_seq
from crumbs.seqio import write_seqs, read_seqs
from crumbs.blast import Blaster
from crumbs.settings import get_setting
def _run_estscan(seqs, pep_out_fpath, dna_out_fpath, matrix_fpath):
    'It runs estscan in the input seqs'
    seq_fhand = write_seqs(seqs, file_format='fasta')
    binary = get_binary_path('estscan')

src/s/e/seq_crumbs-HEAD/crumbs/blast.py   seq_crumbs(Download)
from crumbs.utils.optional_modules import NCBIWWW
from crumbs.seqio import seqio, guess_seq_type, write_seqs
from crumbs.utils.bin_utils import (check_process_finishes, popen,
    query_fhand = write_seqs(queries, file_format='fasta')

src/s/e/seq_crumbs-HEAD/crumbs/trim.py   seq_crumbs(Download)
from crumbs.iterutils import rolling_window
from crumbs.blast import BlasterForFewSubjects
from crumbs.seqio import write_seqs
from crumbs.pairs import group_pairs_by_name, group_pairs
    def _pre_trim(self, trim_packet):
        seqs = [s for seqs in trim_packet[SEQS_PASSED]for s in seqs]
        db_fhand = write_seqs(seqs, file_format='fasta')
        params = {'task': 'blastn-short', 'expect': '0.0001'}

src/s/e/seq_crumbs-HEAD/crumbs/pairs.py   seq_crumbs(Download)
from crumbs.exceptions import (PairDirectionError, InterleaveError,
from crumbs.seqio import write_seqs
from crumbs.seq import get_title, get_name
from crumbs.utils.tags import FWD, REV
        if len(pair) == 1:
            write_seqs(pair, orphan_out_fhand, out_format)
                name = _parse_pair_direction_and_name(pair[0])[0]
                    raise ItemsNotSortedError(msg)
        elif len(pair) == 2:
            write_seqs(pair, out_fhand, out_format)
    for pair in group_pairs(seqs, n_seqs_in_pair=2):
        write_seqs((pair[0],), out_fhand1, out_format)
        write_seqs((pair[1],), out_fhand2, out_format)

src/s/e/seq_crumbs-HEAD/crumbs/bulk_filters.py   seq_crumbs(Download)
from crumbs.seq import get_str_seq
from crumbs.pairs import group_pairs_by_name, group_pairs
from crumbs.seqio import read_seqs, write_seqs
from crumbs.utils.tags import SEQITEM
from crumbs.iterutils import sorted_items, unique, unique_unordered
        unique_pairs = unique(sorted_pairs, key=_get_pair_key)
    for pair in unique_pairs:
        write_seqs(pair, out_fhand)

src/s/e/seq_crumbs-HEAD/test/test_seqio.py   seq_crumbs(Download)
from crumbs.utils.test_utils import TEST_DATA_DIR
from crumbs.utils.bin_utils import BIN_DIR
from crumbs.seqio import (guess_seq_type, fastaqual_to_fasta, seqio,
                          _write_seqrecords, _read_seqrecords,
                          _itemize_fastx, read_seqs, write_seqs)
        assert seqs[0].kind == SEQITEM
        fhand = StringIO()
        write_seqs(seqs, fhand)
        assert fhand.getvalue() == '>s1\nACTG\n>s2 desc\nACTG\n'
        assert seqs[0].object.name == 's1'
        assert seqs[0].kind == SEQRECORD
        fhand = StringIO()
        write_seqs(seqs, fhand, 'fasta')
        assert fhand.getvalue() == '>s1\nACTG\n>s2 desc\nACTG\n'
        fhand = StringIO()
        write_seqs(seqs, fhand)
        assert fhand.getvalue() == '>s1\nACTG\n>s2 desc\nACTG\n'