当前位置: 首页>>代码示例>>Python>>正文


Python SeqFeature.ExactPosition方法代码示例

本文整理汇总了Python中Bio.SeqFeature.ExactPosition方法的典型用法代码示例。如果您正苦于以下问题:Python SeqFeature.ExactPosition方法的具体用法?Python SeqFeature.ExactPosition怎么用?Python SeqFeature.ExactPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bio.SeqFeature的用法示例。


在下文中一共展示了SeqFeature.ExactPosition方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_point_feature

# 需要导入模块: from Bio import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature import ExactPosition [as 别名]
def add_point_feature(self, resnum, feat_type=None, feat_id=None, qualifiers=None):
        """Add a feature to the features list describing a single residue.

        Args:
            resnum (int): Protein sequence residue number
            feat_type (str, optional): Optional description of the feature type (ie. 'catalytic residue')
            feat_id (str, optional): Optional ID of the feature type (ie. 'TM1')

        """
        if self.feature_file:
            raise ValueError('Feature file associated with sequence, please remove file association to append '
                             'additional features.')

        if not feat_type:
            feat_type = 'Manually added protein sequence single residue feature'
        newfeat = SeqFeature(location=FeatureLocation(ExactPosition(resnum-1), ExactPosition(resnum)),
                             type=feat_type,
                             id=feat_id,
                             qualifiers=qualifiers)

        self.features.append(newfeat) 
开发者ID:SBRG,项目名称:ssbio,代码行数:23,代码来源:seqprop.py

示例2: fetch_source_feature

# 需要导入模块: from Bio import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature import ExactPosition [as 别名]
def fetch_source_feature(self, gb_record):
        source_feature = None
        has_source = False
        for i in gb_record.features:
            if i.type == "source":
                source_feature = i
                has_source = True
                break
        if not has_source:
            ##加一个source feature
            my_start_pos = SeqFeature.ExactPosition(0)
            my_end_pos = SeqFeature.ExactPosition(len(gb_record.seq))
            my_feature_location = FeatureLocation(my_start_pos, my_end_pos)
            my_feature_type = "source"
            source_feature = SeqFeature.SeqFeature(my_feature_location, type=my_feature_type)
            gb_record.features.insert(0, source_feature)
        return source_feature 
开发者ID:dongzhang0725,项目名称:PhyloSuite,代码行数:19,代码来源:handleGB.py

示例3: test_all_combos

# 需要导入模块: from Bio import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature import ExactPosition [as 别名]
def test_all_combos(self):
        expected = [FeatureLocation(ExactPosition(0), ExactPosition(66), strand=1)]
        for start in ('ATG', 'GTG', 'TTG'):
            for stop in ('TAA', 'TAG', 'TGA'):
                seq = "{}{}{}".format(start, "N"*60, stop)
                self.run_both_dirs(expected, seq) 
开发者ID:antismash,项目名称:antismash,代码行数:8,代码来源:test_all_orfs.py

示例4: test_single_contained

# 需要导入模块: from Bio import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature import ExactPosition [as 别名]
def test_single_contained(self):
        expected = [FeatureLocation(ExactPosition(0), ExactPosition(66), strand=1)]
        self.run_both_dirs(expected, "ATG"+"N"*60+"TAG")
        self.run_both_dirs(expected, "ATG"+"N"*60+"TAGNNN")
        expected = [FeatureLocation(ExactPosition(3), ExactPosition(69), strand=1)]
        self.run_both_dirs(expected, "NNNATG"+"N"*60+"TAG")
        self.run_both_dirs(expected, "NNNATG"+"N"*60+"TAGNNN") 
开发者ID:antismash,项目名称:antismash,代码行数:9,代码来源:test_all_orfs.py

示例5: test_start_without_end

# 需要导入模块: from Bio import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature import ExactPosition [as 别名]
def test_start_without_end(self):
        expected = [FeatureLocation(ExactPosition(3), AfterPosition(9), strand=1)]
        self.run_both_dirs(expected, "NNNATGNNN") 
开发者ID:antismash,项目名称:antismash,代码行数:5,代码来源:test_all_orfs.py

示例6: test_end_without_start

# 需要导入模块: from Bio import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature import ExactPosition [as 别名]
def test_end_without_start(self):
        expected = [FeatureLocation(BeforePosition(0), ExactPosition(6), strand=1)]
        self.run_both_dirs(expected, "NNNTAGNNN") 
开发者ID:antismash,项目名称:antismash,代码行数:5,代码来源:test_all_orfs.py

示例7: test_multiple

# 需要导入模块: from Bio import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature import ExactPosition [as 别名]
def test_multiple(self):
        # start, stop, start, stop
        expected = [FeatureLocation(ExactPosition(0), ExactPosition(66), strand=1),
                    FeatureLocation(ExactPosition(66), ExactPosition(132), strand=1)]
        self.run_both_dirs(expected, "ATG"+"N"*60+"TAGGTG"+"N"*60+"TGA")
        # start, stop, start
        expected[1] = FeatureLocation(ExactPosition(66), AfterPosition(69), strand=1)
        self.run_both_dirs(expected, "ATG"+"N"*60+"TAGGTG")
        # stop, start
        expected = [FeatureLocation(BeforePosition(0), ExactPosition(3), strand=1),
                    FeatureLocation(ExactPosition(3), AfterPosition(9), strand=1)]
        self.run_both_dirs(expected, "TAGGTGNNN") 
