Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#!/usr/bin/env python
'''
@author: jbayer
Processes the user input and starts the program.
'''
import argparse, os
from argparse import RawTextHelpFormatter # format text in argparse
from scripts import do_limitt
def main():
file_path = os.path.dirname(os.path.realpath(__file__)) # get file path of miRNAim.py to define path to internal files #
parser = argparse.ArgumentParser(description=desc(),epilog=epi(), formatter_class = RawTextHelpFormatter)
#parser.add_argument('-uni', action='store_true', help="Start mapping of Gene or Protein IDs/Symbols to UniProt.") # does not make sense yet, because just MTI specific genes are in the UniProt dictionary
parser.add_argument('-im', default='', nargs='+', help='File input miRNAs with one miRNA per line +\ncolumn with additional information (starts at 1).\n+ description of additional information\nUsage: -im path/file.txt 5 "miRNA sequence".')
parser.add_argument('-ia', default='', nargs='+', type = str,
help='File input annotation file + column with UniProt\naccessions (starts at 1) + column with additional\ninformation + description of additional information.\nUsage: -ia path/file.txt 3 1 transcript')
parser.add_argument('-ir', default='', help='File input rank UniProtAcc list for MTI-set\nenrichment analysis (MTISEA).', type = str)
parser.add_argument('-cl', action='store_true', help='If no miRNA file was submitted: Cluster miRNAs over\nspecies and hairpin arm information\n(hsa-miR-123a-5p -> miR-123a). Usage: -cl')
parser.add_argument('-base', default=[1, 2, 3, 4],nargs='+', choices=(1,2,3,4),type=int,
help='miRNA-Target database to search in.\n1: TarBase, 2: miRTarBase, 3: miRecords, 4: starBase.\nSeparate with space. Default: All four.\nUsage: -base 1 2 3')
parser.add_argument('-occ', default=2, choices=(1,2,3,4),type=int,
help='Occurrence of miRNA-Target interaction over all DBs.\nDefault: 2 (= found at least in two DBs)\nUsage: -occ 3')
parser.add_argument('-exp', default=[], nargs='+', help='Experimental methods MTIs were validated with.\nEither use categories (see help) or keywords.\nSeparate with space. Usage: -exp immuno "Western Blot"')
parser.add_argument('-spec', default=[], nargs='+', help='Species or category to search MTIs for (see help).\nSeparate with space. Use -spec i to ignore species.\nDefault: Species given by miRNA-target DBs.\nUsage: -spec mmu hsa')
parser.add_argument('-nspec',default=[], nargs='+', help='Species or category to exclude (see help).\nSeparate with space.')
parser.add_argument('-str', default=1, choices=(1,2,3,5),type=int,
help='Stringency for starBase (number of supporting CLIP-seq\nexperiments). Usage: -str 3' )
parser.add_argument('-perm', default=1000, help='For MTISEA: Number of permutations.\nDefault: 1000 Usage: -p 500', type=int)
parser.add_argument('-p', default=1, help='For MTISEA: Power for weighting of ranking values.\nDefault: 1 (=single weighted)\nUsage: -p 2 (square weighting)', type=float)
parser.add_argument('-o', default='', help='Path for output.', type=str)
## Internal Processing - Output file names ##
parser.add_argument('-idb', default=file_path+'/files/', type=str, help=argparse.SUPPRESS) # Path to database input files.
parser.add_argument('-ot', default='MTI_Info.tab', type=str, help=argparse.SUPPRESS) # MTI details report
parser.add_argument('-om', default='MTI_Matrix.tab', type=str, help=argparse.SUPPRESS) # matrix with DB info
parser.add_argument('-ob', default='BarGraph.pdf', type=str, help=argparse.SUPPRESS) # Bar Graph
parser.add_argument('-ol', default='MTI_Sets_ranked.tab', type=str, help=argparse.SUPPRESS) # miRNA score table
parser.add_argument('-oh', default='MTI_Overlap_HM.pdf', type=str, help=argparse.SUPPRESS) # MTI-Sets overlap ratio heatmap
parser.add_argument('-oe', default='EnrichmentScore_Plots.pdf',type=str, help=argparse.SUPPRESS) # running Enrichment Score plots of each MTI-Set
parser.add_argument('-og', default='MTI_Set_Genes.tab', type=str, help=argparse.SUPPRESS) # Table of Genes + Info for each MTI-Set
#parser.add_argument('-ov', default='Venn.pdf', type=str, help=argparse.SUPPRESS)
args = parser.parse_args()
dbaseName_list = ["TarBase","miRTarBase","miRecords","starBase"]
combine_miRNAs = args.cl # boolean to combine miRNAs over organism and hairpin arm info
sel = False # boolean to select MTIs only (no annotation file given)
if 'i' in args.spec:
igOrg = True # value for ignoring organism info
else:
igOrg = False
# Identify validated MTIs via user-defined miRNAs and genes/proteins #
if args.im and args.ia:
rev = False
combine_miRNAs = False # no combining for user-defined miRNAs
# Identify MTIs with validated targets and predicted miRNAs via user-defined genes/proteins #
elif args.ia:
rev = True
# Select MTIs via optional miRNAs #
else:
rev = False
sel = True
if args.im:
combine_miRNAs = False # no combining for user-defined miRNAs
# Start Process #
do_limitt.main(dbase_l=args.base, dbase_name_l=dbaseName_list, occur=args.occ, exp_l=args.exp, org_l=args.spec, norg_l=args.nspec,
stringen=args.str, mir_val_l=args.im, annot_val_l=args.ia, rank_path=args.ir, in_path=args.idb, igOrg=igOrg,
length=len(args.base),permut = args.perm, p = args.p, matrix_path=args.o+args.om, barplot_path=args.o+args.ob,
annot_path=args.o+args.ot, score_path = args.o+args.ol, heatm_path = args.o+args.oh,
enrich_path = args.o+args.oe, leadEdge_path = args.o+args.og, rev = rev, comb = combine_miRNAs, sel = sel)
def desc():
''' Tool description '''
desc = '''### miRNAim ###\n
miRNAim automatically identifies validated miRNA target interactions (MTIs) and
affected proteins from a list of miRNAs and a list of genes or proteins mapped
onto UniProt accessions (annotation file), by using the information of different
databases containing experimentally verified MTIs. If no miRNAs are existent,
the pipeline will predict miRNAs by the use of the given genes/proteins.
With a list of UniProt accessions and their ranking values (e.g. expression
profile), miRNAim will identify the significantly enriched MTI sets from the
identified MTIs.\n\n'''
return desc
def epi():
epi = '''For more help see HELP file.\n
'''
return epi
if __name__ == "__main__":
main()