Пример #1
0
def shuffleVector(vectorS):
    vlen = len(vectorS)
    portionToShuffle = int(ShufflePortion * vlen)
    tempVec = list(vectorS)

    if (portionToShuffle < 1):
        raise CF.InputError("Given portion to shuffle is less than 1.")
    else:
        random.seed(dt.now().time())
        portionIndex = random.sample(range(0, vlen), portionToShuffle)
        shuffleV = list(np.array(vectorS)[portionIndex])
        random.shuffle(shuffleV)

        for i in range(0, len(portionIndex)):
            tempVec[portionIndex[i]] = shuffleV[i]

    return tempVec
Пример #2
0
    #Optional Arguments:
    parser.add_argument('-t',
                        '--FIX_THRESHOLD',
                        help='User defined fixation cut-off. Default = 0.75',
                        type=float)

    if (len(sys.argv) <= 1):
        print(program_function)
        parser.print_help()
        sys.exit()

    args = parser.parse_args()

    #Checking Required Arguments:
    if (not CF.okFile(args.SNP_FILE)):
        raise CF.InputError(args.SNP_FILE, "Invalid input file: ")
    if (not CF.okFile(args.REF_SEQ)):
        raise CF.InputError(args.REF_SEQ, "Invalid input file: ")
    else:
        ref_record = CF.getFile(args.REF_SEQ)
        CF.recordCheck(ref_record, args.REF_SEQ)
        ref_record = CF.getFile(
            args.REF_SEQ
        )  #reparse the reference file, because iterator does not reset.

    #Checking Optional Arguments:
    if (args.FIX_THRESHOLD):
        CutOff = args.FIX_THRESHOLD

    subFixation(ref_record, args.SNP_FILE)
Пример #3
0
 parser.add_argument('-extra', '--EXTRA_FILES', help = 'Prevents removal of potentially useful output files that iedb_tool.py makes.', action = 'store_true' )
 parser.add_argument('-mfile', '--IEDB_MPRED', help = 'Parsed prediction file of mutated epitopes from iedbPredictionParser.')
 parser.add_argument('-mref', '--MUT_SEQ', help = 'A fasta sequence file in amino acids with mutations subbed in. Output of fixationSubber.py')
 parser.add_argument('-n', '--OUT_NAME', help = 'Prefix to add to output file name. Otherwise names files with default prefix "Result"')
 
 
 if(len(sys.argv) <= 1):
     print(program_function)
     parser.print_help()
     sys.exit()
 
 args = parser.parse_args()
 
 #Checking Required Arguments:
 if(not CF.okFile(args.IEDB_CSV)):
     raise CF.InputError(args.IEDB_CSV,  "Invalid input file: ")
 if(not CF.okFile(args.IEDB_PRED)):
     raise CF.InputError(args.IEDB_PRED,  "Invalid input file: ")
 if(not CF.okFile(args.HLA_LIST)):
     raise CF.InputError(args.HLA_LIST,  "Invalid input file: ")    
 
 #Checking Optional Arguments:
 if(args.R_LIST):
     if(not CF.okFile(args.R_LIST)):
         raise CF.InputError(args.R_LIST, "Invalid input file: ")
 if(args.H_VALUE):
     HomologyFloat = args.H_VALUE
 if(args.OUT_DIR):
     if(os.path.isdir(args.OUT_DIR)):
         WriteDIR = args.OUT_DIR + '/'
     else:
        type=float)
    parser.add_argument(
        '-upper',
        '--ranking_threshold_upper',
        help=
        'Cut off of epitopes at a defined percentile ranking (Range 0-100). Default = 0.0',
        type=float)

    if (len(sys.argv) <= 1):
        print(program_function)
        parser.print_help()
        sys.exit()
    args = parser.parse_args()

    #Checking Required Arguments
    if (not CF.okFile(args.IEDB_prediction)):
        raise CF.InputError(args.IEDB_prediction, "Invalid input file: ")
    OutputPath = args.output_name

    #Checking Optional Arguments
    if (args.ranking_threshold_lower):
        RankingCutOffLower = args.ranking_threshold_lower
    if (args.ranking_threshold_upper):
        RankingCutOffUpper = args.ranking_threshold_upper

    (patternHash, HLA_Set) = parse_iedb_rec(args.IEDB_prediction,
                                            RankingCutOffLower,
                                            RankingCutOffUpper)
    outputHash(patternHash)
    outputHLA(HLA_Set)