开发者ID:antismash,项目名称:antismash,代码行数:14,代码来源:test_all_orfs.py

示例8: test_single_start_multi_stop

# 需要导入模块: from Bio import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature import ExactPosition [as 别名]
def test_single_start_multi_stop(self):
        seq = "ATG"+"N"*60+"TAGNNNTAG"
        expected = [FeatureLocation(ExactPosition(0), ExactPosition(66), strand=1)]
        assert expected == [feat.location for feat in find_all_orfs(DummyRecord(seq=seq))]
        seq = str(DummyRecord(seq=seq).seq.reverse_complement())
        expected = [FeatureLocation(ExactPosition(6), ExactPosition(72), strand=-1)]
        assert expected == [feat.location for feat in find_all_orfs(DummyRecord(seq=seq))] 
开发者ID:antismash,项目名称:antismash,代码行数:9,代码来源:test_all_orfs.py

示例9: test_interleaved

# 需要导入模块: from Bio import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature import ExactPosition [as 别名]
def test_interleaved(self):
        expected = [FeatureLocation(ExactPosition(0), ExactPosition(72), strand=1),
                    FeatureLocation(ExactPosition(4), ExactPosition(76), strand=1)]
        self.run_both_dirs(expected, "ATGNATGNN"+"N"*60+"TAGNTAG") 
开发者ID:antismash,项目名称:antismash,代码行数:6,代码来源:test_all_orfs.py

示例10: test_contained

# 需要导入模块: from Bio import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature import ExactPosition [as 别名]
def test_contained(self):
        seq = "ATG"+"X"*60+"TAG"
        for offset in [0, 6, 305]:
            if offset == 0:
                orfs = scan_orfs(seq, 1)
            else:
                orfs = scan_orfs(seq, 1, offset=offset)
            assert len(orfs) == 1
            orf = orfs[0]
            assert isinstance(orf.start, ExactPosition)
            assert isinstance(orf.end, ExactPosition)
            assert orf.start == 0 + offset
            assert orf.end == 66 + offset 
开发者ID:antismash,项目名称:antismash,代码行数:15,代码来源:test_all_orfs.py

示例11: test_stop_without_start

# 需要导入模块: from Bio import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature import ExactPosition [as 别名]
def test_stop_without_start(self):
        seq = "NNNTAGNNN"
        for offset in [0, 6, 305]:
            if offset == 0:
                orfs = scan_orfs(seq, 1)
            else:
                orfs = scan_orfs(seq, 1, offset=offset)
            assert len(orfs) == 1
            orf = orfs[0]
            assert isinstance(orf.start, BeforePosition)
            assert isinstance(orf.end, ExactPosition)
            assert orf.end == 6 + offset 
开发者ID:antismash,项目名称:antismash,代码行数:14,代码来源:test_all_orfs.py

示例12: fas2gb

# 需要导入模块: from Bio import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature import ExactPosition [as 别名]
def fas2gb(self, fasContent, gbIO, seq_type=None, id=None, organism=None):
        fas_gb_contents = ""
        if ">" not in fasContent:
            self.exception_signal.emit("The input file is not in "
                "'<span style=\"color:red\">FASTA</span>' format!<normal exception>")
            return
        try:
            count = fasContent.count(">")
            parseFMT = Parsefmt()
            new_fas_contents = parseFMT.standardizeFas(StringIO(fasContent), removeAlign=True)
            list_names = []
            for num, record in enumerate(SeqIO.parse(StringIO(new_fas_contents), "fasta")):
                if len(record.name) > 15:
                    name = record.id[:15]
                    if name in list_names:
                        num = 2
                        while (name[:14] + str(num)) in list_names:
                            num += 1
                        name = name[:14] + str(num)
                    record.name = name
                list_names.append(record.name)
                seq_type = parseFMT.judge(str(record.seq)) if not seq_type else seq_type
                if seq_type == "DNA":
                    alphabet = generic_dna
                elif seq_type == "RNA":
                    alphabet = generic_rna
                else:
                    alphabet = generic_protein
                record.seq.alphabet = alphabet
                if id:
                    record.id = id
                record.annotations["organism"] = record.id if not organism else organism
                ##加一个source feature
                my_start_pos = SeqFeature.ExactPosition(0)
                my_end_pos = SeqFeature.ExactPosition(len(record.seq))
                my_feature_location = FeatureLocation(my_start_pos, my_end_pos)
                my_feature_type = "source"
                my_feature = SeqFeature.SeqFeature(my_feature_location, type=my_feature_type)
                record.features.append(my_feature)
                fas_gb_contents += record.format("genbank")
                self.progressSig.emit((num+1) * 80/count)
            gbIO.addRecords(fas_gb_contents, 0, 20, self.progressSig, self, byContent=True)
        except:
            self.exception_signal.emit(''.join(
                traceback.format_exception(*sys.exc_info())) + "\n") 
开发者ID:dongzhang0725,项目名称:PhyloSuite,代码行数:47,代码来源:main.py


注:本文中的Bio.SeqFeature.ExactPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。