R/swathData_checkSwathStatus.R

Defines functions checkSwathStatus

checkSwathStatus <- function(swathFileNames, txtSuff = ".txt", grnSuff = "_Grn.locs") {
    
    ## check wether we have created a text file for each swath
    ## gets passed a list of files with "Swath" in them.
    ## Sorts out any green channel images and tries to match them with text files

    greenLocs <- swathFileNames[grep(grnSuff, swathFileNames)]
    txtFiles <- swathFileNames[grep(txtSuff, swathFileNames)]

    ## if there aren't any text files just return false
    if(length(txtFiles) == 0) {
        return(FALSE)
    }
    else {
        ## strip the suffixes, leaving only the array address id's and swaths
        greenLocs <- unlist(strsplit(greenLocs, grnSuff));
        txtFiles <- unlist(strsplit(txtFiles, txtSuff));
        
        ## if they match perfectly, return TRUE
        if(length(match(txtFiles, greenLocs)) == length(greenLocs)) {
            return(TRUE);
        }
        else {
            return(FALSE);
        }
    }
}

Try the beadarray package in your browser

Any scripts or data that you put into this service are public.

beadarray documentation built on Nov. 8, 2020, 4:51 p.m.