本文整理汇总了Python中CGAT.Intervals.intersect方法的典型用法代码示例。如果您正苦于以下问题:Python Intervals.intersect方法的具体用法?Python Intervals.intersect怎么用?Python Intervals.intersect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGAT.Intervals
的用法示例。
在下文中一共展示了Intervals.intersect方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testMultiple
# 需要导入模块: from CGAT import Intervals [as 别名]
# 或者: from CGAT.Intervals import intersect [as 别名]
def testMultiple(self):
"""test empty input."""
self.assertEqual(
Intervals.intersect([(0, 5), (10, 15)], [(0, 5)]), [(0, 5)])
self.assertEqual(
Intervals.intersect([(0, 5), (10, 15)], [(0, 10)]), [(0, 5)])
self.assertEqual(
Intervals.intersect([(0, 5), (10, 15)], [(0, 15)]), [(0, 5), (10, 15)])
self.assertEqual(
Intervals.intersect([(0, 5), (5, 10)], [(0, 10)]), [(0, 5), (5, 10)])
示例2: testSingle
# 需要导入模块: from CGAT import Intervals [as 别名]
# 或者: from CGAT.Intervals import intersect [as 别名]
def testSingle(self):
"""test empty input."""
self.assertEqual(Intervals.intersect([(0, 5)], [(0, 5)]), [(0, 5)])
self.assertEqual(Intervals.intersect([(0, 5)], [(0, 3)]), [(0, 3)])
self.assertEqual(Intervals.intersect([(0, 3)], [(0, 5)]), [(0, 3)])
self.assertEqual(Intervals.intersect([(0, 5)], [(3, 5)]), [(3, 5)])
self.assertEqual(Intervals.intersect([(3, 5)], [(0, 5)]), [(3, 5)])
self.assertEqual(Intervals.intersect([(5, 10)], [(5, 20)]), [(5, 10)])
self.assertEqual(Intervals.intersect([(5, 10)], [(0, 20)]), [(5, 10)])
示例3: main
# 需要导入模块: from CGAT import Intervals [as 别名]
# 或者: from CGAT.Intervals import intersect [as 别名]
#.........这里部分代码省略.........
help="remove strandedness of features (set to '.') when "
"using ``transcripts2genes`` or ``filter``"
"[%default].",
)
parser.add_option(
"--permit-duplicates", dest="strict", action="store_false", help="permit duplicate genes. " "[%default]"
)
parser.add_option(
"--duplicate-feature",
dest="duplicate_feature",
type="choice",
choices=("gene", "transcript", "both", "ucsc", "coordinates"),
help="remove duplicates by gene/transcript. "
"If ``ucsc`` is chosen, transcripts ending on _dup# are "
"removed. This is necessary to remove duplicate entries "
"that are next to each other in the sort order "
"[%default]",
)
parser.add_option(
"-m",
"--method",
dest="method",
type="choice",
action="append",
choices=(
"add-protein-id",
"exons2introns",
"filter",
"find-retained-introns",
"genes-to-unique-chunks",
"intersect-transcripts",
"join-exons",
"merge-exons",
"merge-transcripts",
"merge-genes",
"merge-introns",
"remove-overlapping",
"remove-duplicates",
"rename-genes",
"rename-transcripts",
"rename-duplicates",
"renumber-genes",
"renumber-transcripts",
"set-transcript-to-gene",
"set-gene-to-transcript",
"set-protein-to-transcript",
"set-score-to-distance",
"set-gene_biotype-to-source",
"sort",
"transcript2genes",
"unset-genes",
),
help="Method to apply [%default]." "Please only select one.",
)
parser.set_defaults(
sort_order="gene",
filter_method="gene",
pattern="%i",
merge_exons_distance=0,
filename_filter=None,
intron_border=None,
intron_min_length=None,
示例4: main
# 需要导入模块: from CGAT import Intervals [as 别名]
# 或者: from CGAT.Intervals import intersect [as 别名]
def main(argv=None):
if not argv:
argv = sys.argv
parser = E.OptionParser(version="%prog version: $Id$",
usage=globals()["__doc__"])
parser.add_option("-m", "--merge-exons",
dest="merge_exons",
action="store_true",
help="merge overlapping exons of all transcripts "
"within a gene. "
"The merged exons will be output. "
"Input needs to sorted by gene [default=%default].")
parser.add_option("-t", "--merge-transcripts",
dest="merge_transcripts",
action="store_true",
help="merge all transcripts within a gene. "
"The entry will span the whole gene "
"(exons and introns). "
"The transcript does not include the UTR unless "
"--with-utr is set. [default=%default].")
parser.add_option("--merge-genes", dest="merge_genes", action="store_true",
help="merge overlapping genes if their exons overlap. "
"A gene with a single transcript containing all exons "
"of the overlapping transcripts will be output. "
"This operation ignores strand information "
"The input needs te sorted by transcript "
"[default=%default].")
parser.add_option("--merge-exons-distance",
dest="merge_exons_distance",
type="int",
help="distance in nucleotides between "
"exons to be merged [default=%default].")
parser.add_option("-j", "--join-exons",
dest="join_exons",
action="store_true",
help="join all exons per transcript. "
"A new transcript will be "
"output that spans a whole transcript. "
"Input needs to be sorted by transcript "
"[default=%default].")
parser.add_option("--unset-genes", dest="unset_genes", type="string",
help="unset gene identifiers, keeping "
"transcripts intact. "
"New gene identifiers are set to the "
"pattern given. For example, "
"'--unset-genes=%06i' [default=%default].")
parser.add_option("--sort",
dest="sort",
type="choice",
choices=("gene",
"gene+transcript",
"transcript",
"position",
"contig+gene",
"position+gene",
"gene+position"),
help="sort input data [default=%default].")
parser.add_option("-u", "--with-utr",
dest="with_utr",
action="store_true",
help="include utr in merged transcripts "
"[default=%default].")
parser.add_option("--intersect-transcripts",
dest="intersect_transcripts",
action="store_true",
help="intersect all transcripts within a gene. "
"The entry will only span those bases "
"that are covered by all transcrips."
"The transcript does not include the UTR unless "
"--with-utr is set. This method "
"will remove all other features (stop_codon, etc.) "
"The input needs to be sorted by gene. "
"[default=%default].")
parser.add_option("-i", "--merge-introns",
dest="merge_introns",
action="store_true",
help="merge and output all introns within a "
"gene. The output will contain "
"all intronic regions within a gene. Single exon genes "
"are skipped. "
"The input needs to be sorted by gene. "
"[default=%default].")
parser.add_option("-g", "--set-transcript-to-gene",
"--set-transcript2gene",
dest="set_transcript2gene",
action="store_true",
help="set the transcript_id to the "
#.........这里部分代码省略.........
示例5: testHalfEmpty
# 需要导入模块: from CGAT import Intervals [as 别名]
# 或者: from CGAT.Intervals import intersect [as 别名]
def testHalfEmpty(self):
"""test empty input."""
self.assertEqual(Intervals.intersect([(0, 5)], []), [])
self.assertEqual(Intervals.intersect([], [(0, 5)]), [])
示例6: testEmpty
# 需要导入模块: from CGAT import Intervals [as 别名]
# 或者: from CGAT.Intervals import intersect [as 别名]
def testEmpty(self):
"""test empty input."""
self.assertEqual(Intervals.intersect([], []), [])
示例7: testNoOverlap
# 需要导入模块: from CGAT import Intervals [as 别名]
# 或者: from CGAT.Intervals import intersect [as 别名]
def testNoOverlap(self):
"""test empty input."""
self.assertEqual(
Intervals.intersect([(0, 5), (10, 15)], [(5, 10)]), [])
self.assertEqual(
Intervals.intersect([(5, 10)], [(0, 5), (10, 15)]), [])