本文整理汇总了Python中annogesiclib.helper.Helper类的典型用法代码示例。如果您正苦于以下问题:Python Helper类的具体用法?Python Helper怎么用?Python Helper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Helper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: extract_inter_seq
def extract_inter_seq(inter, cds, seq, fuzzy, inters):
helper = Helper()
start = inter["start"] - fuzzy
end = inter["end"] + fuzzy
if inter["start"] - fuzzy <= 0:
start = 1
if inter["end"] + fuzzy >= len(seq[cds.seq_id]):
end = len(seq)
if cds.strand == "+":
inter_seq = helper.extract_gene(seq[cds.seq_id], start,
end, "+")
else:
inter_seq = helper.extract_gene(seq[cds.seq_id], start,
end, "-")
inters.append(import_data(inter_seq, cds, inter["start"], inter["end"]))
示例2: TargetFasta
class TargetFasta(object):
def __init__(self, tar_folder, ref_folder):
self.multiparser = Multiparser()
self.seq_editer = SeqEditer()
self.helper = Helper()
self.folders = {"tmp_tar": os.path.join(tar_folder, "tmp"),
"tmp_ref": os.path.join(ref_folder, "tmp")}
def get_target_fasta(self, mut_table, tar_folder, ref_folder, output):
self.multiparser.parser_fasta(ref_folder)
if "tmp" in os.listdir(tar_folder):
shutil.rmtree(self.folders["tmp_tar"])
os.mkdir(self.folders["tmp_tar"])
self.seq_editer.modify_seq(self.folders["tmp_ref"], mut_table,
self.folders["tmp_tar"])
print("transfer to target fasta...")
if output is not None:
for file_ in output:
first = True
datas = file_.split(":")
filename = datas[0]
strains = datas[1].split("_and_")
out = open(os.path.join(tar_folder, filename + ".fa"), "w")
for strain in strains:
if strain + ".fa" in os.listdir(self.folders["tmp_tar"]):
if first:
first = False
else:
out.write("\n")
with open(os.path.join(
self.folders["tmp_tar"],
strain + ".fa")) as f_h:
for line in f_h:
out.write(line)
else:
print("Error:no fasta information of {0}.fa".format(
strain))
out.close()
else:
self.helper.move_all_content(self.folders["tmp_tar"],
tar_folder, [".fa"])
shutil.rmtree(self.folders["tmp_tar"])
shutil.rmtree(self.folders["tmp_ref"])
self.helper.remove_all_content(ref_folder, "_folder", "dir")
print("please use the new fasta file to remapping again.")
print("Then copy BAMs and wigs back to input/align_results/BAMs "
"and input/align_results/wigs")
示例3: __init__
def __init__(self):
self.seq_editer = SeqEditer()
self.helper = Helper()
self.tmp_fa = "tmp.fa"
self.tmp_gff = "tmp.gff"
self.tmp_wig_forward = "tmp_forward.wig"
self.tmp_wig_reverse = "tmp_reverse.wig"
示例4: __init__
def __init__(self, args_snp):
self.multiparser = Multiparser()
self.seq_editer = SeqEditer()
self.helper = Helper()
if args_snp.types == "reference":
file_type = "compare_reference"
else:
file_type = "validate_target"
self.seq_path = os.path.join(args_snp.out_folder, file_type, "seqs")
self.stat_path = os.path.join(args_snp.out_folder, file_type,
"statistics")
self.fasta_path = os.path.join(args_snp.fastas, "tmp")
self.outputs = {"table": os.path.join(
args_snp.out_folder, file_type, "SNP_table"),
"raw": os.path.join(
args_snp.out_folder, file_type, "SNP_raw_outputs"),
"tmp": os.path.join(args_snp.out_folder, "tmp_bcf")}
if "whole_reads.bam" in os.listdir(args_snp.out_folder):
self.helper.remove_all_content(args_snp.out_folder,
"whole_read", "file")
self.bams = {"whole": os.path.join(args_snp.out_folder,
"whole_reads.bam"),
"sort": os.path.join(args_snp.out_folder,
"whole_reads_sorted.bam")}
self.header = os.path.join(args_snp.out_folder, "header")
self.baqs = {"with": "with_BAQ", "without": "without_BAQ",
"extend": "extend_BAQ"}
示例5: __init__
def __init__(self, args_ribo):
self.multiparser = Multiparser()
self.helper = Helper()
self.gff_parser = Gff3Parser()
self.gff_path = os.path.join(args_ribo.gffs, "tmp")
if args_ribo.tsss is not None:
self.tss_path = os.path.join(args_ribo.tsss, "tmp")
else:
self.tss_path = None
self.tran_path = os.path.join(args_ribo.trans, "tmp")
self.fasta_path = os.path.join(args_ribo.fastas, "tmp")
if (args_ribo.program == "both") or (
args_ribo.program == "riboswitch"):
(self.ribos_stat_folder, self.ribos_gff_outfolder,
self.ribos_table_folder, self.ribos_scan_folder,
self.ribos_tmp_files, self.ribos_rfam,
self.ribos_suffixs) = self._create_out_folders(
args_ribo.ribos_out_folder, "riboswitch",
args_ribo.database)
if (args_ribo.program == "both") or (
args_ribo.program == "thermometer"):
(self.thermo_stat_folder, self.thermo_gff_outfolder,
self.thermo_table_folder, self.thermo_scan_folder,
self.thermo_tmp_files, self.thermo_rfam,
self.thermo_suffixs) = self._create_out_folders(
args_ribo.thermo_out_folder, "RNA_thermometer",
args_ribo.database)
示例6: __init__
def __init__(self, args_circ):
self.multiparser = Multiparser()
self.helper = Helper()
self.converter = Converter()
self.alignment_path = os.path.join(args_circ.output_folder,
"segemehl_align")
self.splice_path = os.path.join(args_circ.output_folder,
"segemehl_splice")
self.candidate_path = os.path.join(args_circ.output_folder,
"circRNA_tables")
self.gff_folder = os.path.join(args_circ.output_folder, "gffs")
self.gff_path = os.path.join(args_circ.gffs, "tmp")
self.splices = {"all_file": "splicesites_all.bed",
"file": "splicesites.bed",
"all": "splicesites_all", "splice": "splicesites"}
self.trans = {"all_file": "transrealigned_all.bed",
"file": "transrealigned.bed",
"all": "transrealigned_all", "trans": "transrealigned"}
self.bams = {"whole": "whole_reads.bam", "sort": "whole_reads_sort"}
if args_circ.align:
if args_circ.fastas is None:
print("Error: There is no genome fasta file!!!")
sys.exit()
else:
self.fasta_path = os.path.join(args_circ.fastas, "tmp")
else:
self.fasta_path = os.path.join(args_circ.fastas, "tmp")
示例7: __init__
def __init__(self, args_snp):
self.multiparser = Multiparser()
self.seq_editer = SeqEditer()
self.helper = Helper()
if args_snp.types == "related_genome":
file_type = "compare_related_and_reference_genomes"
else:
file_type = "mutations_of_reference_genomes"
self.seq_path = os.path.join(args_snp.out_folder, file_type, "seqs")
self.stat_path = os.path.join(args_snp.out_folder, file_type,
"statistics")
self.fig_path = os.path.join(self.stat_path, "figs")
self.helper.check_make_folder(self.fig_path)
self.outputs = {"table": os.path.join(
args_snp.out_folder, file_type, "SNP_tables"),
"raw": os.path.join(
args_snp.out_folder, file_type, "SNP_raw_outputs"),
"tmp": os.path.join(args_snp.out_folder, "tmp_bcf"),
"depth": os.path.join(args_snp.out_folder, "tmp_depth")}
self.bams = {"whole": os.path.join(args_snp.out_folder,
"whole_reads.bam"),
"sort": os.path.join(args_snp.out_folder,
"whole_reads_sorted.bam"),
"bams": []}
self.header = os.path.join(args_snp.out_folder, "header")
self.baqs = {"with": "with_BAQ", "without": "without_BAQ",
"extend": "extend_BAQ"}
示例8: __init__
def __init__(self, args_utr):
self.helper = Helper()
self.multiparser = Multiparser()
self.tss_path = os.path.join(args_utr.tsss, "tmp")
self.tran_path = os.path.join(args_utr.trans, "tmp")
self.utr5_path = os.path.join(args_utr.out_folder, "5UTR")
self.utr3_path = os.path.join(args_utr.out_folder, "3UTR")
self.utr5_stat_path = os.path.join(self.utr5_path, "statistics")
self.utr3_stat_path = os.path.join(self.utr3_path, "statistics")
示例9: __init__
def __init__(self, args_sc, out_folder):
self.helper = Helper()
args_sc.output_folder = out_folder
filename = args_sc.fasta.split("/")[-1]
self.strain = ".".join(filename.split(".")[0:-1])
self.helper.check_make_folder(os.path.join(args_sc.output_folder,
self.strain))
self.forward_file = os.path.join(args_sc.output_folder,
self.strain, "forward")
self.reverse_file = os.path.join(args_sc.output_folder,
self.strain, "reverse")
os.mkdir(self.forward_file)
os.mkdir(self.reverse_file)
示例10: __init__
def __init__(self, args_op):
self.multiparser = Multiparser()
self.helper = Helper()
self.tss_path = os.path.join(args_op.tsss, "tmp")
self.tran_path = os.path.join(args_op.trans, "tmp")
self.utr5_path = os.path.join(args_op.utr5s, "tmp")
self.utr3_path = os.path.join(args_op.utr3s, "tmp")
self.table_path = os.path.join(args_op.output_folder, "tables")
if args_op.terms is not None:
self._check_gff(args_op.terms, "term")
self.term_path = os.path.join(args_op.terms, "tmp")
else:
self.term_path = None
示例11: __init__
def __init__(self, gffs):
self.multiparser = Multiparser()
self.helper = Helper()
self.out_folder = os.path.join(gffs, "for_libs")
if os.path.exists(self.out_folder):
shutil.rmtree(self.out_folder)
os.mkdir(self.out_folder)
self.stat = os.path.join(self.out_folder, "statistics")
os.mkdir(self.stat)
self.gff_folder = os.path.join(self.out_folder, "gffs")
os.mkdir(self.gff_folder)
self.merge_wigs = os.path.join(gffs, "merge_wigs")
if os.path.exists(self.merge_wigs):
shutil.rmtree(self.merge_wigs)
示例12: setUp
def setUp(self):
self.example = ExampleData()
self.helper = Helper()
self.gff_out = self.example.gff_out
self.rev_seq = self.example.rev_seq.replace("\n", "")
self.test_folder = "test_folder"
if (not os.path.exists(self.test_folder)):
os.mkdir(self.test_folder)
self.gff_file = os.path.join(self.test_folder, "test.gff")
with open(self.gff_file, "w") as rh:
rh.write(self.example.gff_file)
self.seq_file = os.path.join(self.test_folder, "test.fa")
with open(self.seq_file, "w") as rh:
rh.write(self.example.seq)
示例13: __init__
def __init__(self, args_tar):
self.multiparser = Multiparser()
self.helper = Helper()
self.fixer = FormatFixer()
self.gff_parser = Gff3Parser()
self.target_seq_path = os.path.join(args_tar.out_folder, "target_seqs")
self.srna_seq_path = os.path.join(args_tar.out_folder, "sRNA_seqs")
self.rnaplex_path = os.path.join(args_tar.out_folder, "RNAplex")
self.rnaup_path = os.path.join(args_tar.out_folder, "RNAup")
self.merge_path = os.path.join(args_tar.out_folder, "merge")
self.srna_path = os.path.join(args_tar.srnas, "tmp")
self.fasta_path = os.path.join(args_tar.fastas, "tmp")
self.gff_path = os.path.join(args_tar.gffs, "tmp")
self.tmps = {"tmp": "tmp", "rnaup": "tmp_rnaup", "log": "tmp_log",
"all_fa": "tmp*.fa", "all_txt": "tmp*.txt"}
示例14: __init__
def __init__(self, args_tss):
self.multiparser = Multiparser()
self.helper = Helper()
self.converter = Converter()
self.master = os.path.join(args_tss.out_folder, "MasterTables")
self.tmps = {"tss": "tmp_TSS", "ta_tss": "tmp_ta_tss", "tss_ta":
"tmp_tss", "tmp": "tmp"}
if args_tss.ta_files is not None:
self.tmps["ta"] = os.path.join(args_tss.ta_files, "tmp")
else:
self.tmps["ta"] = None
self.gff_path = os.path.join(args_tss.gffs, "tmp")
self.wig_path = os.path.join(args_tss.wig_folder, "tmp")
self.fasta_path = os.path.join(args_tss.fastas, "tmp")
self.stat_outfolder = os.path.join(args_tss.out_folder, "statistics")
self.gff_outfolder = os.path.join(args_tss.out_folder, "gffs")
示例15: __init__
def __init__(self, args_go):
self.multiparser = Multiparser()
self.helper = Helper()
self.out_all = os.path.join(args_go.out_folder, "all_CDSs")
self.out_express = os.path.join(args_go.out_folder, "expressed_CDSs")
self.result_all_path = os.path.join(self.out_all, "GO_term_results")
self.result_express_path = os.path.join(self.out_express,
"GO_term_results")
self.gff_path = os.path.join(args_go.gffs, "tmp")
if args_go.trans is not None:
self.tran_path = os.path.join(args_go.trans, "tmp")
else:
self.tran_path = None
self.stat_all_path = os.path.join(self.out_all, "statistics")
self.stat_express_path = os.path.join(self.out_express,
"statistics")
self.all_strain = "all_genomes_uniprot.csv"