parsing_opts.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:RiboCode 作者: xzt41 项目源码 文件源码
def parsing_ribo():
    parser = argparse.ArgumentParser(
        description="The main function designed for detecting ORF using ribosome-profiling data."
    )
    parser.add_argument("-a","--annot_dir",dest="annot_dir",required=True,type=str,
                        help="transcripts annotation directory, generated by prepare_transcripts.")
    parser.add_argument("-c","--config_file",dest="config_file",required=True,type=str,
                        help="list bam file and P-sites information in this file, \
                        please refer to the example file in data folder.")
    # parser.add_argument("-n","--num-threads",dest="threads_num",default=1,required=False,
    #                     help="number of threads, optimal number is number of bam files.", type=int)
    parser.add_argument("-l","--longest-orf",dest="longest_orf",choices=["yes","no"],default="yes",required=False,
                        help="Default: yes, the region from most distal AUG to stop was defined as an ORF. \
                              If set to no , the position of start codon will be automatically determined by program.", type=str)
    parser.add_argument("-p","--pval-cutoff",dest="pval_cutoff",default=0.05,required=False,
                        help="P-value cutoff for ORF filtering, default 0.05", type=float)
    parser.add_argument("--stranded","--stranded",dest="stranded",required=False,type=str,choices=["yes","reverse"],
                        default="yes",help="whether the data is strand-specific, \
                        reverse means reversed strand interpretation.(default: yes)")
    parser.add_argument("-s","--start_codon",default="ATG",type=str,dest="start_codon",
                        help="The canonical start codon. default: ATG")
    parser.add_argument("-A","--alt_start_codons",default="",type=str,dest="alternative_start_codons",
                        help="The alternative start codon, such as CTG,GTG, default: None. Multiple codons should be separated by comma.")
    parser.add_argument("-S","--stop_codon",default="TAA,TAG,TGA",type=str,dest="stop_codon",
                        help="Stop codon, default: TAA,TAG,TGA")
    parser.add_argument("-t","--transl_table",default=1,dest="transl_table",type=int,
                        help="ORF translation table(Default: 1). Assign the correct genetic code based on your organism, \
                        [please refer: https://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi]")
    parser.add_argument("-m","--min-AA-length",dest="min_AA_length",default="20",required=False,
                        help="The minimal length of predicted peptides,default 20", type=int)
    # parser.add_argument("-P","--parallel_num",dest="parallel_num",default=1,required=False,
    #                     help="the number of threads to read the alignment file(s), \
    #                     the optimal value is the number of alignment files, default=1",type=int)
    parser.add_argument("-o","--output-name",dest="output_name",default="final_result",required=False,
                        help="output file name, default: final_result", type=str)
    parser.add_argument("-g","--output-gtf",dest="output_gtf",action='store_true',default=False,required=False,
                        help="output the gtf file of predicted ORFs")
    parser.add_argument("-b","--output-bed",dest="output_bed",action='store_true',default=False,required=False,
                        help="output the bed file of predicted ORFs")
    parser.add_argument('-V',"--version",action="version",version=__version__)
    args = parser.parse_args()

    if not os.path.exists(args.annot_dir):
        raise  ValueError("Error, the transcript annotation directory not found: {} \n \
                     pls run prepare_transcripts.py first. ".format(args.annot_dir))

    return args
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号