CJam, 2121 19 bytes
'[,_qeuqeu:A|&65>A;'[,65>{A\-,}$
Example
$ cjam etaoin.cjam <<< "~XyxY YyxZ"
YXZABCDEFGHIJKLMNOPQRSTUVW
(no newline)
How it works
qeu:A; " Read from STDIN, convert to uppercase, save in the variable “A” and discard, ";
'[, " Push an array of all ASCII characters before “[” (NUL to “Z”). ";
65> " Remove the first 64 characters (NUL to “@”). ";
{ " Sort the array of characters by the following mapping: ";
A\ " Swap the character with the string saved in variable “A”. ";
- " Remove all occurrences of the character from the string. ";
, " Push the length of the string. ";
}$ " ";
More occurrences means more characters get removed, so the most frequent characters appear at the beginning of the array.