background top icon
background center wave icon
background filled rhombus icon
background two lines icon
background stroke rhombus icon

Download "(4) Flow Cytometry Data Analysis in R: Visualisation"

input logo icon
Video tags
|

Video tags

Flow cytometry
Rstats
flowCore
ggcyto
Subtitles
|

Subtitles

subtitles menu arrow
  • ruRussian
Download
00:00:01
hello and welcome to the short
00:00:03
introduction how to analyze your flow
00:00:05
cytometry data in r
00:00:07
this episode is about gg cyto gt cyto is
00:00:10
used to visualize your flow cytometry
00:00:12
data
00:00:13
so previously we've looked at using auto
00:00:16
plot
00:00:17
and some quick plotting tools but now
00:00:19
we'll have a look to see how we can have
00:00:21
some more control over the visual
00:00:22
visualization so i've loaded the same
00:00:25
data as we had previously
00:00:27
and we will have a quick look at it now
00:00:29
so i've
00:00:30
used the code from the other videos
00:00:35
and now we just have a quick look at it
00:00:37
to confirm what it is
00:00:40
so we can see it's a flow set of nine
00:00:42
experiments i've taken the first nine
00:00:43
files
00:00:46
from the f4 fcmzv
00:00:49
full repository um set which is um
00:00:52
i think it's flowcap3 i can use
00:00:56
fs apply and look at the file names
00:01:01
i can look at the column names i.e the
00:01:03
floor rules
00:01:04
i can see there's 12 of them
00:01:07
and i can look at the gating hierarchy
00:01:09
i've produced
00:01:11
just here so this is the same as we did
00:01:14
the other day
00:01:15
and we can look at the auto plot outputs
00:01:18
so this is just using the default
00:01:19
settings
00:01:21
and we'll show the foreign side scatter
00:01:24
the single gating and
00:01:26
the um was a 50 versus p texas red
00:01:32
so one of the issues with the auto plot
00:01:34
is that you don't have any control over
00:01:35
where the labels are
00:01:36
on the scaling necessarily um or
00:01:40
of the layout in general it just creates
00:01:42
a quick plot like you can see above my
00:01:44
head
00:01:45
so let's first of all fix this plot so
00:01:47
we want to fix the scaling
00:01:49
and we want to add gate names and we
00:01:52
probably want to adjust the positions of
00:01:53
the gates
00:01:55
so to do this we'll be using ggcyto now
00:01:58
before we start with ggcyto
00:02:00
i should point out that you need to look
00:02:02
up ggplot so ggcyto
00:02:04
is a visualization program that's based
00:02:07
on another visualization programming
00:02:08
called ggplot2 now
00:02:12
gg plot 2 is very useful very powerful
00:02:15
and you won't get a lot out of gg cyto
00:02:17
with the one for plus temperature
00:02:18
without understanding how gd plot
00:02:20
2 works the easiest way to do this
00:02:25
is to just google ggplot2
00:02:30
tutorials and you'll see
00:02:33
a lot of these tutorials
00:02:39
sadly i think my work there we go
00:02:42
so if we go to the tidyburst which is
00:02:44
its official web page i assume
00:02:48
it gives you some basic usage and
00:02:51
some learning points um the first one is
00:02:54
very good
00:02:56
it goes through this is the an online or
00:02:58
book
00:03:00
and you can use some default data loaded
00:03:02
into r and teach you how to do some
00:03:05
dot plots how to change the points how
00:03:08
to change the colors
00:03:10
again if you go back to google there's
00:03:12
lots of other ones including the
00:03:14
complete course and i would advise looking
00:03:17
through this if you want to do any data
00:03:18
visualization and all
00:03:20
you basically need to know how to use
00:03:22
ggplot2
00:03:25
okay so let's pretend you've looked at
00:03:27
ggplot2
00:03:30
and we're now going to look at gigi cyto
00:03:32
so we want to fix this plot that's above
00:03:35
my head
00:03:37
so the nomenclature the way you use
00:03:40
gigi cyto is the same as 3d plot
00:03:43
and so we're going to call our plots p
00:03:46
we're going to load
00:03:47
gg cyto we're going to load our gate
00:03:50
instead which is called auto gs so i'm
00:03:52
looking at line 16 here
00:03:54
aes stands for aesthetics and that is
00:03:57
what we want the plots we want to plot
00:03:58
the x axis as
00:04:00
x fit c area the y axis is xp texas red
00:04:03
area
00:04:04
and the subset is singlets
00:04:08
so press ctrl enter it loads you don't
00:04:11
see anything
00:04:12
if i were to type in p you will be able
00:04:15
to see what is produced which is just an
00:04:17
empty plot
00:04:18
because i've just produced an empty pot
00:04:19
i haven't asked it to put any data in
00:04:21
so into p i will be adding geometric hex
00:04:26
um points and the binning is 256 so
00:04:29
similar to what we do with the order
00:04:31
plot
00:04:33
and again if i go to p now i'll see i've
00:04:35
now got some data
00:04:38
very nice
00:04:42
i can add some getting so i'm using
00:04:44
geometric gate
00:04:46
gating set to get population paths four
00:04:49
to seven
00:04:50
so i know it's four to seven because of
00:04:52
what we did earlier
00:04:53
the last one the last video and
00:04:56
the geometric gate is the way of gg's
00:04:59
height of finding gates
00:05:01
so i've done that and now if i press p i
00:05:03
should hopefully see the gate appear
00:05:07
fantastic and i want to add some
00:05:10
statistics so i've got geometric
00:05:12
statistics
00:05:13
and i get the paths again and i choose
00:05:16
percentage
00:05:17
and the gate name and i do this
00:05:20
adjusting so let's let's remove this
00:05:21
adjusting for now
00:05:26
and look at p again
00:05:32
and now we've got the percentage gates
00:05:35
at those percentages on the gates which
00:05:36
is fantastic
00:05:38
it would be nice to move them slightly
00:05:40
so i could read that adjust
00:05:43
so we have the xy coordinates and we can
00:05:45
we can get a nudge them left and right
00:05:47
as as we need to so let's see what this
00:05:50
does now this is actually going to do an
00:05:51
overlay of an overlay
00:05:53
because i've reapplied it to the same
00:05:55
plot so i'm going to get
00:05:57
multiple hits which isn't perfect so i
00:05:59
can start again by just going up to the
00:06:00
top one
00:06:04
ctrl enter ctrl enter control enter
00:06:06
control enter
00:06:08
and we can look at p and the gate is
00:06:11
uh the gate labels in a slightly more
00:06:13
sensible place
00:06:15
i'm reasonably happy with that you can
00:06:16
spend forever adjusting these and you're
00:06:18
more than welcome to do so
00:06:21
so this plot doesn't look too bad
00:06:24
um but this the the scaling could be
00:06:28
worse
00:06:29
so to adjust the scaling use something
00:06:31
called my powers which is my parameters
00:06:33
so you can use gt cytoparameter set and
00:06:36
you can choose the limits of the x and y
00:06:38
so the limits are currently three and
00:06:40
five for the y and three and five
00:06:42
for the x
00:06:46
which which to be honest it looks pretty
00:06:48
good to me
00:06:49
so if i try that so i create the
00:06:51
variable called my powers
00:06:52
then i apply my powers to p
00:06:57
they can load p again and hopefully
00:06:59
we'll see a slightly different shape
00:07:01
there we go maybe a bit too much in the
00:07:03
right now
00:07:04
but as you saw with the auto plotting it
00:07:07
could be very wrong
00:07:08
so this is something to pay attention to
00:07:11
and the labels are terrible
00:07:12
because these are our safe um name name
00:07:16
types which have the dots and no spaces
00:07:18
no slashes
00:07:19
so i'm just going to relabel them so i'm
00:07:20
going to use the p plus labs
00:07:23
x is 84 y cd3
00:07:27
i'll load it again and then we got
00:07:30
a nice nice plot if you need any
00:07:33
assistance
00:07:34
or any help the same is true for
00:07:37
anything in
00:07:38
um r you require type a question mark
00:07:41
and type in type in gd plot or my sorry
00:07:44
gdcito
00:07:46
i've been saying gdpr too much
00:07:50
and you'll get the help file on the
00:07:52
right i'm talking about how gt
00:07:54
cyto works so example
00:07:58
mr code and of course again you can go
00:08:01
to the internet
00:08:03
and type in gg title
00:08:06
and you'll be directed to the the
00:08:08
bioconductor page
00:08:10
so the github and you'll find lots of
00:08:13
lots of help
00:08:14
um it's actually been moved to something
00:08:16
called the cytoverse
00:08:19
which has been set up to um to keep
00:08:22
consistency between a lot though the
00:08:24
more popular flower citation packages
00:08:27
and so if you come here you can go to
00:08:28
examples
00:08:31
ggcyto and you've got lots of help files
00:08:40
and you can scroll down and look at
00:08:42
different ways of interacting with gg
00:08:43
cyto
00:08:45
but we'll carry on ourselves
00:08:48
so we had we had a single plot here
00:08:52
if we wanted to do similar to auto plot
00:08:54
and have all the plots
00:08:55
we can just remove the subset so we were
00:08:58
looking at just one file
00:09:00
we can do the same but with the entire
00:09:03
flow set or gating set in this case
00:09:09
and we should get a nice multi-plot
00:09:14
image with all of the types so you see
00:09:17
it's a bit of a mess now so we'd need to
00:09:20
change something so we can change the
00:09:21
font size and the positioning
00:09:23
or we could always just make the plot
00:09:26
bigger in general and would look a bit
00:09:27
better
00:09:32
but there's a lot of power and a lot of
00:09:33
flexibility and and
00:09:35
what you have to do is look through the
00:09:36
help files and find out
00:09:38
all the different things you can do such
00:09:40
as changing the colors changing the
00:09:41
densities
00:09:42
um changing the axis changing the titles
00:09:47
and one of the things you can do is
00:09:49
something called facetime so
00:09:50
faceting is a way of sub categorizing
00:09:54
your plots
00:09:55
or your data in general and this um
00:09:58
takes about something called the phenol
00:09:59
data so the phenotype is a
00:10:01
is some as a extra bit of data in
00:10:04
flow core on the floor set so if i type
00:10:07
in p data and auto gs auto gsb in my
00:10:10
gating set i can see my pheno data is
00:10:13
actually empty all it has
00:10:14
in the bottom left here are the file
00:10:16
names
00:10:18
however in the download from flow
00:10:21
repository there's also a csv
00:10:23
file that csv file contains lots of
00:10:25
useful information such as
00:10:27
patient and treatment so what i'm going
00:10:29
to do is load that csv file so i've got
00:10:32
csv file read csv and this is the csv
00:10:35
file
00:10:36
from flow repository
00:10:40
and if we i can look at the csv file
00:10:45
and we can see we've got file name um
00:10:48
treatment group and what what they're
00:10:50
looking for and they said this is from
00:10:51
floccaps3 as i said
00:10:53
and what we need to do is we need to
00:10:54
merge our phenotype
00:10:56
data in a flow set with a csv file
00:11:01
so to do this we use the merge command
00:11:03
the merge command is just
00:11:05
a default r command and you can find
00:11:08
the instructions in the help file
00:11:14
merge two data frames so what we're
00:11:17
doing is we're going to merge
00:11:18
our final data from our gating set with
00:11:22
the csv file
00:11:23
we're going to merge them using the name
00:11:25
and the fcs file
00:11:27
name so the fss file name is from
00:11:31
the the flow set and the name is from
00:11:34
the
00:11:35
cs3 panel oh actually it's the other way
00:11:37
around
00:11:39
so now i'll create something called new
00:11:40
data and if i open that
00:11:44
it's now just my nine files now we have
00:11:47
the treatments associated with them the
00:11:48
sample description of the patient name i
00:11:50
assume
00:11:51
and the characteristic which is all part
00:11:52
of the training set
00:11:55
um there is one caveat is that for the
00:11:58
the female data you must
00:11:59
the role names must be the name of the
00:12:01
fcs file
00:12:03
so when you do the merge it don't really
00:12:05
removes yet this raw data
00:12:07
no name data so we'll have to apply it
00:12:09
again using this row names
00:12:11
command and then we tell
00:12:15
that our gate except for phenotype data
00:12:17
should be this new
00:12:19
um a data set we've made or um data
00:12:22
frame sorry
00:12:25
and there we go so we've now got
00:12:27
phenotyping data with the
00:12:29
file name the treatment the sample
00:12:31
description
00:12:32
and this is really useful because this
00:12:34
means we can start sub categorizing our
00:12:35
plots
00:12:36
so here i'm making plots called pt using
00:12:39
gdcyto
00:12:40
so i'm just going to do cd4 and cd8 and
00:12:42
the singlets
00:12:46
i will do a geometric hex exactly the
00:12:48
same as before
00:12:50
and i'm going to choose the my
00:12:51
parameters i know will work for this
00:12:54
but what i'm going to do now is
00:12:56
something called facet gridding
00:12:57
so i'm going to plot my plots
00:13:00
of sample treatment versus sample
00:13:02
description
00:13:05
and you'll see how useful this is in a
00:13:06
second
00:13:12
and so here we've got my nine plots my
00:13:15
cd4 versus cd3
00:13:17
but what i have here is the sample
00:13:20
description which is probably the
00:13:21
patient and the treatment or the
00:13:25
uh what what gene they're looking for i
00:13:27
don't know a huge amount about this data
00:13:28
as you can probably tell
00:13:30
but this can be very useful because you
00:13:32
can imagine having treatment versus
00:13:34
patient or responder versus
00:13:36
non-responder
00:13:37
or cell type versus versus gene
00:13:40
and this way you can very nicely
00:13:43
visualize your data
00:13:44
and of course you can then add gates to
00:13:45
this and the statistics and you'll find
00:13:48
this very useful but you just have to work
00:13:50
make sure that you've got some good
00:13:52
um annotated data to start with
00:13:56
a very quickly look at back gating so
00:13:59
this is how you put a pretty color on
00:14:01
top of another plot to show the
00:14:03
the gate so we'll call this p3 gg cider
00:14:06
again cd3 versus cd4
00:14:08
and the subset is root so with gigi cyto
00:14:10
with a gatling set you always have to
00:14:12
have
00:14:13
a gate and so this is the root so this
00:14:15
is the top gate this is the no gate
00:14:19
and geometric hex again because it looks
00:14:21
good but i'm going to do 128
00:14:23
pins for no particular reason limits
00:14:26
again i know this works
00:14:29
and i'm going to do something called now
00:14:31
949 geometric overlay
00:14:34
so i'm going to overlay my cd3 and cd4
00:14:36
plus
00:14:37
plus gate and so this is my gate from my
00:14:39
gating set
00:14:41
and i want to overlay with dots the size
00:14:43
of 0.01
00:14:45
and the alpha which is the opacity or
00:14:46
how transparent it is at 0.05
00:14:49
and the color orange if you're american
00:14:52
you're more than welcome to get rid of
00:14:53
the u
00:14:54
and you're probably going to want the
00:14:56
alpha this opacity to be quite
00:14:58
low and so you can see the density
00:15:00
underneath
00:15:02
this is going to take a little while on
00:15:04
my computer um
00:15:06
i'm not sure why so let's just fast
00:15:08
forward the video
00:15:11
alright you can see that what has
00:15:12
appeared above my head now is um
00:15:14
a nice little orange back gate onto the
00:15:17
the cd4 and uh cd
00:15:19
three positive population onto my
00:15:21
platform earlier
00:15:23
um and there's obviously a lot more
00:15:24
complexity of the gtg title than just
00:15:26
doing these
00:15:27
simple plots um and the power is you can
00:15:30
do this over thousands of iterations
00:15:32
and create very consistent plot types
00:15:36
um if you want to export them by the way
00:15:38
you can just use this command called
00:15:39
ggsave
00:15:41
so i'm going to save gg save plot one
00:15:44
and we use p2 which is the one we did
00:15:46
earlier which is the faceted nine plot
00:15:51
image and if i go to my files
00:15:55
i'll be able to load top one
00:15:58
and i can then see the one i saved
00:16:02
for help as ever you can use gtc
00:16:05
question mark
00:16:06
and you can realize you can change the
00:16:07
dpis the size the file types
00:16:10
um and of course you can always run this
00:16:12
into loops
00:16:14
and default loops onto functions and so
00:16:16
you can
00:16:17
do this over and over again i strongly
00:16:20
recommend doing a gg plot tutorial and then
00:16:24
looking at the help files for gigi
00:16:25
saturn
00:16:27
alright thank you i hope this has been
00:16:29
of help and
00:16:30
i look forward to seeing you again soon
00:16:33
goodbye

