morris-lab/CellTagR

Overlaying cell source (i.e. which bam) over graph networks

Closed this issue · 7 comments

First, thank you both for this tool & for all of your previous help to read in multiple bam files!

Now, I am trying to figure out how to color the resultant single force-directed graph network based on that cell or clones belonging to either sample-1 or sample-2. Any ideas?

Thank you again!
Rob

Hi Rob,

Have you looked at this section of the workflow? It is a section for adding additional information to the networks for visualization. You would just change the overlay argument of the drawSubnet function in the following step to the column name of the data you added.

If you run into errors trying this please let us know.

Best,
Brent

Hi Brent,

Thanks for getting back to me, & yep I've tried the following, but the coloring still seems random (i.e. not just two colors...)

head(rownames(bam.int.obj@celltag.aggr.final))

# Simulate some additional data
additional_data <- data.frame(substr(rownames(bam.int.obj@celltag.aggr.final), 8, 8), row.names = rownames(bam.int.obj@celltag.aggr.final))

head(additional_data)

colnames(additional_data) <- "Sample"

head(additional_data)

Additional_data now looks like this...

                            Sample
Sample-1_AAATGGAGTTAGAAGT-1      1
Sample-1_AACCACATCCTGCTAC-1      1
Sample-1_AACCATGGTGTTCCAA-1      1
Sample-1_AACGAAAAGGCTTAAA-1      1
Sample-1_AAGATAGAGGAACGCT-1      1
Sample-1_AAGATAGCAAGTCCCG-1      1
# Add the data to the object
bam.int.obj <- addData2Nodes(bam.int.obj, additional_data)

# Network visualization

bam.int.obj <- drawSubnet(tag = "CellTagV1_1", overlay = "Sample", celltag.obj = bam.int.obj)

bam.int.obj@network

Thanks again!
Rob

Hi Rob,

Would you mind providing us with a small part of your bam.int.obj@nodes data frame before and after you add the additional data? It might be some issue in the adding or the column names in the code where we merge the info. Just want to check if that could be the issue.

Thanks!
Wenjun

Hi Wenjun,

No problem!

Before:

                                                        nodes       tag        node_name_unmodified
Sample-1_AAATGGAGTTAGAAGT-1_V3 Sample-1_AAATGGAGTTAGAAGT-1_V3 CellTagV3 Sample-1_AAATGGAGTTAGAAGT-1
Sample-1_AACCACATCCTGCTAC-1_V3 Sample-1_AACCACATCCTGCTAC-1_V3 CellTagV3 Sample-1_AACCACATCCTGCTAC-1
Sample-1_AACCATGGTGTTCCAA-1_V3 Sample-1_AACCATGGTGTTCCAA-1_V3 CellTagV3 Sample-1_AACCATGGTGTTCCAA-1
Sample-1_AACGAAAAGGCTTAAA-1_V3 Sample-1_AACGAAAAGGCTTAAA-1_V3 CellTagV3 Sample-1_AACGAAAAGGCTTAAA-1
Sample-1_AAGATAGAGGAACGCT-1_V3 Sample-1_AAGATAGAGGAACGCT-1_V3 CellTagV3 Sample-1_AAGATAGAGGAACGCT-1
Sample-1_AAGATAGCAAGTCCCG-1_V3 Sample-1_AAGATAGCAAGTCCCG-1_V3 CellTagV3 Sample-1_AAGATAGCAAGTCCCG-1

& After:

                                                        nodes       tag                      Sample Sample
Sample-1_AAATGGAGTTAGAAGT-1_V3 Sample-1_AAATGGAGTTAGAAGT-1_V3 CellTagV3 Sample-1_AAATGGAGTTAGAAGT-1      1
Sample-1_AACCACATCCTGCTAC-1_V3 Sample-1_AACCACATCCTGCTAC-1_V3 CellTagV3 Sample-1_AACCACATCCTGCTAC-1      1
Sample-1_AACCATGGTGTTCCAA-1_V3 Sample-1_AACCATGGTGTTCCAA-1_V3 CellTagV3 Sample-1_AACCATGGTGTTCCAA-1      1
Sample-1_AACGAAAAGGCTTAAA-1_V3 Sample-1_AACGAAAAGGCTTAAA-1_V3 CellTagV3 Sample-1_AACGAAAAGGCTTAAA-1      1
Sample-1_AAGATAGAGGAACGCT-1_V3 Sample-1_AAGATAGAGGAACGCT-1_V3 CellTagV3 Sample-1_AAGATAGAGGAACGCT-1      1
Sample-1_AAGATAGCAAGTCCCG-1_V3 Sample-1_AAGATAGCAAGTCCCG-1_V3 CellTagV3 Sample-1_AAGATAGCAAGTCCCG-1      1

Does seem like it's switching "node_name_unmodified" column to "sample" as well?

Thanks!
Rob

Hi Rob,

Just modified where the column names could be messed up. Please try it again now and let us know if there are any additional issues.

Best,
Wenjun

Hi Wenjun,

Thank you again - it is working great now!

All the best,
Rob

Glad it worked! - Wenjun