Commit 49dff695 by Mustafa Tekpinar

Added normweightmode as an argument to Python part of the code

parent e197ed88
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# This code is part of the gemme package and governed by its license. # 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. # 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") library("seqinr")
source(paste(Sys.getenv("GEMME_PATH"),"/pred.R",sep="")) source(paste(Sys.getenv("GEMME_PATH"),"/pred.R",sep=""))
...@@ -22,6 +22,7 @@ prot = args[1] ...@@ -22,6 +22,7 @@ prot = args[1]
aliFile = args[2] aliFile = args[2]
simple = args[3] simple = args[3]
fname = args[4] fname = args[4]
normWeightMode = args[5]
# read alignment and convert to matrix # read alignment and convert to matrix
ali=as.matrix.alignment(read.alignment(aliFile,format="fasta")) ali=as.matrix.alignment(read.alignment(aliFile,format="fasta"))
...@@ -92,7 +93,7 @@ print("running normalization...") ...@@ -92,7 +93,7 @@ print("running normalization...")
#normWeightMode="trace+pc+cv" #normWeightMode="trace+pc+cv"
#normWeightMode="trace+pc" #normWeightMode="trace+pc"
#normWeightMode="trace+cv" #normWeightMode="trace+cv"
normWeightMode="trace" #normWeightMode="trace"
#print(normWeightMode) #print(normWeightMode)
#In future, you may need to comment line 44 to use this functionality if you do #In future, you may need to comment line 44 to use this functionality if you do
#weighting not just in normalization. #weighting not just in normalization.
......
...@@ -255,10 +255,15 @@ def parse_command_line(): ...@@ -255,10 +255,15 @@ def parse_command_line():
help='fasta file containing related sequences', help='fasta file containing related sequences',
default='' default=''
) )
retMet_args.add_argument('--isjet2on', dest='isjet2on', type=str, \ 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", help="If false, it will skip JET2 calculation and use a precalculated JET2 file. Default is true",
required=False, default="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() args = parser.parse_args()
arg_dict = vars(args) arg_dict = vars(args)
...@@ -267,14 +272,15 @@ def parse_command_line(): ...@@ -267,14 +272,15 @@ def parse_command_line():
# Check flag arguments # Check flag arguments
if args.input is None: if args.input is None:
parser.error("gemme requires an input alignment.") parser.error("GEMME requires an input alignment.")
return args 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) doit(args.input,args.mutations,args.retrievingMethod,args.blastFile,args.fastaFile, args.isjet2on)
""" """
simple = True simple = True
...@@ -298,7 +304,7 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, isjet2on): ...@@ -298,7 +304,7 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, isjet2on):
else: else:
print("ERROR: You can only use true or false after --isjet2on!") print("ERROR: You can only use true or false after --isjet2on!")
sys.exit(-1) sys.exit(-1)
launchPred(prot,inAli,mutFile) launchPred(prot,inAli,mutFile, normWeightMode)
#Do Python plotting here #Do Python plotting here
#TODO: Eventually, I will do the map plotting with a completely independent #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): ...@@ -344,7 +350,7 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, isjet2on):
def main(): def main():
args = parse_command_line() args = parse_command_line()
doit(args.input,args.mutations,args.retrievingMethod,args.blastFile,\ 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__'): if (__name__ == '__main__'):
main() main()
......
...@@ -135,12 +135,12 @@ def launchJET(prot,retMet,bFile,fFile,n,N,nl): ...@@ -135,12 +135,12 @@ def launchJET(prot,retMet,bFile,fFile,n,N,nl):
return(reCode) return(reCode)
# Run Rscript to compute predictions # Run Rscript to compute predictions
def launchPred(prot,inAli,mutFile): def launchPred(prot,inAli,mutFile, normWeightMode):
if mutFile!='': 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: 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) print("\nRunning: \n"+rcmd)
reCode=subprocess.call(rcmd,shell=True) 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