{"action":"created","issue":{"url":"https://api.github.com/repos/RGLab/openCyto/issues/186","repository_url":"https://api.github.com/repos/RGLab/openCyto","labels_url":"https://api.github.com/repos/RGLab/openCyto/issues/186/labels{/name}","comments_url":"https://api.github.com/repos/RGLab/openCyto/issues/186/comments","events_url":"https://api.github.com/repos/RGLab/openCyto/issues/186/events","html_url":"https://github.com/RGLab/openCyto/issues/186","id":370294025,"node_id":"MDU6SXNzdWUzNzAyOTQwMjU=","number":186,"title":"FSC and SSC scale changed after export fcs file","user":{"login":"mimisikai","id":4881411,"node_id":"MDQ6VXNlcjQ4ODE0MTE=","avatar_url":"https://avatars1.githubusercontent.com/u/4881411?v=4","gravatar_id":"","url":"https://api.github.com/users/mimisikai","html_url":"https://github.com/mimisikai","followers_url":"https://api.github.com/users/mimisikai/followers","following_url":"https://api.github.com/users/mimisikai/following{/other_user}","gists_url":"https://api.github.com/users/mimisikai/gists{/gist_id}","starred_url":"https://api.github.com/users/mimisikai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mimisikai/subscriptions","organizations_url":"https://api.github.com/users/mimisikai/orgs","repos_url":"https://api.github.com/users/mimisikai/repos","events_url":"https://api.github.com/users/mimisikai/events{/privacy}","received_events_url":"https://api.github.com/users/mimisikai/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":17,"created_at":"2018-10-15T18:43:19Z","updated_at":"2018-10-17T18:34:53Z","closed_at":null,"author_association":"NONE","body":"The purpose of this code is aiming to consistent the fcs channels in bunch of files. But after exporting the new fcs file, the FSC and SSC scale totally changed. Files send out to your email separately due to confidentiality. \r\n\r\nlibrary(openCyto)\r\nlibrary(ggcyto)\r\nlibrary(data.table)\r\n\r\n#---------------------------------------------------------------------------------------------------------------------------------------------------#\r\n# Raw data clean up\r\n# The raw fcs files are pretty messy, unmatched channels(fluorochrome/dye), unmatched compensations, unstandardized sample name et al\r\n# In this step, we create channel matching map to consolidate unmatched dye to unique channel; remove some unused compensations; and rename the file\r\n#---------------------------------------------------------------------------------------------------------------------------------------------------#\r\n# making a channel map to match all mismatched dys\r\nmap = data.frame(alias = c(\"FITC-A\",\"PerCP-Cy5-5-A\",\"V450-A\",\"V500-A\",\"BV605-A\",\"BV650-A\",\"Alexa Fluor 647-A\",\"Alexa Fluor 700-A\",\"APC-Cy7-A\",\"PE-A\",\"PE-Cy7-A\"),\r\n                 channels = c(\"FITC-A, Alexa Fluor 488-A\",\r\n                              \"PerCP-Cy5-5-A, PerCP-A, ef710-A\",\r\n                              \"BV421-A, V450-A, ef450-A, Pacific Blue-A\",\r\n                              \"V500-A, AmCyan-A, BV510-A\",\r\n                              \"BV605-A, Qdot 605-A\",\r\n                              \"BV650-A, Qdot 655-A\",\r\n                              \"Alexa Fluor 647-A, APC-A\",\r\n                              \"Alexa Fluor 700-A\",\r\n                              \"APC-Cy7-A, APC-H7-A\",\r\n                              \"PE-A\",\r\n                              \"PE-Cy7-A\"))\r\n\r\n# read ALL samples to clean up the data\r\n# Load the raw data\r\nmainPath = \"H:/CAT Project 1-McMaster/3 Tmr Rename/Before rename/batch1\"\r\nFCS_rawfile_Tmr_ALL = read.ncdfFlowSet(list.files(mainPath, recursive = TRUE,full.names = TRUE), channel_alias = map)\r\n\r\n# remove some compensation columes contain unmatched channels\r\nfor (i in 1:length(FCS_rawfile_Tmr_ALL))\r\n{\r\n  comp_col = colnames(FCS_rawfile_Tmr_ALL[[i]]@description$SPILL)\r\n  idx = setdiff(comp_col, as.character(map$alias))\r\n  \r\n  if (length(idx) > 0){\r\n    print(FCS_rawfile_Tmr_ALL[[i]]@description$`TUBE NAME`)\r\n    re = match(idx,comp_col)\r\n    FCS_rawfile_Tmr_ALL[[i]]@description$SPILL = FCS_rawfile_Tmr_ALL[[i]]@description$SPILL[-re,-re]}\r\n}\r\n\r\n# exprot all sample names\r\n# OriSampleName = sampleNames(FCS_rawfile_Tmr_ALL)\r\n# write.csv(OriSampleName, file = \"C:/Users/jhou/Desktop/testing/OriSampleNameTmr.csv\")\r\n\r\n# Assign the new name to replace the old name, that's done in the excel manually\r\n\r\n# read in the name match\r\nSampleNameListTmr = read.csv(\"C:/Users/jhou/Desktop/testing/SampleNameListTmr.csv\", stringsAsFactors = FALSE)\r\n\r\n# rename the FILENAME in the keyword and rename the fcs files and rewrite the fcs into disk for further \r\nfor (i in SampleNameListTmr$Old){\r\n  newN = subset(SampleNameListTmr, SampleNameListTmr$Old == i)[['New']]\r\n  FCS_rawfile_Tmr_ALL[[i]]@description$FILENAME = newN\r\n  FCS_rawfile_Tmr_ALL[[i]]@description$`$FIL` = newN\r\n  FCS_rawfile_Tmr_ALL[[i]]@description$`TUBE NAME` = newN\r\n  write.FCS(FCS_rawfile_Tmr_ALL[[i]], paste(\"C:/Users/jhou/Desktop/testing/\",newN,sep = \"\"))\r\n}\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/RGLab/openCyto/issues/comments/430740307","html_url":"https://github.com/RGLab/openCyto/issues/186#issuecomment-430740307","issue_url":"https://api.github.com/repos/RGLab/openCyto/issues/186","id":430740307,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMDc0MDMwNw==","user":{"login":"mikejiang","id":1385649,"node_id":"MDQ6VXNlcjEzODU2NDk=","avatar_url":"https://avatars1.githubusercontent.com/u/1385649?v=4","gravatar_id":"","url":"https://api.github.com/users/mikejiang","html_url":"https://github.com/mikejiang","followers_url":"https://api.github.com/users/mikejiang/followers","following_url":"https://api.github.com/users/mikejiang/following{/other_user}","gists_url":"https://api.github.com/users/mikejiang/gists{/gist_id}","starred_url":"https://api.github.com/users/mikejiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikejiang/subscriptions","organizations_url":"https://api.github.com/users/mikejiang/orgs","repos_url":"https://api.github.com/users/mikejiang/repos","events_url":"https://api.github.com/users/mikejiang/events{/privacy}","received_events_url":"https://api.github.com/users/mikejiang/received_events","type":"User","site_admin":false},"created_at":"2018-10-17T18:34:53Z","updated_at":"2018-10-17T18:34:53Z","author_association":"MEMBER","body":"please modify your post to ensure the pics are visible."}}
{"actor":{"display_login":"mikejiang"}}