Extract or subset hundreds of columns from a data frame
Hopefully I've understood your question correctly. 

Assuming your text file looks like this?

GeneName1
GeneName2


You can read that in using the readLines() function:

cols &lt;- readLines("name_of_text_file")


Which returns cols as a vector of those names:

&gt; cols
[1] "GeneName1" "GeneName2"


Which can then be used to subset the data frame as per your example:

mydata[ , cols]