%% prt_SpecPerGenus % Print list of genera with number of AmP entries for a taxon SpecPerGenus.html %% function [nm, n_spec] = prt_SpecPerGenus(taxon) % created by Bas Kooijman 2023/01/18 %% Syntax % [nm, n_spec] = <../prt_SpecPerGenus.m *prt_SpecPerGenus*>(taxon) %% Description % Print list of genera with number of AmP entries for a taxon to SpecPerGenus.html in local directory and open it in browser. % Click on names to go to species_tree. % % Input: % % * taxon: optional string with name of taxon (default 'Animalia') % % Output % % * nm: n-cellstring with names of genera % * n_spec: n-vector number of entries per genus %% Remarks % If species_tree does not open correctly, click on picture to reload. % Visit % for the zip-files. %% Example of use % prt_SpecPerGenus('Amphibia'); path = [set_path2server, 'add_my_pet/']; if ~exist('taxon','var') taxon = 'Animalia'; end nm = list_taxa(taxon, 3); % genera version = datestr(datenum(date),'yyyy/mm/dd'); n_gen = length(nm); n_spec = zeros(n_gen,1); for i=1:n_gen n_spec(i) = length(select(nm{i})); % number of species end % prepare for writing SpecPerGenus.html fid_SpG = fopen('SpecPerGenus.html', 'w+'); % open file for writing, delete existing content % write header for SpecPerGenus.html : fprintf(fid_SpG, '\n'); fprintf(fid_SpG, '\n'); fprintf(fid_SpG, '\n'); fprintf(fid_SpG, ' SpecPerGenus\n'); fprintf(fid_SpG, ' \n', path); fprintf(fid_SpG, ' \n'); fprintf(fid_SpG, ' \n', path); fprintf(fid_SpG, '\n\n'); fprintf(fid_SpG, '\n\n'); fprintf(fid_SpG, '
\n'); fprintf(fid_SpG, '
\n'); fprintf(fid_SpG, '
\n\n'); fprintf(fid_SpG, '

'); fprintf(fid_SpG, ' Genera of %s with number of AmP entries %s\n', taxon, version); fprintf(fid_SpG, ' \n'); fprintf(fid_SpG, '

\n\n'); fprintf(fid_SpG, '
\n'); fprintf(fid_SpG, '
\n'); fprintf(fid_SpG, '
    \n'); for i = 1:n_gen % scan all genera fprintf(fid_SpG, '
  • %s %g
  • \n', n_spec(i), nm{i}, nm{i}, n_spec(i)); end fprintf(fid_SpG, '
\n'); fprintf(fid_SpG, '
\n'); fprintf(fid_SpG, '
\n\n'); fprintf(fid_SpG, ' \n\n'); fprintf(fid_SpG, '
\n\n'); fprintf(fid_SpG, '
\n'); fprintf(fid_SpG, '
\n'); fprintf(fid_SpG, '\n'); fprintf(fid_SpG, '\n'); fclose(fid_SpG); web('SpecPerGenus.html', '-browser') end