Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed click, added parameter check #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 50 additions & 13 deletions CODE/feat_extract/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,58 @@
profiler = None

# -r r'.\Chap\train' -s r'.\Chap\test' -rs r'.\Chap' --testFeatures True --trainFeatures True
# -r r'E:\Dropbox\Dropbox\bioInf_lab\AA_info\CODE\feat_extract\Chap\train' -s r'E:\Dropbox\Dropbox\bioInf_lab\AA_info\CODE\feat_extract\Chap\test' -rs r'E:\Dropbox\Dropbox\bioInf_lab\AA_info\CODE\feat_extract\Chap' --testFeatures True --trainFeatures True

# -r r'C:\Users\Michael\Desktop\Feature_Extract\test_seq\Chap\train' -s r'C:\Users\Michael\Desktop\Feature_Extract\test_seq\Chap\test' -rs r'C:\Users\Michael\Desktop\Feature_Extract\test_seq\Chap\results' --testFeatures True --trainFeatures True
# -r 'C:\Users\Michael\Desktop\Feature_Extract\test_seq\Chap\train' -s 'C:\Users\Michael\Desktop\Feature_Extract\test_seq\Chap\test' -rs 'C:\Users\Michael\Desktop\Feature_Extract\test_seq\Chap\results' --testFeatures True --trainFeatures True
# -r 'C:\\Users\\Michael\\Desktop\\Feature_Extract\\test_seq\\Chap\\train' -s 'C:\\Users\\Michael\\Desktop\\Feature_Extract\\test_seq\\Chap\\test' -rs 'C:\\Users\\Michael\\Desktop\\Feature_Extract\\test_seq\\Chap\\results' --testFeatures True --trainFeatures True
# -r C:\Users\Michael\Desktop\Feature_Extract\test_seq\Chap\train -s C:\Users\Michael\Desktop\Feature_Extract\test_seq\Chap\test -rs C:\Users\Michael\Desktop\Feature_Extract\test_seq\Chap\results --testFeatures True --trainFeatures True

##ADD OPT for classifier type , and if to use classifier tuning
@click.command()
@click.option('--trainingSetDir','-r','trainingDir',default=r'C:\Users\Michael\Desktop\Feature_Extract\test_seq\Chap\train',
help='The path to the training set fasta files', type = str)
@click.option('--testingSetDir','-s','testingDir',default=r'C:\Users\Michael\Desktop\Feature_Extract\test_seq\Chap\test',
help='The path to the testing set fasta files', type = str)
@click.option('--resultsDir','-rs','resultsDir',default=r'.\results',
help='The path to directory to write the results files', type = str)
@click.option('--trainFeatures','-rf','GetTrainingFeatures',default=True,help='Whether to extract the training set features', type = bool)
@click.option('--testFeatures','-sf','GetTestFeatures',default=False,help='Whether to get the testing set features', type = bool)
@click.option('--classType','-ct','classType',default='file',help="Defines the classname of each protein, by \'dir\', \'file\', or \'id\'.", type = str)
def pipeline(trainingDir,testingDir,resultsDir, GetTrainingFeatures,GetTestFeatures, classType):
import argparse

parser = argparse.ArgumentParser()
# @click.option('--trainingSetDir','-r','trainingDir',default=r'C:\Users\Michael\Desktop\Feature_Extract\test_seq\Chap\train',
# help='The path to the training set fasta files', type = str)
# @click.option('--testingSetDir','-s','testingDir',default=r'C:\Users\Michael\Desktop\Feature_Extract\test_seq\Chap\test',
# help='The path to the testing set fasta files', type = str)
# @click.option('--resultsDir','-rs','resultsDir',default=r'.\results',
# help='The path to directory to write the results files', type = str)
# @click.option('--trainFeatures','-rf','GetTrainingFeatures',default=True,help='Whether to extract the training set features', type = bool)
# @click.option('--testFeatures','-sf','GetTestFeatures',default=False,help='Whether to get the testing set features', type = bool)
# @click.option('--classType','-ct','classType',default='file',help="Defines the classname of each protein, by \'dir\', \'file\', or \'id\'.", type = str)

parser.add_argument('--trainingSetDir','-r',dest='trainingDir', type = str,help='The path to the training set fasta files')
parser.add_argument('--testingSetDir','-s',dest='testingDir', type = str,help='The path to the testing set fasta files')
parser.add_argument('--resultsDir','-rs',dest='resultsDir', type = str,help='The path to directory to write the results files')
parser.add_argument('--trainFeatures','-rf',dest='GetTrainingFeatures', type = bool,help='Whether to extract the training set features')
parser.add_argument('--testFeatures','-sf',dest='GetTestFeatures', type = bool,help='Whether to get the testing set features')
parser.add_argument('--classType','-ct',dest='classType', type = str,help='Defines the classname of each protein, by \'dir\', \'file\', or \'id\'."')

def pipeline():
results = parser.parse_args()
trainingDir=results.trainingDir
testingDir=results.testingDir
resultsDir=results.resultsDir
GetTrainingFeatures=results.GetTrainingFeatures
GetTestFeatures=results.GetTestFeatures
classType=results.classType
if (not os.path.exists(trainingDir)):
print('training dir doesn\'t exist')
exit()
if (not os.path.exists(testingDir)):
print('testing dir doesn\'t exist')
exit()
if (not os.path.exists(resultsDir)):
print('results dir doesn\'t exist')
exit()
if not (os.access(trainingDir, os.R_OK) and os.access(trainingDir, os.X_OK) and os.access(trainingDir, os.W_OK)):
print('don\' have permission to access training dir')
exit()
if not (os.access(testingDir, os.R_OK) and os.access(testingDir, os.X_OK) and os.access(testingDir, os.W_OK)):
print('don\' have permission to access testing dir')
exit()
if not (os.access(resultsDir, os.R_OK) and os.access(resultsDir, os.X_OK) and os.access(resultsDir, os.W_OK)):
print('don\' have permission to access results dir')
exit()
print(profiler)
# change here to the training data folder
# trainingDir = r'E:\Dropbox\Dropbox\BioInformatics Lab\AA_Information\CODE\Feature_Extract\test_seq\Chap'
Expand Down