head -2 raw_profile/all_merge_metaphlan.tsv | tail -1 | awk '{$2=null; print $0}' > filter_profile/phylum.tsv
cat raw_profile/all_merge_metaphlan.tsv | grep -Ev "UNKNOWN|k__Archaea" | grep "p__" | grep -v "c__" | grep -v "unclassified" | grep -v "noname" | sed 's/.*|p__//g' | awk '{$2=null; print $0}' >> filter_profile/phylum.tsv
Notes:
-
get the sample names which were the 2nd rows;
-
use
awk '{$2=null; print $0}'
to delete the 2nd columns; -
remove the "UNKNOWN, Archeaea, unclassified, noname" taxonomy via grep (unclassifed and noname were appeared in metaphlan2 version);
-
key words
p__
match the phylum taxonomic level which we wanna obtain, and thec__
is used to remove other taxonomic levels; -
rename the tax name via
sed 's/.*|p__//g'
网友评论