I am using sugarcrm 4.5
1. leads/layout_defs.php - which contains the subpanel info.we can show/hide subpanels from there
2. there are forHistory.phps with the related modules.

But in the query emails_leads.deleted field comes up in where condition. As emails_leads is not a module .There is a relationship file metadata/emails_leadsMetadata.php with the relation between emails and leads table.

But i didn't get where in the query emails_leads.deleted=0 is configured .which is the file for that?