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


Python IUPAC.protein方法代码示例

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


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

示例1: transeq

# 需要导入模块: from Bio.Alphabet import IUPAC [as 别名]
# 或者: from Bio.Alphabet.IUPAC import protein [as 别名]
def transeq(data):
    dummy = int(data[1])
    record = data[0]
    if dummy == 0:
        prot = (translate_frameshifted(record.seq[0:]))
        prot_rec = (SeqRecord(Seq(prot, IUPAC.protein), id=record.id + "_strand0plus"))
    if dummy == 1:
        prot = (translate_frameshifted(record.seq[1:]))  # second frame
        prot_rec = (SeqRecord(Seq(prot, IUPAC.protein), id=record.id + "_strand1plus"))
    if dummy == 2:
        prot = (translate_frameshifted(record.seq[2:]))  # third frame
        prot_rec =(SeqRecord(Seq(prot, IUPAC.protein), id=record.id + "_strand2plus"))
    if dummy == 3:
        prot = (translate_frameshifted(reverse_complement(record.seq)))  # negative first frame
        prot_rec = (SeqRecord(Seq(prot, IUPAC.protein), id=record.id + "_strand0minus"))
    if dummy == 4:
        prot = (translate_frameshifted(reverse_complement(record.seq[:len(record.seq) - 1])))  # negative second frame
        prot_rec =(SeqRecord(Seq(prot, IUPAC.protein), id=record.id + "_strand1minus"))
    if dummy == 5:
        prot = (translate_frameshifted(reverse_complement(record.seq[:len(record.seq) - 2])))  # negative third frame
        prot_rec = (SeqRecord(Seq(prot, IUPAC.protein), id=record.id + "_strand2minus"))
    return(prot_rec) 
开发者ID:lfaino,项目名称:LoReAn,代码行数:24,代码来源:proteinAlign.py

示例2: validate_folder_with_sequence_files

# 需要导入模块: from Bio.Alphabet import IUPAC [as 别名]
# 或者: from Bio.Alphabet.IUPAC import protein [as 别名]
def validate_folder_with_sequence_files(
		self, directory, file_format, sequence_type, ambiguous, file_extension, key=None, silent=False):
		"""
			Validate a file to be correctly formatted

			@attention: Currently only phred quality for fastq files

			@param directory: Path to directory with files containing sequences
			@type directory: str | unicode
			@param file_format: Format of the file at the file_path provided. Valid: 'fasta', 'fastq'
			@type file_format: str | unicode
			@param sequence_type: Are the sequences DNA or RNA? Valid: 'rna', 'dna', 'protein'
			@type sequence_type: str | unicode
			@param ambiguous: True or False, DNA example for strict 'GATC',  ambiguous example 'GATCRYWSMKHBVDN'
			@type ambiguous: bool
			@param file_extension: file extension to be filtered for. Example: '.fasta' '.fq'
			@type file_extension: basestring | None
			@param key: If True, no error message will be made
			@type key: basestring | None
			@param silent: If True, no error message will be made
			@type silent: bool

			@return: True if the file is correctly formatted
			@rtype: bool
		"""
		list_of_file_paths = self.get_files_in_directory(directory, file_extension)
		result = True
		for file_path in list_of_file_paths:
			if not self.validate_sequence_file(file_path, file_format, sequence_type, ambiguous, key, silent):
				result = False
		return result 
开发者ID:CAMI-challenge,项目名称:CAMISIM,代码行数:33,代码来源:sequencevalidator.py

示例3: seq_record_example

# 需要导入模块: from Bio.Alphabet import IUPAC [as 别名]
# 或者: from Bio.Alphabet.IUPAC import protein [as 别名]
def seq_record_example():
    """Dummy SeqRecord to load"""
    return SeqRecord(Seq("MKQHKAMIVALIVICITAVVAALVTRKDLCEVHIRTGQTEVAVF",
                     IUPAC.protein),
                     id="YP_025292.1", name="HokC",
                     description="toxic membrane protein, small",
                     annotations={'hello':'world'}) 
开发者ID:SBRG,项目名称:ssbio,代码行数:9,代码来源:test_protein_seqprop.py

示例4: validate_sequence_file

# 需要导入模块: from Bio.Alphabet import IUPAC [as 别名]
# 或者: from Bio.Alphabet.IUPAC import protein [as 别名]
def validate_sequence_file(self, file_path, file_format, sequence_type, ambiguous, key=None, silent=False):
		"""
			Validate a file to be correctly formatted

			@attention: Currently only phred quality for fastq files

			@param file_path: Path to file containing sequences
			@type file_path: str | unicode
			@param file_format: Format of the file at the file_path provided. Valid: 'fasta', 'fastq'
			@type file_format: str | unicode
			@param sequence_type: Are the sequences DNA or RNA? Valid: 'rna', 'dna', 'protein'
			@type sequence_type: str | unicode
			@param ambiguous: True or False, DNA example for strict 'GATC',  ambiguous example 'GATCRYWSMKHBVDN'
			@type ambiguous: bool
			@param key: If True, no error message will be made
			@type key: basestring | None
			@param silent: If True, no error message will be made
			@type silent: bool

			@return: True if the file is correctly formatted
			@rtype: bool
		"""
		assert self.validate_file(file_path)
		assert isinstance(file_format, basestring)
		file_format = file_format.lower()
		assert file_format in self._formats
		assert isinstance(sequence_type, basestring)
		sequence_type = sequence_type.lower()
		assert sequence_type in self._alphabets

		prefix = ""
		if key:
			prefix = "'{}' ".format(key)

		if ambiguous:
			alphabet = self._alphabets[sequence_type][1]
		else:
			alphabet = self._alphabets[sequence_type][0]

		set_of_seq_id = set()

		with open(file_path) as file_handle:
			if not self._validate_file_start(file_handle, file_format):
				if not silent:
					self._logger.error("{}Invalid beginning of file '{}'.".format(prefix, os.path.basename(file_path)))
				return False
			sequence_count = 0
			try:
				for seq_record in SeqIO.parse(file_handle, file_format, alphabet=alphabet):
					sequence_count += 1
					if not self._validate_sequence_record(seq_record, set_of_seq_id, file_format, key=None, silent=False):
						if not silent:
							self._logger.error("{}{}. sequence '{}' is invalid.".format(prefix, sequence_count, seq_record.id))
						return False
			except Exception as e:
				if not silent:
					self._logger.error("{}Corrupt sequence in file '{}'.\nException: {}".format(
						prefix, os.path.basename(file_path), e.message))
				return False
		return True 
开发者ID:CAMI-challenge,项目名称:CAMISIM,代码行数:62,代码来源:sequencevalidator.py


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