Description:

This video will cover creating plots using ggcyto and will briefly discuss metadata and pData. R Script: https://github.com/hally166/Cytometry-R-scripts/blob/master/ggcyto_tutorial.R Data used: https://flowrepository.org/id/FR-FCM-ZZZV ggcyto: https://www.bioconductor.org/packages/release/bioc/html/ggcyto.html ggplot2: https://ggplot2.tidyverse.org/ Cytoverse: https://cytoverse.org/ https://www.babraham.ac.uk/science-facilities/flow-cytometry

Preparing download options

popular icon
Popular
hd icon
HD video
audio icon
Only sound
total icon
All
* — If the video is playing in a new tab, go to it, then right-click on the video and select "Save video as..."
** — Link intended for online playback in specialized players

Questions about downloading video

mobile menu iconHow can I download "(4) Flow Cytometry Data Analysis in R: Visualisation" video?mobile menu icon

  • http://unidownloader.com/ website is the best way to download a video or a separate audio track if you want to do without installing programs and extensions.

  • The UDL Helper extension is a convenient button that is seamlessly integrated into YouTube, Instagram and OK.ru sites for fast content download.

  • UDL Client program (for Windows) is the most powerful solution that supports more than 900 websites, social networks and video hosting sites, as well as any video quality that is available in the source.

  • UDL Lite is a really convenient way to access a website from your mobile device. With its help, you can easily download videos directly to your smartphone.

