With grep:
grep -vwf file matrix > matrix.new
mv matrix.new matrix
- option
-f FILEuseFILEas pattern input file - option
-wselect only those lines containing matches that form whole words - option
-vselect non-matching lines
Note that file must not contain any empty lines.
Or if you create your identifier file manually with an anchor ^ to match the start of the line and a space character after each identifier to mark the end of the pattern:
printf '^%s \n' denovo{1,100,1000,100000} > file
grep -vf file matrix > matrix.new
mv matrix.new matrix