{"action":"created","issue":{"url":"https://api.github.com/repos/CGATOxford/cgat/issues/290","repository_url":"https://api.github.com/repos/CGATOxford/cgat","labels_url":"https://api.github.com/repos/CGATOxford/cgat/issues/290/labels{/name}","comments_url":"https://api.github.com/repos/CGATOxford/cgat/issues/290/comments","events_url":"https://api.github.com/repos/CGATOxford/cgat/issues/290/events","html_url":"https://github.com/CGATOxford/cgat/issues/290","id":177803801,"number":290,"title":"Issues with deseq2ParseResults in Expression.py","user":{"login":"nickilott","id":5478648,"avatar_url":"https://avatars.githubusercontent.com/u/5478648?v=3","gravatar_id":"","url":"https://api.github.com/users/nickilott","html_url":"https://github.com/nickilott","followers_url":"https://api.github.com/users/nickilott/followers","following_url":"https://api.github.com/users/nickilott/following{/other_user}","gists_url":"https://api.github.com/users/nickilott/gists{/gist_id}","starred_url":"https://api.github.com/users/nickilott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickilott/subscriptions","organizations_url":"https://api.github.com/users/nickilott/orgs","repos_url":"https://api.github.com/users/nickilott/repos","events_url":"https://api.github.com/users/nickilott/events{/privacy}","received_events_url":"https://api.github.com/users/nickilott/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-19T14:41:54Z","updated_at":"2016-09-21T08:28:57Z","closed_at":null,"body":"deseq2ParseResults does not process results correctly when there are more than two groups in the design file i.e. this code is in the runDESeq2 function for combining multiple contrasts\r\n\r\n```python\r\nfor combination in contrasts:\r\n        variable, control, treatment = combination\r\n        ...\r\n        df_out = deseq2ParseResults(fdr, vsd=False)\r\n```\r\ndeseq2ParseResults only takes the first two conditions from the global \"groups\" variable and therefore when it comes to labelling treatment_name and control_name in the outputs it is always the same two from the design file reagardless of the values of control and treatment in the above statement.\r\n\r\nI would suggest that treatment_name and control_name are specified as arguments to deseq2ParseResults so that the correct labels and values are used in output\r\n\r\n```python\r\ndef deseq2ParseResults(treatment_name, control_name, fdr, vsd=False):\r\n```\r\nwith the following resulting changes to the code\r\n\r\n```python    \r\nR('''g = unique(groups[groups == \"%s\" | groups == \"%s\"])''' % (treatment_name, control_name))\r\nR('''g1 = which(groups == g[1])''')\r\nR('''g2 = which(groups == g[2])''')\r\nR('''res2['treatment_name'] = g[1]''')\r\nR('''res2['treatment_mean'] = rowMeans(normalcounts[, g1])''')\r\nR('''res2['treatment_std'] = apply(normalcounts[, g1], 1, sd)''')\r\nR('''res2['control_name'] =g[2]''')\r\nR('''res2['control_mean'] = rowMeans(normalcounts[,g2])''')\r\nR('''res2['control_std'] = apply(normalcounts[, g2], 1, sd)''')\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/CGATOxford/cgat/issues/comments/248545563","html_url":"https://github.com/CGATOxford/cgat/issues/290#issuecomment-248545563","issue_url":"https://api.github.com/repos/CGATOxford/cgat/issues/290","id":248545563,"user":{"login":"nickilott","id":5478648,"avatar_url":"https://avatars.githubusercontent.com/u/5478648?v=3","gravatar_id":"","url":"https://api.github.com/users/nickilott","html_url":"https://github.com/nickilott","followers_url":"https://api.github.com/users/nickilott/followers","following_url":"https://api.github.com/users/nickilott/following{/other_user}","gists_url":"https://api.github.com/users/nickilott/gists{/gist_id}","starred_url":"https://api.github.com/users/nickilott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickilott/subscriptions","organizations_url":"https://api.github.com/users/nickilott/orgs","repos_url":"https://api.github.com/users/nickilott/repos","events_url":"https://api.github.com/users/nickilott/events{/privacy}","received_events_url":"https://api.github.com/users/nickilott/received_events","type":"User","site_admin":false},"created_at":"2016-09-21T08:28:57Z","updated_at":"2016-09-21T08:28:57Z","body":"Yes will do this now. Thanks"}}
{"actor":{"display_login":"nickilott"}}