Extract all column names in the inFile that match the provided iColPattern. Also allows specifying regular expressions to define specific columns to retain or exclude. All column names in the file can be listed using the getColumnNames function.

getIntensityColumns(
  inFile,
  iColPattern,
  includeOnlySamples = "",
  excludeSamples = "",
  stopIfEmpty = FALSE
)

Arguments

inFile

Path to a tab-delimited input text file (e.g. MaxQuant peptideGroups.txt or ProteomeDiscoverer Proteins.txt).

iColPattern

Character scalar defining a regular expression to identify intensity columns.

includeOnlySamples, excludeSamples

Character vectors defining regular expressions to match against the extracted columns to retain or exclude samples.

stopIfEmpty

Logical scalar, whether to raise an error if no columns matching the patterns are found.

Value

A list with two character vectors: iColsAll, which contains all column names matching the iColPattern, and iCols, which contains the remaining column names after applying the selection imposed by includeOnlySamples or excludeSamples.

Author

Charlotte Soneson

Examples

icols <- getIntensityColumns(system.file("extdata", "mq_example",
                                         "1356_proteinGroups.txt",
                                         package = "einprot"),
                             iColPattern = "^LFQ\\.intensity\\.",
                             excludeSamples = "Adnp")
icols
#> $iColsAll
#> [1] "LFQ.intensity.Adnp_IP04"     "LFQ.intensity.Adnp_IP05"    
#> [3] "LFQ.intensity.Adnp_IP06"     "LFQ.intensity.Chd4BF_IP07"  
#> [5] "LFQ.intensity.Chd4BF_IP08"   "LFQ.intensity.Chd4BF_IP09"  
#> [7] "LFQ.intensity.RBC_ctrl_IP01" "LFQ.intensity.RBC_ctrl_IP02"
#> [9] "LFQ.intensity.RBC_ctrl_IP03"
#> 
#> $iCols
#> [1] "LFQ.intensity.Chd4BF_IP07"   "LFQ.intensity.Chd4BF_IP08"  
#> [3] "LFQ.intensity.Chd4BF_IP09"   "LFQ.intensity.RBC_ctrl_IP01"
#> [5] "LFQ.intensity.RBC_ctrl_IP02" "LFQ.intensity.RBC_ctrl_IP03"
#>