本文整理汇总了Python中Bio.SeqFeature.SeqFeature.qualifiers["cluster_id"]方法的典型用法代码示例。如果您正苦于以下问题:Python SeqFeature.qualifiers["cluster_id"]方法的具体用法?Python SeqFeature.qualifiers["cluster_id"]怎么用?Python SeqFeature.qualifiers["cluster_id"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bio.SeqFeature.SeqFeature
的用法示例。
在下文中一共展示了SeqFeature.qualifiers["cluster_id"]方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeSeqObjectsForTblastnNeighbors
# 需要导入模块: from Bio.SeqFeature import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature.SeqFeature import qualifiers["cluster_id"] [as 别名]
def makeSeqObjectsForTblastnNeighbors(tblastn_id, clusterrunid, cur, N=200000):
"""
Given a tBBLSATn ID and a dictionary from sanitized contig IDs (which is what will be
present in the TBLASTN id) to non-sanitized IDs (which are what is in the database),
returns a list of seq objects INCLUDING the TBLASTN hit itself (so that we can show that
on the region drawing).
We pick an N large enough to get at least one gene and then pick the closest one and get
all of its neighbors with a call to makeSeqFeaturesForGeneNeighbors() and just tack the TBLASTN
onto it.
"""
# Lets first get the contig and start/stop locations (which tell us teh strand) out of
# the TBLASTN id. This returns a ValueError if it fails which the calling function can catch if needed.
sanitizedToNot = getSanitizedContigList(cur)
contig, start, stop = splitTblastn(tblastn_id)
if contig in sanitizedToNot:
contig = sanitizedToNot[contig]
start = int(start)
stop = int(stop)
# Create a seq object for the TBLASTN hit itself
if start < stop:
strand = +1
else:
strand = -1
tblastn_feature = SeqFeature(FeatureLocation(start, stop), strand=strand, id=tblastn_id)
tblastn_feature.qualifiers["cluster_id"] = -1
# Find the neighboring genes.
neighboring_genes = getGenesInRegion(contig, start - N, stop + N, cur)
if len(neighboring_genes) == 0:
sys.stderr.write(
"WARNING: No neighboring genes found for TBLASTN hit %s within %d nucleotides in contig %s\n"
% (tblastn_id, N, contig)
)
return [tblastn_feature]
else:
neighboring_geneinfo = getGeneInfo(neighboring_genes, cur)
# Find the closest gene to ours and get the clusters for those neighbors based on the specific clusterrunid
minlen = N
mingene = None
minstrand = None
for geneinfo in neighboring_geneinfo:
genestart = int(geneinfo[5])
geneend = int(geneinfo[6])
distance = min(abs(genestart - start), abs(geneend - start), abs(genestart - stop), abs(geneend - stop))
if distance < minlen:
mingene = geneinfo[0]
minlen = distance
neighboring_features = makeSeqFeaturesForGeneNeighbors(mingene, clusterrunid, cur)
# Add the TBLASTN itself and return it.
neighboring_features.append(tblastn_feature)
return neighboring_features
示例2: makeSeqFeature
# 需要导入模块: from Bio.SeqFeature import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature.SeqFeature import qualifiers["cluster_id"] [as 别名]
def makeSeqFeature(geneid, cur):
'''
Make a BioPython SeqFeature object for a gene with ITEP ID geneid
'''
geneinfo = getGeneInfo( [ geneid ], cur )
geneinfo = geneinfo[0]
start = int(geneinfo[5])
stop = int(geneinfo[6])
strand = int(geneinfo[8])
feature = SeqFeature(FeatureLocation(start, stop), strand=strand, id=geneid)
# This can be overwritten by other functions but we need a placeholder.
feature.qualifiers["cluster_id"] = -1
return feature
示例3: makeSeqFeaturesForGeneNeighbors
# 需要导入模块: from Bio.SeqFeature import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature.SeqFeature import qualifiers["cluster_id"] [as 别名]
def makeSeqFeaturesForGeneNeighbors(genename, clusterrunid, cur):
'''
Given a gene ID, compute the neighbors of that gene and create a SeqFeature
object for each.
Returns a list of neigboring genes or an empty array [] if we couldn't do anything
with the gene Id given (not found in database or similar issue)
'''
outdata = getGeneNeighborhoods(genename, clusterrunid, cur)
genelocs = []
for neargene in outdata:
neargeneid = neargene[1]
start = int(neargene[4])
stop = int(neargene[5])
strandsign = neargene[6]
if strandsign =='-':
strand = -1
if strandsign =='+':
strand = +1
feature = SeqFeature(FeatureLocation(start, stop), strand=strand, id = neargeneid)
feature.qualifiers["cluster_id"] = int(neargene[8])
genelocs.append(feature)
return genelocs