本文整理汇总了Python中CGAT.FastaIterator.iterate_together方法的典型用法代码示例。如果您正苦于以下问题:Python FastaIterator.iterate_together方法的具体用法?Python FastaIterator.iterate_together怎么用?Python FastaIterator.iterate_together使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGAT.FastaIterator
的用法示例。
在下文中一共展示了FastaIterator.iterate_together方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: iterate_double_fasta
# 需要导入模块: from CGAT import FastaIterator [as 别名]
# 或者: from CGAT.FastaIterator import iterate_together [as 别名]
def iterate_double_fasta ( fn1, fn2 ):
iterator = FastaIterator.iterate_together( fn1, fn2 )
for seq1, seq2 in iterator:
yield AlignedPairs.UnalignedPair(
token1 = seq1.title,
sequence1 = seq1.sequence,
token2 = seq2.title,
sequence2 = seq2.sequence )
示例2: main
# 需要导入模块: from CGAT import FastaIterator [as 别名]
# 或者: from CGAT.FastaIterator import iterate_together [as 别名]
def main(argv=None):
if argv is None:
argv = sys.argv
parser = E.OptionParser(version="%prog version",
usage=globals()["__doc__"])
parser.add_option(
"--output-quality-format", dest="q_format", type="int",
help="sequence quality format, e.g 33 = +33/Sanger"
"[default=%default].")
parser.add_option(
"--output-paired-end", dest="paired", action="store_true",
help="generate paired end reads [default = %default].")
parser.add_option(
"--insert-length-mean", dest="insert_mean", type="float",
help="mean insert length [default = %default].")
parser.add_option(
"--insert-length-sd", dest="insert_sd", type="float",
help="insert length standard deviation [default = %default].")
parser.add_option(
"--counts-method", dest="counts_method", type="choice",
choices=("reads", "copies"),
help="simulate a ground truth number of reads per entry or"
"copies per entry [default = %default].")
parser.add_option(
"--counts-min", dest="counts_min", type="float",
help="minimum number of reads/read pairs per fasta entry"
"or copies per entry [default = %default].")
parser.add_option(
"--counts-max", dest="counts_max", type="float",
help="maximum number of reads/read pairs per fasta entry "
"or copies per entry [default = %default].")
parser.add_option(
"--output-read-length", dest="read_length", type="int",
help="read length [default = %default].")
parser.add_option(
"--sequence-error-phred", dest="phred", type="int",
help="phred quality score [default = %default].")
parser.add_option(
"--output-counts", dest="output_counts", type="string",
help="name for counts outfile [default=%default].")
parser.add_option(
"--output-fastq2", dest="fastq2_out", type="string",
help="filename for second fastq outfile [default=%default].")
parser.add_option(
"--premrna-fraction", dest="premrna_fraction", type="float",
help="the fraction of reads to simulate from pre-mRNA"
"[default= % default].")
parser.add_option(
"--infile-premrna-fasta", dest="premrna_fasta", type="string",
help="filename for pre-mRNA fasta[default=%default].")
parser.set_defaults(
q_format=33,
paired=False,
insert_mean=0,
insert_sd=1,
counts_method="reads",
counts_min=1,
counts_max=1,
read_length=50,
fastq2_out=None,
output_counts=None,
phred=30,
premrna_fraction=0,
premrna_fasta=None
)
(options, args) = E.Start(parser)
if options.paired:
assert options.fastq2_out, ("must specify a second fastq outfile for "
"paired end (--output-fastq2)")
outf2 = IOTools.openFile(options.fastq2_out, "w")
if options.premrna_fraction:
assert options.premrna_fasta, ("must specfify the location of the"
"fasta file for the pre-mRNA")
# the sequence quality string will always be the same so define here
sequence_quality = chr(options.q_format + options.phred)
qual = "".join([sequence_quality] * options.read_length)
if options.premrna_fraction:
iterator = FastaIterator.iterate_together(
options.stdin, IOTools.openFile(options.premrna_fasta))
else:
#.........这里部分代码省略.........