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

All Samples(356)  |  Call(241)  |  Derive(0)  |  Import(115)

src/q/i/qiime-1.8.0/scripts/split_fasta_on_sample_ids.py   qiime(Download)
 
 
from cogent.parse.fasta import MinimalFastaParser
from qiime.util import (parse_command_line_parameters, 
                        make_option, 
def main():
    option_parser, opts, args =\
       parse_command_line_parameters(**script_info)
 
    split_fasta_on_sample_ids_to_files(MinimalFastaParser(open(opts.input_fasta_fp,'U')),

src/q/i/qiime-1.8.0/scripts/extract_seqs_by_sample_id.py   qiime(Download)
 
 
from cogent.parse.fasta import MinimalFastaParser
from qiime.util import parse_command_line_parameters, get_options_lookup
from qiime.util import make_option
 
    try:
        seqs = MinimalFastaParser(open(input_fasta_fp))
    except IOError:
        option_parser.error('Cannot open %s. Does it exist? Do you have read access?'%\

src/q/i/qiime-1.8.0/qiime/pick_rep_set.py   qiime(Download)
from numpy import argmax
from cogent.util.misc import InverseDictMulti #inverts dict
from cogent.parse.fasta import MinimalFastaParser
 
label_to_name = lambda x: x.split()[0]
        # during this step.
        seq_f = open(seq_path, 'U')
        seqs = dict(MinimalFastaParser(seq_f,label_to_name=label_to_name))
        seq_f.close()
 
        if seq_path:
            seq_f = open(seq_path, 'U')
            seqs = dict(MinimalFastaParser(seq_f,label_to_name=label_to_name))
            seq_f.close()
        else:
        reference_f = open(reference_path, 'U')
        reference_seqs = dict(\
         MinimalFastaParser(reference_f,label_to_name=label_to_name))
        reference_f.close()
 

src/q/i/qiime-1.8.0/qiime/pycogent_backports/usearch.py   qiime(Download)
from os.path import split, splitext, basename, isdir, abspath, isfile, join
 
from cogent.parse.fasta import MinimalFastaParser
from cogent.app.parameters import ValuedParameter, FlagParameter
from cogent.app.util import CommandLineApplication, ResultPath,\
 
 
    for label, seq in MinimalFastaParser(open(output_fna_clustered, "U")):
        output_fp.write(">%s\n%s\n" % (label, seq))
    for label, seq in MinimalFastaParser(open(output_fna_failures, "U")):
    fasta_o = open(output_filepath, "w")
 
    for label, seq in MinimalFastaParser(fasta_i):
        curr_label = ">" + label_prefix + str(count_start) + label_suffix
        if retain_label_as_comment:
    out_fna = open(output_fna_filepath, "w")
 
    for label, seq in MinimalFastaParser(open(fasta_filepath, "U")):
        if label in labels_to_keep:
            if hit_type == "H":

src/c/o/cogent-1.5.3/cogent/app/usearch.py   cogent(Download)
from os.path import split, splitext, basename, isdir, abspath, isfile, join
 
from cogent.parse.fasta import MinimalFastaParser
from cogent.app.parameters import ValuedParameter, FlagParameter
from cogent.app.util import CommandLineApplication, ResultPath,\
 
 
    for label, seq in MinimalFastaParser(open(output_fna_clustered, "U")):
        output_fp.write(">%s\n%s\n" % (label, seq))
    for label, seq in MinimalFastaParser(open(output_fna_failures, "U")):
    fasta_o = open(output_filepath, "w")
 
    for label, seq in MinimalFastaParser(fasta_i):
        curr_label = ">" + label_prefix + str(count_start) + label_suffix
        if retain_label_as_comment:
    out_fna = open(output_fna_filepath, "w")
 
    for label, seq in MinimalFastaParser(open(fasta_filepath, "U")):
        if label in labels_to_keep:
            if hit_type == "H":

src/p/y/pycogent-HEAD/cogent/app/usearch.py   pycogent(Download)
from os.path import split, splitext, basename, isdir, abspath, isfile, join
 
from cogent.parse.fasta import MinimalFastaParser
from cogent.app.parameters import ValuedParameter, FlagParameter
from cogent.app.util import CommandLineApplication, ResultPath,\
 
 
    for label, seq in MinimalFastaParser(open(output_fna_clustered, "U")):
        output_fp.write(">%s\n%s\n" % (label, seq))
    for label, seq in MinimalFastaParser(open(output_fna_failures, "U")):
    fasta_o = open(output_filepath, "w")
 
    for label, seq in MinimalFastaParser(fasta_i):
        curr_label = ">" + label_prefix + str(count_start) + label_suffix
        if retain_label_as_comment:
    out_fna = open(output_fna_filepath, "w")
 
    for label, seq in MinimalFastaParser(open(fasta_filepath, "U")):
        if label in labels_to_keep:
            if hit_type == "H":

src/q/i/qiime-1.8.0/scripts/filter_fasta.py   qiime(Download)
 
from qiime.util import make_option
from cogent.parse.fasta import MinimalFastaParser
from cogent.parse.fastq import MinimalFastqParser
from qiime.util import parse_command_line_parameters, get_options_lookup
def filter_fasta_fp(input_seqs_fp,output_seqs_fp,seqs_to_keep,negate=False):
    """Filter a fasta file to include only sequences listed in seqs_to_keep """
    input_seqs = MinimalFastaParser(open(input_seqs_fp,'U'))
    output_f = open(output_seqs_fp,'w')
    return filter_fasta(input_seqs,output_f,seqs_to_keep,negate)
def get_seqs_to_keep_lookup_from_prefix(fasta_f,prefix):
    seqs_to_keep = [seq_id
                    for seq_id, seq in MinimalFastaParser(fasta_f)
                    if seq_id.startswith(prefix)]
    return {}.fromkeys(seqs_to_keep)
 
def get_seqs_to_keep_lookup_from_sample_ids(fasta_f,sample_ids):
    sample_ids = set(sample_ids)
    seqs_to_keep = set()
    for seq_id, seq in MinimalFastaParser(fasta_f):
def get_seqs_to_keep_lookup_from_mapping_file(fasta_f,mapping_f,valid_states):
    sample_ids = {}.fromkeys(\
     sample_ids_from_metadata_description(mapping_f,valid_states))
    seqs_to_keep = []
    for seq_id, seq in MinimalFastaParser(fasta_f):

src/q/i/qiime-1.8.0/qiime/workflow/pick_open_reference_otus.py   qiime(Download)
from copy import deepcopy
from cogent.util.misc import create_dir, remove_files
from cogent.parse.fasta import MinimalFastaParser
from qiime.util import (subsample_fasta)
from qiime.filter import (filter_otus_from_otu_table,
    observed = {}
    for repset_fasta_f in repset_fasta_fs:
        for otu_id,seq in MinimalFastaParser(repset_fasta_f):
            o = otu_id.split()[0]
            if not o in observed:
    # write non-singleton otus representative sequences from step1 to the
    # final rep set file
    for otu_id, seq in MinimalFastaParser(open(step1_repset_fasta_fp,'U')):
            if otu_id.split()[0] in otus_to_keep:
                final_repset_f.write('>%s\n%s\n' % (otu_id,seq))
    # those corresponding to non-singleton otus to the final representative set
    # file and the new reference sequences file.
    for otu_id, seq in MinimalFastaParser(open(step2_repset_fasta_fp,'U')):
        if otu_id.split()[0] in otus_to_keep:
            new_refseqs_f.write('>%s\n%s\n' % (otu_id,seq))
            final_repset_f.write('>%s\n%s\n' % (otu_id,seq))
    if not suppress_step4:
        for otu_id, seq in MinimalFastaParser(open(step4_repset_fasta_fp,'U')):

src/q/i/qiime-1.8.0/qiime/pick_otus.py   qiime(Download)
from itertools import imap
 
from cogent.parse.fasta import MinimalFastaParser
from cogent.parse.mothur import parse_otu_list as mothur_parse
from cogent.app.cd_hit import cdhit_clusters_from_seqs
        # get the prefix map
        mapping=build_prefix_map(imap(trunc_id, MinimalFastaParser(
                                                open(seq_path))))
        for key in mapping.keys():
                mapping[key].append(key)
 
        # collect the representative seqs
        filtered_seqs=[]
        for (label,seq) in MinimalFastaParser(open(seq_path)):
 
        clusters, failures = self._cluster_seqs(
                                    MinimalFastaParser(open(seq_path)))
        self.log_lines.append('Num OTUs: %d' % len(clusters))
 
 
        clusters = self._collapse_exact_matches(\
         MinimalFastaParser(open(seq_path)),prefix_length,suffix_length)
        log_lines.append('Num OTUs: %d' % len(clusters))
 

src/q/i/qiime-1.8.0/scripts/insert_seqs_into_tree.py   qiime(Download)
from qiime.util import parse_command_line_parameters, make_option, \
                       get_options_lookup,load_qiime_config,create_dir
from cogent.parse.fasta import MinimalFastaParser
from cogent.core.alignment import DenseAlignment
from qiime.parse import parse_qiime_parameters
    # load input sequences and convert to phylip since the tools require 
    # the query sequences to phylip-compliant names
    load_aln = MinimalFastaParser(open(opts.input_fasta_fp,'U'))   
    aln = DenseAlignment(load_aln)
    seqs, align_map = aln.toPhylip()
        # load the reference sequences
        load_ref_aln = \
            DenseAlignment(MinimalFastaParser(open(opts.refseq_fp,'U'))) 
 
        # combine and load the reference plus query
        combined_aln = MinimalFastaParser(StringIO(load_ref_aln.toFasta() + \

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