Ejemplo n.º 1
0
def parse_input_file_train_test(kernelname, argv):
    """Parse the input and output file names"""

    if len(argv)<3 or (argv[0]=="fasta" and len(argv)<4) or (argv[0]!='fasta' and argv[0]!='arff'):
        sys.stderr.write("data usage: arff <train.arff> <test.arff>\n        or: fasta <train_pos.fa> <train_neg.fa> <test.fa>\n") 
        sys.exit(-1)
 
    if argv[0] == 'fasta':
        datafilenamepos = argv[1]
        datafilenameneg = argv[2]
        datafilenametest = argv[3]
        (trainex, trainlab) = datagen.fastaread(datafilenamepos, datafilenameneg)
        (testex, testlab) = datagen.fastaread(datafilenametest)
        argv_rest=argv[4:]
    elif argv[0] == 'arff':
        datafilename = argv[1]
        datafilenametest = argv[2]
        (trainex, trainlab) = datagen.arffread(kernelname, datafilename)
        (testex, testlab) = datagen.arffread(kernelname, datafilenametest)
        argv_rest=argv[3:]
    else:
        print 'Error in parse_input_file'

    return (trainex,trainlab,testex,argv_rest)
Ejemplo n.º 2
0
def parse_input_file_train(kernelname, argv):
    """Parse the input and output file names"""

    if len(argv)<2 or (argv[0]=="fasta" and len(argv)<3) or (argv[0]!='fasta' and argv[0]!='arff'):
        sys.stderr.write("data usage: arff <train.arff>\n        or: fasta <train_pos.fa> <train_neg.fa>\n") 
        sys.exit(-1)

    if argv[0] == 'fasta':
        datafilenamepos = argv[1]
        datafilenameneg = argv[2]
        (examples, labels) = datagen.fastaread(datafilenamepos, datafilenameneg)
        argv_rest=argv[3:]
    elif argv[0] == 'arff':
        datafilename = argv[1]
        (examples, labels) = datagen.arffread(kernelname, datafilename)
        argv_rest=argv[2:]
    else:
        print 'Error in parse_input_file'

    return (examples,labels,argv_rest)