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


Python SeqFeature.qualifiers["note"]方法代码示例

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


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

示例1: mergeMod

# 需要导入模块: from Bio.SeqFeature import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature.SeqFeature import qualifiers["note"] [as 别名]
def mergeMod(args):

    filetype = args.inFormat
    # Load file as SeqRecord
    int_handle = open(args.input, "r")
    recs = list(SeqIO.parse(int_handle, filetype))
    # For each SeqRecord, I.e. complete gbk annotation obj in file
    fgbk = recs[0]
    from Bio.SeqFeature import SeqFeature, FeatureLocation

    d = SeqFeature(FeatureLocation(0, len(fgbk)), type="fasta_record", strand=1)
    d.qualifiers["note"] = recs[0].name
    fgbk.features.append(d)
    for l in recs[1:]:
        d = SeqFeature(FeatureLocation(len(fgbk), len(fgbk) + len(l)), type="fasta_record", strand=1)
        d.qualifiers["note"] = l.name
        fgbk.features.append(d)
        fgbk += l
    fgbk.name = recs[0].name
    fgbk.description = recs[0].description
    fgbk.annotations = recs[0].annotations
    if args.accession != None:
        fgbk.name = args.accession
    if args.ver != None:
        fgbk.id = fgbk.name + "." + args.ver
    for f in fgbk.features:
        if f.type == "source":
            fgbk.features.remove(f)
    d = SeqFeature(FeatureLocation(0, len(fgbk)), type="source", strand=1)
    fgbk.features.insert(0, d)
    outtype = filetype
    if args.outFormat != None:
        outtype = args.outFormat
    out_handle = open(args.output, "w")
    SeqIO.write(fgbk, out_handle, outtype)
开发者ID:happykhan,项目名称:seqhandler,代码行数:37,代码来源:SeqHandler.py

示例2: mergeRecords

# 需要导入模块: from Bio.SeqFeature import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature.SeqFeature import qualifiers["note"] [as 别名]
def mergeRecords(file): #adapted from SeqHandler by NF Alikhan (github.com/happykhan/seqhandler)

#SeqHandler is a script for merging, converting and splitting sequence files (Genbank, EMBL, fasta and others). Please use it to merge multi-Genbank files before running bwast.py

    filetype = determineFileType(file) #determine file type
    readInMultifasta = open(file, "r")
    records = list(SeqIO.parse(readInMultifasta, filetype))

    mergingFile = records[0]
    from Bio.SeqFeature import SeqFeature, FeatureLocation
    contigs = SeqFeature(FeatureLocation(0, len(mergingFile) ), type="fasta_record",\
                strand=1)
    contigs.qualifiers["note"] = records[0].name #pull out contig number of first contig
    mergingFile.features.append(contigs) #append first contig to mergingFile
    for nextRecord in records[1:]:
        contigs = SeqFeature(FeatureLocation(len(mergingFile), len(mergingFile) + len(nextRecord)), type="fasta_record",\
                strand=1)
        contigs.qualifiers["note"] = nextRecord.name 
        mergingFile.features.append(contigs) #append subsequent contigs to mergingFile
        mergingFile += nextRecord
    mergingFile.name = records[0].name
    mergingFile.description = records[0].description
    mergingFile.annotations = records[0].annotations

    for feature in mergingFile.features:
        if feature.type == 'source':
            mergingFile.features.remove(feature)
    contigs = SeqFeature(FeatureLocation(0, len(mergingFile)), type="source", strand=1)
    mergingFile.features.insert(0,contigs)
    merged_file = re.sub(r"\.\w+$", r".merged.fa", file)
    out_handle = open(merged_file, "w")
    SeqIO.write(mergingFile, out_handle, filetype)
    return merged_file
开发者ID:bawee,项目名称:bwast,代码行数:35,代码来源:bwast.py

示例3: map

# 需要导入模块: from Bio.SeqFeature import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature.SeqFeature import qualifiers["note"] [as 别名]
    count = 0;
    for line in orf_tb_file:
        count += 1;
        cds_num = map(int, line.split('\t'))
        cds_seq = seq_record.seq[cds_num[1] - 1:cds_num[2]]
        std = 1
        if cds_num[0] < 0:
            cds_seq = cds_seq.reverse_complement()
            std = -1
            
        cds_translate = str(cds_seq.translate())
        cds_translate = cds_translate[0:len(cds_translate)-1]
        cds_feature = SeqFeature(FeatureLocation(cds_num[1] - 1, cds_num[2], strand = std), type = "CDS")
        cds_feature.qualifiers["locus_tag"] = ['BSNPV' + str(count).zfill(3)]
        cds_feature.qualifiers["codon_start"] = ['1']
        cds_feature.qualifiers["product"] = ['unknown']
        cds_feature.qualifiers["note"] = ['unknown']
        cds_feature.qualifiers["db_xref"] = ['GI:100000' + str(count).zfill(3)]
        cds_feature.qualifiers["translation"] = [cds_translate]
        cds_feature.qualifiers["protein_id"] = ['LP_100000' + str(count).zfill(3)]
        
        seq_record.features.append(cds_feature)
        
    gb_record.append(seq_record)
    
SeqIO.write(gb_record, gb_gn_file, "genbank")

fas_gn_file.close()
orf_tb_file.close()
gb_gn_file.close()  
        
开发者ID:lijax,项目名称:bioscript,代码行数:32,代码来源:fas_orf2fake_gb.py


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