Example #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) = datafuncs.fastaread(datafilenamepos,
                                                  datafilenameneg)
        (testex, testlab) = datafuncs.fastaread(datafilenametest)
        argv_rest = argv[4:]
    elif argv[0] == 'arff':
        datafilename = argv[1]
        datafilenametest = argv[2]
        (trainex, trainlab) = datafuncs.arffread(kernelname, datafilename)
        (testex, testlab) = datafuncs.arffread(kernelname, datafilenametest)
        argv_rest = argv[3:]
    else:
        print 'Error in parse_input_file'

    return (trainex, trainlab, testex, argv_rest)
Example #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) = datafuncs.fastaread(datafilenamepos,
                                                 datafilenameneg)
        argv_rest = argv[3:]
    elif argv[0] == 'arff':
        datafilename = argv[1]
        (examples, labels) = datafuncs.arffread(kernelname, datafilename)
        argv_rest = argv[2:]
    else:
        print 'Error in parse_input_file'

    return (examples, labels, argv_rest)
Example #3
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) = datafuncs.fastaread(datafilenamepos, datafilenameneg)
        (testex, testlab) = datafuncs.fastaread(datafilenametest)
        argv_rest=argv[4:]
    elif argv[0] == 'arff':
        datafilename = argv[1]
        datafilenametest = argv[2]
        (trainex, trainlab) = datafuncs.arffread(kernelname, datafilename)
        (testex, testlab) = datafuncs.arffread(kernelname, datafilenametest)
        argv_rest=argv[3:]
    else:
        print 'Error in parse_input_file'

    return (trainex,trainlab,testex,argv_rest)
Example #4
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) = datafuncs.fastaread(datafilenamepos, datafilenameneg)
        argv_rest=argv[3:]
    elif argv[0] == 'arff':
        datafilename = argv[1]
        (examples, labels) = datafuncs.arffread(kernelname, datafilename)
        argv_rest=argv[2:]
    else:
        print 'Error in parse_input_file'

    return (examples,labels,argv_rest)