mobile menu iconWhich format of "(4) Flow Cytometry Data Analysis in R: Visualisation" video should I choose?mobile menu icon

  • The best quality formats are FullHD (1080p), 2K (1440p), 4K (2160p) and 8K (4320p). The higher the resolution of your screen, the higher the video quality should be. However, there are other factors to consider: download speed, amount of free space, and device performance during playback.

mobile menu iconWhy does my computer freeze when loading a "(4) Flow Cytometry Data Analysis in R: Visualisation" video?mobile menu icon

  • The browser/computer should not freeze completely! If this happens, please report it with a link to the video. Sometimes videos cannot be downloaded directly in a suitable format, so we have added the ability to convert the file to the desired format. In some cases, this process may actively use computer resources.

mobile menu iconHow can I download "(4) Flow Cytometry Data Analysis in R: Visualisation" video to my phone?mobile menu icon

  • You can download a video to your smartphone using the website or the PWA application UDL Lite. It is also possible to send a download link via QR code using the UDL Helper extension.

mobile menu iconHow can I download an audio track (music) to MP3 "(4) Flow Cytometry Data Analysis in R: Visualisation"?mobile menu icon

  • The most convenient way is to use the UDL Client program, which supports converting video to MP3 format. In some cases, MP3 can also be downloaded through the UDL Helper extension.

mobile menu iconHow can I save a frame from a video "(4) Flow Cytometry Data Analysis in R: Visualisation"?mobile menu icon

  • This feature is available in the UDL Helper extension. Make sure that "Show the video snapshot button" is checked in the settings. A camera icon should appear in the lower right corner of the player to the left of the "Settings" icon. When you click on it, the current frame from the video will be saved to your computer in JPEG format.

mobile menu iconWhat's the price of all this stuff?mobile menu icon

  • It costs nothing. Our services are absolutely free for all users. There are no PRO subscriptions, no restrictions on the number or maximum length of downloaded videos.