Fix logic
Merge pull request #696 from dbetebenner/master

Merging Adams changes
Fix logic - keep tmp_data if it already exists
Rewrite testSGP(4) to fit current use cases and run quickly
Merge pull request #697 from adamvi/master

Fix sgp.sqlite logic in analyzeSGP and update testSGP(4) to current use cases
Adding GRADE NULL to testSGP to prevent warning