Commit 49dff695 by Mustafa Tekpinar

Added normweightmode as an argument to Python part of the code

parent e197ed88
......@@ -3,7 +3,7 @@
# This code is part of the gemme package and governed by its license.
# Please see the LICENSE.txt file included as part of this package.
# Usage: Rscript --save runPred.R XXXX
# Usage: Rscript --save computePred.R XXXX
library("seqinr")
source(paste(Sys.getenv("GEMME_PATH"),"/pred.R",sep=""))
......@@ -22,6 +22,7 @@ prot = args[1]
aliFile = args[2]
simple = args[3]
fname = args[4]
normWeightMode = args[5]
# read alignment and convert to matrix
ali=as.matrix.alignment(read.alignment(aliFile,format="fasta"))
......@@ -92,7 +93,7 @@ print("running normalization...")
#normWeightMode="trace+pc+cv"
#normWeightMode="trace+pc"
#normWeightMode="trace+cv"
normWeightMode="trace"
#normWeightMode="trace"
#print(normWeightMode)
#In future, you may need to comment line 44 to use this functionality if you do
#weighting not just in normalization.
......
......@@ -255,9 +255,14 @@ def parse_command_line():
help='fasta file containing related sequences',
default=''
)
retMet_args.add_argument('--isjet2on', dest='isjet2on', type=str, \
help="If false, it will skip JET2 calculation and use a precalculated JET2 file. Default is true",
required=False, default="True")
retMet_args.add_argument('--normweightmode', dest='normweightmode', type=str, \
help="It can be one of these: 'trace', 'trace+pc', 'trace+cv' or 'trace+pc+cv'. Default is 'trace'.",
required=False, default="trace")
args = parser.parse_args()
......@@ -267,14 +272,15 @@ def parse_command_line():
# Check flag arguments
if args.input is None:
parser.error("gemme requires an input alignment.")
parser.error("GEMME requires an input alignment.")
return args
def doit(inAli,mutFile,retMet,bFile,fFile,n,N, isjet2on):
def doit(inAli,mutFile,retMet,bFile,fFile,n,N, isjet2on, normWeightMode):
"""
Fonksiyon aciklamasi ile taniminin ayni olmasi super olmus!
Perfect explanation for a function: typing the function call exactly!
doit is basically the main function in disguise!
doit(args.input,args.mutations,args.retrievingMethod,args.blastFile,args.fastaFile, args.isjet2on)
"""
simple = True
......@@ -298,7 +304,7 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, isjet2on):
else:
print("ERROR: You can only use true or false after --isjet2on!")
sys.exit(-1)
launchPred(prot,inAli,mutFile)
launchPred(prot,inAli,mutFile, normWeightMode)
#Do Python plotting here
#TODO: Eventually, I will do the map plotting with a completely independent
......@@ -344,7 +350,7 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, isjet2on):
def main():
args = parse_command_line()
doit(args.input,args.mutations,args.retrievingMethod,args.blastFile,\
args.fastaFile,args.nIter,args.NSeqs, args.isjet2on)
args.fastaFile,args.nIter,args.NSeqs, args.isjet2on, args.normweightmode)
if (__name__ == '__main__'):
main()
......
......@@ -135,12 +135,12 @@ def launchJET(prot,retMet,bFile,fFile,n,N,nl):
return(reCode)
# Run Rscript to compute predictions
def launchPred(prot,inAli,mutFile):
def launchPred(prot,inAli,mutFile, normWeightMode):
if mutFile!='':
rcmd="Rscript --save $GEMME_PATH/computePred.R "+prot+" "+inAli+" FALSE "+mutFile
rcmd="Rscript --save $GEMME_PATH/computePred.R "+prot+" "+inAli+" FALSE "+mutFile+" "+normWeightMode
else:
rcmd="Rscript --save $GEMME_PATH/computePred.R "+prot+" "+inAli+" TRUE none"
rcmd="Rscript --save $GEMME_PATH/computePred.R "+prot+" "+inAli+" TRUE none "+normWeightMode
print("\nRunning: \n"+rcmd)
reCode=subprocess.call(rcmd,shell=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment