├── .gitignore ├── DeAnonymizer ├── README.md ├── bin │ ├── GenoTable.class │ ├── Main.class │ ├── SNPCompare.class │ └── Scores.class ├── commons-cli-1.3.1 │ ├── CONTRIBUTING.md │ ├── LICENSE.txt │ ├── NOTICE.txt │ ├── README.md │ ├── RELEASE-NOTES.txt │ ├── apidocs │ │ ├── allclasses-frame.html │ │ ├── allclasses-noframe.html │ │ ├── constant-values.html │ │ ├── deprecated-list.html │ │ ├── help-doc.html │ │ ├── index-all.html │ │ ├── index.html │ │ ├── org │ │ │ └── apache │ │ │ │ └── commons │ │ │ │ └── cli │ │ │ │ ├── AlreadySelectedException.html │ │ │ │ ├── AmbiguousOptionException.html │ │ │ │ ├── BasicParser.html │ │ │ │ ├── CommandLine.html │ │ │ │ ├── CommandLineParser.html │ │ │ │ ├── DefaultParser.html │ │ │ │ ├── GnuParser.html │ │ │ │ ├── HelpFormatter.html │ │ │ │ ├── MissingArgumentException.html │ │ │ │ ├── MissingOptionException.html │ │ │ │ ├── Option.Builder.html │ │ │ │ ├── Option.html │ │ │ │ ├── OptionBuilder.html │ │ │ │ ├── OptionGroup.html │ │ │ │ ├── Options.html │ │ │ │ ├── ParseException.html │ │ │ │ ├── Parser.html │ │ │ │ ├── PatternOptionBuilder.html │ │ │ │ ├── PosixParser.html │ │ │ │ ├── TypeHandler.html │ │ │ │ ├── UnrecognizedOptionException.html │ │ │ │ ├── class-use │ │ │ │ ├── AlreadySelectedException.html │ │ │ │ ├── AmbiguousOptionException.html │ │ │ │ ├── BasicParser.html │ │ │ │ ├── CommandLine.html │ │ │ │ ├── CommandLineParser.html │ │ │ │ ├── DefaultParser.html │ │ │ │ ├── GnuParser.html │ │ │ │ ├── HelpFormatter.html │ │ │ │ ├── MissingArgumentException.html │ │ │ │ ├── MissingOptionException.html │ │ │ │ ├── Option.Builder.html │ │ │ │ ├── Option.html │ │ │ │ ├── OptionBuilder.html │ │ │ │ ├── OptionGroup.html │ │ │ │ ├── Options.html │ │ │ │ ├── ParseException.html │ │ │ │ ├── Parser.html │ │ │ │ ├── PatternOptionBuilder.html │ │ │ │ ├── PosixParser.html │ │ │ │ ├── TypeHandler.html │ │ │ │ └── UnrecognizedOptionException.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ ├── package-tree.html │ │ │ │ └── package-use.html │ │ ├── overview-tree.html │ │ ├── package-list │ │ ├── script.js │ │ ├── serialized-form.html │ │ └── stylesheet.css │ ├── commons-cli-1.3.1-javadoc.jar │ └── commons-cli-1.3.1.jar └── src │ ├── GenoTable.java │ ├── Main.java │ ├── SNPCompare.java │ └── Scores.java ├── LICENSE ├── Magic └── run_magic_cd4_per_sample.py ├── R-scripts ├── co-expression_QTL.R ├── concordance_eqtls.R ├── eQTL_cohort_replication.R ├── eQTL_cohort_replication_make_tables.R ├── eqtl_box_plots.R ├── eqtl_table.R ├── interactionOtherCellTypes.R ├── interaction_plots.R ├── magic_plots.R ├── make_co-expression_QTL_tables.R ├── make_top_interaction_permutation_table.R ├── readme.md └── seurat_clustering.R ├── README.md └── website ├── data_access_agreement.docx ├── figure-1.html ├── figure-2.html ├── img ├── erc.png ├── figure_1.png ├── figure_1_tumb.png ├── figure_2.png ├── figure_2_tumb.png ├── github.png ├── lifelines.svg ├── nwo.jpg ├── umcg.jpg └── umcg.png └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | # History files 2 | .Rhistory 3 | .Rapp.history 4 | 5 | # Session Data files 6 | .RData 7 | 8 | # Example code in package build process 9 | *-Ex.R 10 | 11 | # Output files from R CMD build 12 | /*.tar.gz 13 | 14 | # Output files from R CMD check 15 | /*.Rcheck/ 16 | 17 | # RStudio files 18 | .Rproj.user/ 19 | 20 | # produced vignettes 21 | vignettes/*.html 22 | vignettes/*.pdf 23 | 24 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 25 | .httr-oauth 26 | 27 | # knitr and R markdown default cache directories 28 | /*_cache/ 29 | /cache/ 30 | 31 | # Temporary files created by R markdown 32 | *.utf8.md 33 | *.knit.md 34 | -------------------------------------------------------------------------------- /DeAnonymizer/README.md: -------------------------------------------------------------------------------- 1 | # DeAnonymizer 2 | 3 | This tool uses the method as described in “Multiplexing droplet-based single cell RNA-sequencing using natural genetic barcodes” by Kang HM et al., Nat. Biotech. (2017) (). 4 | 5 | It takes as input a file with the following (tab separated) info fields: 6 | 7 | CHROM POS ALT REF cell_id A C G T 8 | 9 | Where CHROM and POS denote the chromosome and position of the SNP, respectively, and ALT and REF denote, respectively, the alternative and reference allele of the SNP. Cell_id consists of the cell barcode as present in the bam-file, and A, C, G and T denote how many unique UMIs are observed in the reads of the corresponding cell at the corresponding SNP having the corresponding base. 10 | In contrast to the tool presented in the aforementioned paper, this implementation assumes a fixed error in the base calling, which can be set using the -e flag. 11 | 12 | 13 | All flags are explained when running the program without arguments. 14 | -------------------------------------------------------------------------------- /DeAnonymizer/bin/GenoTable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/DeAnonymizer/bin/GenoTable.class -------------------------------------------------------------------------------- /DeAnonymizer/bin/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/DeAnonymizer/bin/Main.class -------------------------------------------------------------------------------- /DeAnonymizer/bin/SNPCompare.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/DeAnonymizer/bin/SNPCompare.class -------------------------------------------------------------------------------- /DeAnonymizer/bin/Scores.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/DeAnonymizer/bin/Scores.class -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 17 | 41 | Contributing to Apache Commons CLI 42 | ====================== 43 | 44 | You have found a bug or you have an idea for a cool new feature? Contributing code is a great way to give something back to 45 | the open source community. Before you dig right into the code there are a few guidelines that we need contributors to 46 | follow so that we can have a chance of keeping on top of things. 47 | 48 | Getting Started 49 | --------------- 50 | 51 | + Make sure you have a [JIRA account](https://issues.apache.org/jira/). 52 | + Make sure you have a [GitHub account](https://github.com/signup/free). 53 | + If you're planning to implement a new feature it makes sense to discuss you're changes on the [dev list](https://commons.apache.org/mail-lists.html) first. This way you can make sure you're not wasting your time on something that isn't considered to be in Apache Commons CLI's scope. 54 | + Submit a ticket for your issue, assuming one does not already exist. 55 | + Clearly describe the issue including steps to reproduce when it is a bug. 56 | + Make sure you fill in the earliest version that you know has the issue. 57 | + Fork the repository on GitHub. 58 | 59 | Making Changes 60 | -------------- 61 | 62 | + Create a topic branch from where you want to base your work (this is usually the master/trunk branch). 63 | + Make commits of logical units. 64 | + Respect the original code style: 65 | + Only use spaces for indentation. 66 | + Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change. 67 | + Check for unnecessary whitespace with git diff --check before committing. 68 | + Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue. 69 | + Make sure you have added the necessary tests for your changes. 70 | + Run all the tests with `mvn clean verify` to assure nothing else was accidentally broken. 71 | 72 | Making Trivial Changes 73 | ---------------------- 74 | 75 | For changes of a trivial nature to comments and documentation, it is not always necessary to create a new ticket in JIRA. 76 | In this case, it is appropriate to start the first line of a commit with '(doc)' instead of a ticket number. 77 | 78 | Submitting Changes 79 | ------------------ 80 | 81 | + Sign the [Contributor License Agreement][cla] if you haven't already. 82 | + Push your changes to a topic branch in your fork of the repository. 83 | + Submit a pull request to the repository in the apache organization. 84 | + Update your JIRA ticket and include a link to the pull request in the ticket. 85 | 86 | Additional Resources 87 | -------------------- 88 | 89 | + [Contributing patches](https://commons.apache.org/patches.html) 90 | + [Apache Commons CLI JIRA project page](https://issues.apache.org/jira/browse/CLI) 91 | + [Contributor License Agreement][cla] 92 | + [General GitHub documentation](https://help.github.com/) 93 | + [GitHub pull request documentation](https://help.github.com/send-pull-requests/) 94 | + [Apache Commons Twitter Account](https://twitter.com/ApacheCommons) 95 | + #apachecommons IRC channel on freenode.org 96 | 97 | [cla]:https://www.apache.org/licenses/#clas 98 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache Commons CLI 2 | Copyright 2001-2015 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/README.md: -------------------------------------------------------------------------------- 1 | 17 | 43 | Apache Commons CLI 44 | =================== 45 | 46 | Apache Commons CLI provides a simple API for presenting, processing and validating a command line interface. 47 | 48 | Documentation 49 | ------------- 50 | 51 | More information can be found on the [homepage](https://commons.apache.org/proper/commons-cli). 52 | The [JavaDoc](https://commons.apache.org/proper/commons-cli/javadocs/api-release) can be browsed. 53 | Questions related to the usage of Apache Commons CLI should be posted to the [user mailing list][ml]. 54 | 55 | Where can I get the latest release? 56 | ----------------------------------- 57 | You can download source and binaries from our [download page](https://commons.apache.org/proper/commons-cli/download_cli.cgi). 58 | 59 | Alternatively you can pull it from the central Maven repositories: 60 | 61 | ```xml 62 | 63 | commons-cli 64 | commons-cli 65 | 1.3 66 | 67 | ``` 68 | 69 | Contributing 70 | ------------ 71 | 72 | We accept PRs via github. The [developer mailing list][ml] is the main channel of communication for contributors. 73 | There are some guidelines which will make applying PRs easier for us: 74 | + No tabs! Please use spaces for indentation. 75 | + Respect the code style. 76 | + Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change. 77 | + Provide JUnit tests for your changes and make sure your changes don't break any existing tests by running ```mvn clean test```. 78 | 79 | If you plan to contribute on a regular basis, please consider filing a [contributor license agreement](https://www.apache.org/licenses/#clas). 80 | You can learn more about contributing via GitHub in our [contribution guidelines](CONTRIBUTING.md). 81 | 82 | License 83 | ------- 84 | Code is under the [Apache Licence v2](https://www.apache.org/licenses/LICENSE-2.0.txt). 85 | 86 | Donations 87 | --------- 88 | You like Apache Commons CLI? Then [donate back to the ASF](https://www.apache.org/foundation/contributing.html) to support the development. 89 | 90 | Additional Resources 91 | -------------------- 92 | 93 | + [Apache Commons Homepage](https://commons.apache.org/) 94 | + [Apache Bugtracker (JIRA)](https://issues.apache.org/jira/) 95 | + [Apache Commons Twitter Account](https://twitter.com/ApacheCommons) 96 | + #apachecommons IRC channel on freenode.org 97 | 98 | [ml]:https://commons.apache.org/mail-lists.html 99 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/RELEASE-NOTES.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/DeAnonymizer/commons-cli-1.3.1/RELEASE-NOTES.txt -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 37 |
38 | 39 | 40 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | All Classes (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 37 |
38 | 39 | 40 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/constant-values.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Constant Field Values (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Constant Field Values

73 |

Contents

74 | 77 |
78 |
79 | 80 | 81 |

org.apache.*

82 | 178 |
179 | 180 |
181 | 182 | 183 | 184 | 185 | 186 | 187 | 196 |
197 | 224 | 225 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

226 | 227 | 228 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/help-doc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | API Help (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

How This API Document Is Organized

73 |
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
74 |
75 |
76 | 175 | This help file applies to API documentation generated using the standard doclet.
176 | 177 |
178 | 179 | 180 | 181 | 182 | 183 | 184 | 193 |
194 | 221 | 222 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

223 | 224 | 225 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Apache Commons CLI 1.3.1 API 8 | 60 | 61 | 62 | 63 | 64 | 65 | <noscript> 66 | <div>JavaScript is disabled on your browser.</div> 67 | </noscript> 68 | <h2>Frame Alert</h2> 69 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="org/apache/commons/cli/package-summary.html">Non-frame version</a>.</p> 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/org/apache/commons/cli/class-use/AlreadySelectedException.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class org.apache.commons.cli.AlreadySelectedException (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Class
org.apache.commons.cli.AlreadySelectedException

73 |
74 |
75 | 101 |
102 | 103 |
104 | 105 | 106 | 107 | 108 | 109 | 110 | 119 |
120 | 147 | 148 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

149 | 150 | 151 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/org/apache/commons/cli/class-use/AmbiguousOptionException.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class org.apache.commons.cli.AmbiguousOptionException (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Class
org.apache.commons.cli.AmbiguousOptionException

73 |
74 |
No usage of org.apache.commons.cli.AmbiguousOptionException
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/org/apache/commons/cli/class-use/BasicParser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class org.apache.commons.cli.BasicParser (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Class
org.apache.commons.cli.BasicParser

73 |
74 |
No usage of org.apache.commons.cli.BasicParser
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/org/apache/commons/cli/class-use/CommandLineParser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Interface org.apache.commons.cli.CommandLineParser (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Interface
org.apache.commons.cli.CommandLineParser

73 |
74 |
75 | 133 |
134 | 135 |
136 | 137 | 138 | 139 | 140 | 141 | 142 | 151 |
152 | 179 | 180 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

181 | 182 | 183 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/org/apache/commons/cli/class-use/DefaultParser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class org.apache.commons.cli.DefaultParser (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Class
org.apache.commons.cli.DefaultParser

73 |
74 |
No usage of org.apache.commons.cli.DefaultParser
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/org/apache/commons/cli/class-use/GnuParser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class org.apache.commons.cli.GnuParser (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Class
org.apache.commons.cli.GnuParser

73 |
74 |
No usage of org.apache.commons.cli.GnuParser
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/org/apache/commons/cli/class-use/HelpFormatter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class org.apache.commons.cli.HelpFormatter (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Class
org.apache.commons.cli.HelpFormatter

73 |
74 |
No usage of org.apache.commons.cli.HelpFormatter
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/org/apache/commons/cli/class-use/MissingArgumentException.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class org.apache.commons.cli.MissingArgumentException (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Class
org.apache.commons.cli.MissingArgumentException

73 |
74 |
No usage of org.apache.commons.cli.MissingArgumentException
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/org/apache/commons/cli/class-use/MissingOptionException.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class org.apache.commons.cli.MissingOptionException (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Class
org.apache.commons.cli.MissingOptionException

73 |
74 |
75 | 103 |
104 | 105 |
106 | 107 | 108 | 109 | 110 | 111 | 112 | 121 |
122 | 149 | 150 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

151 | 152 | 153 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/org/apache/commons/cli/class-use/Parser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class org.apache.commons.cli.Parser (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Class
org.apache.commons.cli.Parser

73 |
74 |
75 | 119 |
120 | 121 |
122 | 123 | 124 | 125 | 126 | 127 | 128 | 137 |
138 | 165 | 166 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

167 | 168 | 169 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/org/apache/commons/cli/class-use/PatternOptionBuilder.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class org.apache.commons.cli.PatternOptionBuilder (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Class
org.apache.commons.cli.PatternOptionBuilder

73 |
74 |
No usage of org.apache.commons.cli.PatternOptionBuilder
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/org/apache/commons/cli/class-use/PosixParser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class org.apache.commons.cli.PosixParser (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Class
org.apache.commons.cli.PosixParser

73 |
74 |
No usage of org.apache.commons.cli.PosixParser
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/org/apache/commons/cli/class-use/TypeHandler.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class org.apache.commons.cli.TypeHandler (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Class
org.apache.commons.cli.TypeHandler

73 |
74 |
No usage of org.apache.commons.cli.TypeHandler
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

122 | 123 | 124 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/org/apache/commons/cli/class-use/UnrecognizedOptionException.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Class org.apache.commons.cli.UnrecognizedOptionException (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Class
org.apache.commons.cli.UnrecognizedOptionException

73 |
74 |
75 | 101 |
102 | 103 |
104 | 105 | 106 | 107 | 108 | 109 | 110 | 119 |
120 | 147 | 148 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

149 | 150 | 151 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/org/apache/commons/cli/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | org.apache.commons.cli (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 |

org.apache.commons.cli

13 |
14 |

Interfaces

15 | 18 |

Classes

19 | 35 |

Exceptions

36 | 44 |
45 | 46 | 47 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/org/apache/commons/cli/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Uses of Package org.apache.commons.cli (Apache Commons CLI 1.3.1 API) 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Uses of Package
org.apache.commons.cli

73 |
74 |
75 | 158 |
159 | 160 |
161 | 162 | 163 | 164 | 165 | 166 | 167 | 176 |
177 | 204 | 205 |

Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.

206 | 207 | 208 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/package-list: -------------------------------------------------------------------------------- 1 | org.apache.commons.cli 2 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/apidocs/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/commons-cli-1.3.1-javadoc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/DeAnonymizer/commons-cli-1.3.1/commons-cli-1.3.1-javadoc.jar -------------------------------------------------------------------------------- /DeAnonymizer/commons-cli-1.3.1/commons-cli-1.3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/DeAnonymizer/commons-cli-1.3.1/commons-cli-1.3.1.jar -------------------------------------------------------------------------------- /DeAnonymizer/src/Main.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | import java.io.IOException; 4 | import org.apache.commons.cli.*; 5 | 6 | /** 7 | * Main class for DeAnonymizer 8 | * 9 | * @author Marion Dam 10 | * @version 1.1 11 | * 12 | * The likelihood (as computed in SNPcompare class) is described in: 13 | * Multiplexing droplet-based single cell RNA-sequencing using natural genetic barcodes, H.M. Kang e.a., biorxiv preprint 14 | */ 15 | 16 | 17 | 18 | public class Main 19 | { 20 | public static void main(String[] args) throws IOException 21 | { 22 | Options options = new Options(); 23 | options.addOption("g", "genotypeVCF", true, "Genotype VCF file path."); 24 | options.addOption("s", "SNPfile", true, "SNP-reads file from countUMI-script, containing the reads per SNP per cell."); 25 | options.addOption("n", "cellnames", true, "Path and file containing names of all cells to be considered."); 26 | options.addOption("o", "output", true, "Output path and file name."); 27 | options.addOption("a", "alpha", true, "OPTIONAL. Integer from 1 to 4, where: \t1: {0.5}, \t2: {0.25, 0.5, 0.75}, \t3: {0.10, 0.20, ..., 0.90}. \t4: {0.05, 0.10, ..., 0.95}, \tDefault = 1."); 28 | options.addOption("t", "tValCutoff", true, "OPTIONAL. Set cut-off for log-likelihood difference (integer). \tDefault = 1."); 29 | options.addOption("e", "error", true, "OPTIONAL. Set error in base quality. \tDefault = 0.001."); 30 | options.addOption("S", "samples", true, "OPTIONAL. Text file to specify which samples in the VCF to be included, one sample name per line. \tDefault = ALL samples in VCF."); 31 | 32 | 33 | CommandLineParser parser = new DefaultParser(); 34 | 35 | try 36 | { 37 | CommandLine line = parser.parse(options, args); 38 | if(!line.hasOption("g") || !line.hasOption("s") || !line.hasOption("o")) 39 | { 40 | HelpFormatter formatter = new HelpFormatter(); 41 | String header = "DeAnonymizer. \nThe program will compute the most likely sample (or combination of two samples) to which each input cell belongs." 42 | + " Provide as input: the genotype VCF of the samples to be considered, a list of cell-ids, a file with (SNP position, cell-id, genotype), " 43 | + "as generated with count_umi-script.\n\n"; 44 | formatter.printHelp(header, options, true); 45 | System.exit(1); 46 | } 47 | 48 | String genoVCF = line.getOptionValue("g"); 49 | String SNPfile = line.getOptionValue("s"); 50 | String cellNameFile = line.getOptionValue("n"); 51 | String outputPath = line.getOptionValue("o"); 52 | 53 | 54 | String sampleFile = null; 55 | if (line.hasOption("S")) 56 | sampleFile = line.getOptionValue("S"); 57 | 58 | int alpha = 1; 59 | if(line.hasOption("a")) 60 | alpha = Integer.parseInt(line.getOptionValue("a")); 61 | 62 | int tVal = 1; 63 | if(line.hasOption("t")) 64 | tVal = Integer.parseInt(line.getOptionValue("t")); 65 | 66 | double error = 0.001; 67 | if(line.hasOption("e")) 68 | error = Double.parseDouble(line.getOptionValue("e")); 69 | 70 | System.out.println("Running DeAnonymizer with the following settings:\nError = " 71 | + error + "\nLikelihood difference cut-off = " + tVal +"\n\nStarted reading files...\n"); 72 | 73 | GenoTable genoTable; 74 | 75 | genoTable = new GenoTable(genoVCF, SNPfile, cellNameFile, alpha, tVal, error, sampleFile); 76 | genoTable.run(); 77 | 78 | genoTable.writeTable(outputPath); 79 | 80 | System.out.println("Finished the program!"); 81 | 82 | } 83 | catch (ParseException exp) 84 | { 85 | System.out.println("Parse exception:" + exp.getMessage()); 86 | } 87 | } 88 | } 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /DeAnonymizer/src/SNPCompare.java: -------------------------------------------------------------------------------- 1 | import org.molgenis.genotype.Allele; 2 | 3 | public class SNPCompare { 4 | 5 | private int[] d_genoCode = new int[4]; // in alphabetic order: A, C, G, T 6 | private int d_numbSamples; 7 | private double[] d_result; 8 | private double[] d_doublets; 9 | private float[][] d_snpGP; 10 | private Allele d_ref; 11 | private Allele d_alt; 12 | private double[] d_alphas; 13 | private boolean d_goodSNP = true; 14 | private double d_error; 15 | 16 | public SNPCompare(int[] genoCode, float[][] snpGP, Allele ref, Allele alt, int numbSamples, double[] alphas, double error) 17 | { 18 | d_genoCode = genoCode; 19 | d_numbSamples = numbSamples; 20 | d_result = new double[d_numbSamples]; 21 | d_alphas = alphas; 22 | d_doublets = new double[d_numbSamples * (d_numbSamples - 1) / 2 * d_alphas.length]; 23 | d_snpGP = snpGP; 24 | d_ref = ref; 25 | d_alt = alt; 26 | d_error = error; 27 | } 28 | 29 | public double[] run() 30 | { 31 | int refInt = alleleToInt(d_ref); 32 | int altInt = alleleToInt(d_alt); 33 | 34 | calcSinglet(refInt, altInt); 35 | 36 | return d_result; 37 | } 38 | 39 | 40 | public double[] runDoublets() 41 | { 42 | int refInt = alleleToInt(d_ref); 43 | int altInt = alleleToInt(d_alt); 44 | 45 | calcDoublets(refInt, altInt); 46 | 47 | return d_doublets; 48 | } 49 | 50 | 51 | 52 | private void calcSinglet(int ref, int alt) 53 | { 54 | for (int samp = 0; samp < d_numbSamples; ++samp) 55 | { 56 | int n_ref = d_genoCode[ref]; 57 | int n_alt = d_genoCode[alt]; 58 | 59 | if (n_ref + n_alt == 0) 60 | continue; 61 | 62 | // The number represents the genotype of samp, the letter refers to the allele (r = ref, a = alt) 63 | // So, p2r means: P(ref allele | genotype samp = 1/1) (then the observed ref allele is supposed to be a mistake) 64 | double p0r = (1 - d_error) * d_snpGP[samp][0]; 65 | double p1r = ((1 - d_error) * 0.5 + d_error / 6.0) * d_snpGP[samp][1] ; 66 | double p2r = d_error / 3.0 * d_snpGP[samp][2]; 67 | 68 | double p0a = d_error / 3.0 * d_snpGP[samp][0]; 69 | double p1a = ((1 - d_error) * 0.5 + d_error / 6.0) * d_snpGP[samp][1]; 70 | double p2a = (1 - d_error) * d_snpGP[samp][2]; 71 | 72 | double tmp; 73 | 74 | tmp = Math.pow(p0a, n_alt) * Math.pow(p0r, n_ref) + Math.pow(p1a, n_alt) * Math.pow(p1r, n_ref) + Math.pow(p2a, n_alt) * Math.pow(p2r, n_ref); 75 | 76 | // Avoid taking the logarithm of too small values, as this will result in -INF. Instead, discard this SNP 77 | if (tmp < 1e-300) 78 | d_goodSNP = false; 79 | 80 | d_result[samp] = Math.log(tmp); 81 | 82 | } 83 | 84 | } 85 | 86 | 87 | private void calcDoublets(int ref, int alt) 88 | { 89 | int n_ref = d_genoCode[ref]; 90 | int n_alt = d_genoCode[alt]; 91 | 92 | if (n_ref + n_alt == 0) 93 | return; 94 | 95 | int combTested = 0; 96 | 97 | 98 | for (int samp1 = 0; samp1 < d_numbSamples; ++samp1) 99 | { 100 | for (int samp2 = samp1 + 1; samp2 < d_numbSamples; ++samp2) 101 | { 102 | ++combTested; 103 | 104 | for (int alphaInt = 0; alphaInt < d_alphas.length; ++alphaInt) 105 | { 106 | double alpha = d_alphas[alphaInt]; 107 | 108 | 109 | // The first number represents the genotype of samp1, second number is genotype samp2, the letter refers to the observed allele (r = ref, a = alt) 110 | // So, p01r means: P(ref allele | genotype samp1 = 0/0 and genotype samp2 = 0/1) 111 | double p00r = (1 - d_error) * d_snpGP[samp1][0] * d_snpGP[samp2][0]; 112 | double p01r = ((1 - alpha) * (1 - d_error) + alpha * ((1 - d_error) * 0.5 + d_error / 6.0)) * d_snpGP[samp1][0] * d_snpGP[samp2][1]; 113 | double p02r = ((1 - alpha) * (1 - d_error) + alpha * (d_error / 3.0)) * d_snpGP[samp1][0] * d_snpGP[samp2][2]; 114 | double p10r = ((1 - alpha) * ((1 - d_error) * 0.5 + d_error / 6.0) + alpha * (1 - d_error)) * d_snpGP[samp1][1] * d_snpGP[samp2][0]; 115 | double p11r = (((1 - d_error) * 0.5 + d_error / 6.0)) * d_snpGP[samp1][1] * d_snpGP[samp2][1]; 116 | double p12r = ((1 - alpha) * ((1 - d_error) * 0.5 + d_error / 6.0) + alpha * (d_error / 3.0)) * d_snpGP[samp1][1] * d_snpGP[samp2][2]; 117 | double p20r = ((1 - alpha) * (d_error / 3.0) + alpha * (1 - d_error)) * d_snpGP[samp1][2] * d_snpGP[samp2][0]; 118 | double p21r = ((1 - alpha) * (d_error / 3.0) + alpha * ((1 - d_error) * 0.5 + d_error / 6.0)) * d_snpGP[samp1][2] * d_snpGP[samp2][1]; 119 | double p22r = (d_error / 3.0) * d_snpGP[samp1][2] * d_snpGP[samp2][2]; 120 | 121 | 122 | double p00a = (d_error / 3.0) * d_snpGP[samp1][0] * d_snpGP[samp2][0]; 123 | double p01a = ((1 - alpha) * (d_error / 3.0) + alpha * ((1 - d_error) * 0.5 + d_error / 6.0)) * d_snpGP[samp1][0] * d_snpGP[samp2][1]; 124 | double p02a = ((1 - alpha) * (d_error / 3.0) + alpha * (1 - d_error)) * d_snpGP[samp1][0] * d_snpGP[samp2][2]; 125 | double p10a = ((1 - alpha) * ((1 - d_error) * 0.5 + d_error / 6.0) + alpha * (d_error / 3.0)) * d_snpGP[samp1][1] * d_snpGP[samp2][0]; 126 | double p11a = (((1 - d_error) * 0.5 + d_error / 6.0)) * d_snpGP[samp1][1] * d_snpGP[samp2][1]; 127 | double p12a = ((1 - alpha) * ((1 - d_error) * 0.5 + d_error / 6.0) + alpha * (1 - d_error)) * d_snpGP[samp1][1] * d_snpGP[samp2][2]; 128 | double p20a = ((1 - alpha) * (1 - d_error) + alpha * (d_error / 3.0)) * d_snpGP[samp1][2] * d_snpGP[samp2][0]; 129 | double p21a = ((1 - alpha) * (1 - d_error) + alpha * ((1 - d_error) * 0.5 + d_error / 6.0)) * d_snpGP[samp1][2] * d_snpGP[samp2][1]; 130 | double p22a = ((1 - d_error)) * d_snpGP[samp1][2] * d_snpGP[samp2][2]; 131 | 132 | double tmp = Math.pow(p00r, n_ref) * Math.pow(p00a, n_alt) + 133 | Math.pow(p01r, n_ref) * Math.pow(p01a, n_alt) + 134 | Math.pow(p02r, n_ref) * Math.pow(p02a, n_alt) + 135 | Math.pow(p10r, n_ref) * Math.pow(p10a, n_alt) + 136 | Math.pow(p11r, n_ref) * Math.pow(p11a, n_alt) + 137 | Math.pow(p12r, n_ref) * Math.pow(p12a, n_alt) + 138 | Math.pow(p20r, n_ref) * Math.pow(p20a, n_alt) + 139 | Math.pow(p21r, n_ref) * Math.pow(p21a, n_alt) + 140 | Math.pow(p22r, n_ref) * Math.pow(p22a, n_alt); 141 | 142 | 143 | if (tmp < 1e-300) 144 | d_goodSNP = false; 145 | 146 | d_doublets[(combTested - 1) * d_alphas.length + alphaInt] = Math.log(tmp); 147 | } 148 | 149 | } 150 | } 151 | 152 | } 153 | 154 | public boolean goodSNP() 155 | { 156 | return d_goodSNP; 157 | } 158 | 159 | private int alleleToInt(Allele al) 160 | { 161 | int alleleAsInt = 0; 162 | 163 | Allele a = Allele.create('A'); 164 | if (al.equals(a)) 165 | alleleAsInt = 0; 166 | Allele c = Allele.create('C'); 167 | if (al.equals(c)) 168 | alleleAsInt = 1; 169 | Allele g = Allele.create('G'); 170 | if (al.equals(g)) 171 | alleleAsInt = 2; 172 | Allele t = Allele.create('T'); 173 | if (al.equals(t)) 174 | alleleAsInt = 3; 175 | 176 | return alleleAsInt; 177 | } 178 | 179 | 180 | } 181 | 182 | 183 | -------------------------------------------------------------------------------- /DeAnonymizer/src/Scores.java: -------------------------------------------------------------------------------- 1 | public class Scores { 2 | 3 | private double[] d_scores; 4 | private int d_snps; 5 | 6 | public Scores(int numbSamples) 7 | { 8 | d_scores = new double[numbSamples]; 9 | d_snps = 0; 10 | } 11 | 12 | public int getNSnps() 13 | { 14 | return d_snps; 15 | } 16 | 17 | public double[] getScores() 18 | { 19 | return d_scores; 20 | } 21 | 22 | public void addScores(double[] toAdd) 23 | { 24 | if (toAdd.length == d_scores.length) 25 | { 26 | for (int idx = 0; idx < d_scores.length; ++idx) 27 | d_scores[idx] += toAdd[idx]; 28 | } 29 | } 30 | 31 | public void increaseNSnps() 32 | { 33 | ++d_snps; 34 | } 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Magic/run_magic_cd4_per_sample.py: -------------------------------------------------------------------------------- 1 | import magic 2 | import os 3 | import pandas as pd 4 | 5 | rootdir = "data/th_cells_per_sample/samples" 6 | outdir = "data/th_cells_per_sample/magic_output/" 7 | 8 | for subdir, dirs, files in os.walk(rootdir): 9 | # loop over expression files 10 | for dir in dirs: 11 | scdata = magic.mg.SCData.from_10x(os.path.expanduser(os.path.join(subdir, dir)), 12 | normalize=False) 13 | # run magic 14 | scdata.run_magic(n_pca_components=20, random_pca=True, t=4, k=9, 15 | ka=3, epsilon=1, rescale_percent=99) 16 | 17 | # write imputed expression file per sample 18 | scdata.magic.data.transpose().to_csv(os.path.join(outdir, dir + ".tsv"), header=True, index=True, sep='\t', mode='w') -------------------------------------------------------------------------------- /R-scripts/concordance_eqtls.R: -------------------------------------------------------------------------------- 1 | ########################################################################################################################### 2 | # Authors: Harm Brugge 3 | # Name: concordance_eqtls 4 | # Function: Determine concordance RNA-seq datasets 5 | ########################################################################################################################### 6 | # 7 | # Libraries 8 | # 9 | ########################################################################################################################### 10 | library(Matrix) 11 | library(Matrix.utils) 12 | 13 | ########################################################################################################################### 14 | # 15 | # Load data 16 | # 17 | ########################################################################################################################### 18 | # BIOS eQTLs independent effects 19 | eqtls.rnaseq <- read.table("data/gene_level_eQTLs_independent_effects_interactions.txt", header = T, sep = "\t") 20 | # DeepSAGE top eQTLS 21 | eqtls.deepsage <- read.table("data/DeepSAGE_eqtls.csv", sep = ";", header = T, dec = ",") 22 | # scRNA-seq eQTLs PBMCs (bulk like) confined to BIOS eQTLs 23 | eqtls.sc.rnaseq <- read.table("data/eQTLProbesFDR0.05-ProbeLevel_RNA-seq-all-cells.txt", header = T, sep = "\t") 24 | # scRNA-seq eQTLs PBMCs (bulk like) confined to deepSAGE eQTLs 25 | eqtls.all.centered.deepsage <- read.table("data/eQTLProbesFDR0.05-ProbeLevel_DeepSAGE-all-cells.txt", header = T, sep = "\t") 26 | # scRNA-seq expression data (Seurat) 27 | load("clustering/pilot3_subsetted_celltypes_final_ensemble.Rda") 28 | ## Or a tsv 29 | #all.cells.expression <- read.table("~/Documents/R/Stage/data/pilot3_traitfile_all_log_norm.tsv", header = T, sep="\t") 30 | 31 | 32 | ########################################################################################################################### 33 | # 34 | # Format data 35 | # 36 | ########################################################################################################################### 37 | # Use SNP and ensemble ids to match the BIOS and single cell. 38 | eqtls.rnaseq$combine = paste(eqtls.rnaseq$SNP, eqtls.rnaseq$Gene) 39 | eqtls.sc.rnaseq$combine = paste(eqtls.sc.rnaseq$SNPName, eqtls.sc.rnaseq$ProbeName) 40 | eqtls.deepsage$combine = paste(eqtls.deepsage$SNPName, eqtls.deepsage$HGNCName) 41 | eqtls.all.centered.deepsage$combine = paste(eqtls.all.centered.deepsage$SNPName, eqtls.all.centered.deepsage$HGNCName) 42 | eqtls.rnaseq.matched <- eqtls.rnaseq[match(eqtls.sc.rnaseq$combine,eqtls.rnaseq$combine, nomatch = 0),] 43 | eqtls.matched.deepsage <- eqtls.deepsage[match(eqtls.all.centered.deepsage$combine,eqtls.deepsage$combine, nomatch = 0),] 44 | # Flip z-scores if assesed allele is different 45 | eqtls.matched.deepsage[eqtls.matched.deepsage$AlleleAssessed != eqtls.all.centered.deepsage$AlleleAssessed,]$OverallZScore <- eqtls.matched.deepsage[eqtls.matched.deepsage$AlleleAssessed != eqtls.all.centered.deepsage$AlleleAssessed,]$OverallZScore * -1 46 | eqtls.rnaseq.matched[eqtls.rnaseq.matched$Assesed.Allele != eqtls.sc.rnaseq$AlleleAssessed,]$Z.score <- eqtls.rnaseq.matched[eqtls.rnaseq.matched$Assesed.Allele != eqtls.sc.rnaseq$AlleleAssessed,]$Z.score * -1 47 | 48 | # Calculate average expression for every gene in the single cell data. 49 | exp.sums <- rowMeans(combined.major@data) 50 | # Match them to the eQTL genes 51 | exp.sums.matched <- exp.sums[match(eqtls.rnaseq.matched$Gene, names(exp.sums), nomatch = 0)] 52 | 53 | # calculate snp genen distance 54 | eqtls.matched.deepsage$SNP.probe.dist <- eqtls.matched.deepsage$SNPChrPos - eqtls.matched.deepsage$ProbeCenterChrPos 55 | #eqtls.th.centered.deepsage$SNP.probe.dist <- eqtls.th.centered.deepsage$SNPChrPos - eqtls.th.centered.deepsage$ProbeCenterChrPos 56 | 57 | 58 | ########################################################################################################################### 59 | # 60 | # Plots 61 | # 62 | ########################################################################################################################### 63 | ## 64 | ## BIOS (RNA-seq) concordance 65 | ## 66 | plot(eqtls.rnaseq.matched$Z.score, eqtls.sc.rnaseq$OverallZScore, type = "n" 67 | ,cex.lab=1.4, 68 | xlab = "RNA-seq effect size (Z-scores)", 69 | ylab = "scRNA-seq effect size (Z-scores)", lwd=0) 70 | limits = par()$usr 71 | rect(0,0,limits[2],limits[4],col="#E6EFEA", border = NA) 72 | rect(0,0,limits[1],limits[3],col="#E6EFEA", border = NA) 73 | box(lwd=3, col = "grey") 74 | points(eqtls.rnaseq.matched$Z.score, eqtls.sc.rnaseq$OverallZScore, pch=21, bg=rgb(0,0,0,0.4), cex=log10(exp.sums.matched) + 1.5) 75 | abline(a=0, b=0, h=0,lty=3) 76 | abline(a=0, b=0, v=0,lty=3) 77 | title(main = "RNA-seq", adj = 0, font.main = 1, cex.main = 1.75, line = 0.7) 78 | 79 | concordance.perc <- signif(sum(eqtls.rnaseq.matched$Z.score * eqtls.sc.rnaseq$OverallZScore > 0) / length(eqtls.sc.rnaseq$OverallZScore) * 100, 3) 80 | 81 | ## 82 | ## DeepSAGE concordance 83 | ## 84 | 85 | # Match the expression to deepsage data 86 | exp.sums.matched <- exp.sums[match(eqtls.all.centered.deepsage$ProbeName, names(exp.sums), nomatch = 0)] 87 | plot(eqtls.matched.deepsage$OverallZScore, eqtls.all.centered.deepsage$OverallZScore, type = "n", 88 | xlab = "DeepSAGE effect size (Z-scores)", ylab = "scRNA-seq effect size (Z-scores)", lwd=0, 89 | cex.lab = 1.4, cex.main=1.75, xlim = c(-10,10), ylim = c(-8,8)) 90 | limits = par()$usr 91 | rect(0,0,limits[2],limits[4],col="#E6EFEA", border = NA) 92 | rect(0,0,limits[1],limits[3],col="#E6EFEA", border = NA) 93 | points(eqtls.matched.deepsage$OverallZScore, eqtls.all.centered.deepsage$OverallZScore, 94 | pch=21, bg=rgb(0,0,0,0.4), cex=log10(exp.sums.matched)+2) 95 | box(lwd=3, col="grey") 96 | abline(a=0, b=0, h=0,lty=3) 97 | abline(a=0, b=0, v=0,lty=3) 98 | title(main = "DeepSAGE", adj = 0, font.main = 1, cex.main = 1.75, line = 0.7) 99 | 100 | concordance.perc <- signif(sum(eqtls.matched.deepsage$OverallZScore * eqtls.all.centered.deepsage$OverallZScore > 0) / length(eqtls.matched.deepsage$OverallZScore) * 100, 3) 101 | 102 | ########################################################################################################################### 103 | # 104 | # Write tables 105 | # 106 | ########################################################################################################################### 107 | eqtls.sc.rnaseq$Z.score.bios <- eqtls.rnaseq.matched$Z.score 108 | eqtls.sc.rnaseq$p.value.bios <- eqtls.rnaseq.matched$P.value 109 | eqtls.sc.rnaseq$fdr.bios <- eqtls.rnaseq.matched$FDR 110 | 111 | eqtls.sc.rnaseq$Concordant <- eqtls.rnaseq.matched$Z.score * eqtls.sc.rnaseq$OverallZScore > 0 112 | 113 | write.table(eqtls.sc.rnaseq, file = "./data/concordance_eqtls_bios.csv", sep = "\t", quote = F, col.names=NA) 114 | write.table(eqtls.sc.rnaseq[eqtls.rnaseq.matched$Z.score * eqtls.sc.rnaseq$OverallZScore > 0,], file = "./data/concordant_eqtls_bios_scrna.txt", sep = "\t", quote = F, col.names=NA) 115 | write.table(eqtls.rnaseq.matched[eqtls.rnaseq.matched$Z.score * eqtls.sc.rnaseq$OverallZScore < 0,], file = "./data/discordant_eqtls_bios_original.txt", sep = "\t", quote = F, col.names=NA) 116 | 117 | eqtls.all.centered.deepsage$Z.score.deepsage <- eqtls.matched.deepsage$OverallZScore 118 | eqtls.all.centered.deepsage$Concordant <- eqtls.matched.deepsage$OverallZScore * eqtls.all.centered.deepsage$OverallZScore > 0 119 | eqtls.all.centered.deepsage$PValue.deepsage <- eqtls.matched.deepsage$PValue 120 | eqtls.all.centered.deepsage$FDR.deepSAGE <- eqtls.matched.deepsage$FDR 121 | 122 | write.table(eqtls.all.centered.deepsage, file = "./data/concordance_eqtls_deepsage.csv", sep = "\t", quote = F, col.names=NA) -------------------------------------------------------------------------------- /R-scripts/eQTL_cohort_replication.R: -------------------------------------------------------------------------------- 1 | ########################################################################################################################### 2 | # Authors: Dylan de Vries 3 | # Name: eQTL_cohort_replication.R 4 | # Function: Compare our eQTLs with the eQTLs identified by Kasela et al. and those found in the Blueprint cohort 5 | ########################################################################################################################### 6 | # 7 | # Functions 8 | # 9 | ########################################################################################################################### 10 | 11 | # Name: compareDatasets 12 | # Function: finds the overlap between the input eQTLs and the cohort eQTLs and checks the concordance 13 | # Input: 14 | # Name Type Description 15 | # eQTLs data.frame Data frame with the eQTL pipeline output 16 | # cohortEQTLs data.frame Data frame with the eQTLs of the cohort to compare with. Column 1=SNPName, 2=Allele, 3=Direction and 4=Gene 17 | # eQTLGenes character All eQTL genes from our eQTLs. Is required because one cohort uses HGNC IDs and the other ENSEMBL IDs 18 | # 19 | # Output: 20 | # Returns a data frame with all overlapping eQTLs between the two cohorts and an extra column indicating concordance 21 | compareDatasets <- function(eQTLs, cohortEQTLs, eQTLGenes){ 22 | overlapEQTLs = data.frame(eQTLs, concordance=eQTLs) 23 | concordance = rep("Not_found", nrow(overlapEQTLs)) 24 | for (eQTLIndex in 1:nrow(overlapEQTLs)){ 25 | matchingCohortEQTLs = cohortEQTLs[which(cohortEQTLs[,1] == overlapEQTLs$SNPName[eQTLIndex]),] 26 | matchingCohortEQTLs = matchingCohortEQTLs[which(matchingCohortEQTLs[,4] == eQTLGenes[eQTLIndex]),] 27 | if (nrow(matchingCohortEQTLs) == 0){next} 28 | for (matchingEQTLIndex in 1:max(nrow(matchingCohortEQTLs),1)){ 29 | if (matchingCohortEQTLs[matchingEQTLIndex,2] == overlapEQTLs$AlleleAssessed[eQTLIndex]){ 30 | if ((matchingCohortEQTLs[matchingEQTLIndex,3] * overlapEQTLs$OverallZScore[eQTLIndex]) > 0){ 31 | concordance[eQTLIndex] = "Yes" 32 | } else { 33 | if (concordance[eQTLIndex] != "Yes"){ 34 | concordance[eQTLIndex] = "No" 35 | } 36 | } 37 | } else { 38 | if ((matchingCohortEQTLs[matchingEQTLIndex,3] * overlapEQTLs$OverallZScore[eQTLIndex]) < 0){ 39 | concordance[eQTLIndex] = "Yes" 40 | } else { 41 | if (concordance[eQTLIndex] != "Yes"){ 42 | concordance[eQTLIndex] = "No" 43 | } 44 | } 45 | } 46 | } 47 | } 48 | overlapEQTLs$concordance = concordance 49 | return(overlapEQTLs) 50 | } 51 | 52 | # Name: getENSEMBL_ID 53 | # Function: Change the format of the input gene to match the ENSEMBL ID format of our eQTLs 54 | # Input: 55 | # Name Type Description 56 | # gene character An ENSEMBL ID with a sub ID. Example: ENSG00000000419.8 57 | # 58 | # Output: 59 | # Returns the gene in the format used in our eQTLs 60 | getENSEMBL_ID <- function(gene){ 61 | return(strsplit(gene, "\\.")[[1]][1]) 62 | } 63 | 64 | 65 | ########################################################################################################################### 66 | # 67 | # Main code 68 | # 69 | ########################################################################################################################### 70 | ## 71 | ## Read in data. 72 | ## 73 | 74 | cellTypes = c("pbmc", "b-cells", "monocytes", "nk-cells", "tc-cells", "th-cells", "dend-cells") 75 | for (cellType in cellTypes){ 76 | print(cellType) 77 | if (cellType == cellTypes[1]){ 78 | eQTLs = data.frame(read.table(paste0("/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/scrna-seq_top_eqtls/", cellType, ".txt"), header=T, stringsAsFactors=F), cellType=cellType) 79 | } else { 80 | eQTLs = rbind(eQTLs, data.frame(read.table(paste0("/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/scrna-seq_top_eqtls/", cellType, ".txt"), header=T, stringsAsFactors=F), cellType=cellType)) 81 | } 82 | } 83 | 84 | kaselaCD4Data = read.table("/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/datasets/kasela_CD4.txt", header=T, stringsAsFactors=F) 85 | kaselaCD8Data = read.table("/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/datasets/kasela_CD8.txt", header=T, stringsAsFactors=F) 86 | blueprintCD4Data = read.table("/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/datasets/blueprint_CD4.txt", stringsAsFactors=F) 87 | blueprintMonocytesData = read.table("/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/datasets/blueprint_monocytes.txt", stringsAsFactors=F) 88 | 89 | #Put gene IDs in required format 90 | bpCD4Genes = unlist(lapply(blueprintCD4Data[,3], getENSEMBL_ID)) 91 | bpMonoGenes = unlist(lapply(blueprintMonocytesData[,3], getENSEMBL_ID)) 92 | 93 | #Kasela overlap check 94 | overlapEQTLsKaselaCD4 = compareDatasets(eQTLs, data.frame(SNPName=kaselaCD4Data$SNPName, AlleleAssessed=kaselaCD4Data$AlleleAssessed, OverallZScore=kaselaCD4Data$OverallZScore, kaselaCD4Data$HGNCName), eQTLs$HGNCName) 95 | overlapEQTLsKaselaCD8 = compareDatasets(eQTLs, data.frame(SNPName=kaselaCD8Data$SNPName, AlleleAssessed=kaselaCD8Data$AlleleAssessed, OverallZScore=kaselaCD8Data$OverallZScore, kaselaCD8Data$HGNCName), eQTLs$HGNCName) 96 | 97 | write.table(overlapEQTLsKaselaCD4, file="/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/overlap/KaselaCD4_CD8_overlap.txt", row.names=F, col.names=T, quote=F) 98 | write.table(overlapEQTLsKaselaCD8, file="/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/overlap/KaselaCD8_overlap.txt", row.names=F, col.names=T, quote=F) 99 | 100 | #Blueprint overlap check 101 | overlapEQTLsBlueprintCD4 = compareDatasets(eQTLs, data.frame(SNPName=blueprintCD4Data[,2], AlleleAssessed=substr(blueprintCD4Data[,1] , nchar(blueprintCD4Data[,1]), nchar(blueprintCD4Data[,1])), OverallZScore=blueprintCD4Data[,5], Genes=bpCD4Genes), eQTLs$ProbeName) 102 | overlapEQTLsBlueprintMonocytes = compareDatasets(eQTLs, data.frame(SNPName=blueprintMonocytesData[,2], AlleleAssessed=substr(blueprintMonocytesData[,1] , nchar(blueprintMonocytesData[,1]), nchar(blueprintMonocytesData[,1])), OverallZScore=blueprintMonocytesData[,5], Genes=bpMonoGenes), eQTLs$ProbeName) 103 | 104 | write.table(overlapEQTLsBlueprintCD4, file="/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/overlap/BlueprintCD4_overlap.txt", row.names=F, col.names=T, quote=F) 105 | write.table(overlapEQTLsBlueprintMonocytes, file="/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/overlap/BlueprintMonocytes_overlap.txt", row.names=F, col.names=T, quote=F) 106 | 107 | 108 | -------------------------------------------------------------------------------- /R-scripts/eQTL_cohort_replication_make_tables.R: -------------------------------------------------------------------------------- 1 | ########################################################################################################################### 2 | # Authors: Dylan de Vries 3 | # Name: eQTL_cohort_replication_make_tables.R 4 | # Function: Make the output replication table 5 | ########################################################################################################################### 6 | # 7 | # Functions 8 | # 9 | ########################################################################################################################### 10 | # Name: getEQTL 11 | # Function: Get the eQTL information 12 | # Input: 13 | # Name Type Description 14 | # SNP character The SNP rs ID 15 | # 16 | # Output: 17 | # Vector with the required eQTL information 18 | getEQTL <- function(SNP){ 19 | data = strsplit(SNP, ",")[[1]] 20 | eqtl = eQTLData[eQTLData$SNPName == data[1] & eQTLData$HGNCName == data[2],] 21 | return(c(eqtl$FDR, eqtl$PValue, eqtl$IncludedDatasetsCorrelationCoefficient)) 22 | } 23 | 24 | 25 | ########################################################################################################################### 26 | # 27 | # Main code 28 | # 29 | ########################################################################################################################### 30 | ## 31 | ## Read in data. 32 | ## 33 | 34 | overlapEQTLsKaselaCD8 = read.table("/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/overlap/KaselaCD8_overlap.txt", header=T, stringsAsFactors=F) 35 | overlapEQTLsKaselaCD4 = read.table("/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/overlap/KaselaCD4_CD8_overlap.txt", header=T, stringsAsFactors=F) 36 | overlapEQTLsBlueprintMonocytes = read.table("/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/overlap/BlueprintMonocytes_overlap.txt", header=T, stringsAsFactors=F) 37 | overlapEQTLsBlueprintCD4 = read.table("/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/overlap/BlueprintCD4_overlap.txt", header=T, stringsAsFactors=F) 38 | 39 | kaselaCD8Table = data.frame(SNP=overlapEQTLsKaselaCD8$SNPName, Gene=overlapEQTLsKaselaCD8$HGNCName, AlleleAssessed=overlapEQTLsKaselaCD8$AlleleAssessed, PBMC.Pvalue=0, CD4.Pvalue=0, CD8.Pvalue=0, NK.Pvalue=0, Monocytes.Pvalue=0, B.Pvalue=0, DC.Pvalue=0,PBMC.FDR=0, CD4.FDR=0, CD8.FDR=0, NK.FDR=0, Monocytes.FDR=0, B.FDR=0, DC.FDR=0, PBMC.Cor=0, CD4.Cor=0, CD8.Cor=0, NK.Cor=0, Monocytes.Cor=0, B.Cor=0, DC.Cor=0, Concordance=overlapEQTLsKaselaCD8$concordance) 40 | 41 | kaselaCD4Table = data.frame(SNP=overlapEQTLsKaselaCD4$SNPName, Gene=overlapEQTLsKaselaCD4$HGNCName, AlleleAssessed=overlapEQTLsKaselaCD4$AlleleAssessed, PBMC.Pvalue=0, CD4.Pvalue=0, CD8.Pvalue=0, NK.Pvalue=0, Monocytes.Pvalue=0, B.Pvalue=0, DC.Pvalue=0,PBMC.FDR=0, CD4.FDR=0, CD8.FDR=0, NK.FDR=0, Monocytes.FDR=0, B.FDR=0, DC.FDR=0, PBMC.Cor=0, CD4.Cor=0, CD8.Cor=0, NK.Cor=0, Monocytes.Cor=0, B.Cor=0, DC.Cor=0, Concordance=overlapEQTLsKaselaCD4$concordance) 42 | 43 | blueprintMonocytesTable = data.frame(SNP=overlapEQTLsBlueprintMonocytes$SNPName, Gene=overlapEQTLsBlueprintMonocytes$HGNCName, AlleleAssessed=overlapEQTLsBlueprintMonocytes$AlleleAssessed, PBMC.Pvalue=0, CD4.Pvalue=0, CD8.Pvalue=0, NK.Pvalue=0, Monocytes.Pvalue=0, B.Pvalue=0, DC.Pvalue=0,PBMC.FDR=0, CD4.FDR=0, CD8.FDR=0, NK.FDR=0, Monocytes.FDR=0, B.FDR=0, DC.FDR=0, PBMC.Cor=0, CD4.Cor=0, CD8.Cor=0, NK.Cor=0, Monocytes.Cor=0, B.Cor=0, DC.Cor=0, Concordance=overlapEQTLsBlueprintMonocytes$concordance) 44 | 45 | blueprintCD4Table = data.frame(SNP=overlapEQTLsBlueprintCD4$SNPName, Gene=overlapEQTLsBlueprintCD4$HGNCName, AlleleAssessed=overlapEQTLsBlueprintCD4$AlleleAssessed, PBMC.Pvalue=0, CD4.Pvalue=0, CD8.Pvalue=0, NK.Pvalue=0, Monocytes.Pvalue=0, B.Pvalue=0, DC.Pvalue=0,PBMC.FDR=0, CD4.FDR=0, CD8.FDR=0, NK.FDR=0, Monocytes.FDR=0, B.FDR=0, DC.FDR=0, PBMC.Cor=0, CD4.Cor=0, CD8.Cor=0, NK.Cor=0, Monocytes.Cor=0, B.Cor=0, DC.Cor=0, Concordance=overlapEQTLsBlueprintCD4$concordance) 46 | 47 | cellTypes = c("pbmc", "b-cells", "monocytes", "nk-cells", "tc-cells", "th-cells", "dend-cells") 48 | eQTLfiles = c(paste0("/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/scrna-seq_eqtls/", cellTypes, "-all.txt")) 49 | cellTypes = c("PBMC", "B", "Monocytes", "NK", "CD8", "CD4", "DC") 50 | 51 | 52 | for (i in 1:length(eQTLfiles)){ 53 | print(i) 54 | eQTLData = read.table(eQTLfiles[i], header=T, stringsAsFactors=F) 55 | 56 | kaselaCD8Info = do.call("rbind", lapply(paste(kaselaCD8Table$SNP, kaselaCD8Table$Gene, sep=","), getEQTL)) 57 | kaselaCD8Table[,paste0(cellTypes[i], ".FDR")] = kaselaCD8Info[,1] 58 | kaselaCD8Table[,paste0(cellTypes[i], ".Pvalue")] = kaselaCD8Info[,2] 59 | kaselaCD8Table[,paste0(cellTypes[i], ".Cor")] = kaselaCD8Info[,3] 60 | 61 | kaselaCD4Info = do.call("rbind", lapply(paste(kaselaCD4Table$SNP, kaselaCD4Table$Gene, sep=","), getEQTL)) 62 | kaselaCD4Table[,paste0(cellTypes[i], ".FDR")] = kaselaCD4Info[,1] 63 | kaselaCD4Table[,paste0(cellTypes[i], ".Pvalue")] = kaselaCD4Info[,2] 64 | kaselaCD4Table[,paste0(cellTypes[i], ".Cor")] = kaselaCD4Info[,3] 65 | 66 | blueprintMonocytesInfo = do.call("rbind", lapply(paste(blueprintMonocytesTable$SNP, blueprintMonocytesTable$Gene, sep=","), getEQTL)) 67 | blueprintMonocytesTable[,paste0(cellTypes[i], ".FDR")] = blueprintMonocytesInfo[,1] 68 | blueprintMonocytesTable[,paste0(cellTypes[i], ".Pvalue")] = blueprintMonocytesInfo[,2] 69 | blueprintMonocytesTable[,paste0(cellTypes[i], ".Cor")] = blueprintMonocytesInfo[,3] 70 | 71 | blueprintCD4Info = do.call("rbind", lapply(paste(blueprintCD4Table$SNP, blueprintCD4Table$Gene, sep=","), getEQTL)) 72 | blueprintCD4Table[,paste0(cellTypes[i], ".FDR")] = blueprintCD4Info[,1] 73 | blueprintCD4Table[,paste0(cellTypes[i], ".Pvalue")] = blueprintCD4Info[,2] 74 | blueprintCD4Table[,paste0(cellTypes[i], ".Cor")] = blueprintCD4Info[,3] 75 | } 76 | 77 | write.table(kaselaCD8Table, file="/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/kaselaCD8OverlapTable.txt", col.names=T, row.names=F, quote=F) 78 | write.table(kaselaCD4Table, file="/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/kaselaCD4OverlapTable.txt", col.names=T, row.names=F, quote=F) 79 | write.table(blueprintCD4Table, file="/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/blueprintCD4OverlapTable.txt", col.names=T, row.names=F, quote=F) 80 | write.table(blueprintMonocytesTable, file="/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/replication/blueprintMonocytesOverlapTable.txt", col.names=T, row.names=F, quote=F) 81 | 82 | -------------------------------------------------------------------------------- /R-scripts/eqtl_box_plots.R: -------------------------------------------------------------------------------- 1 | ########################################################################################################################### 2 | # Authors: Harm Brugge 3 | # Name: eqtl_box_plots 4 | # Function: Creation of eQTL boxplots 5 | ########################################################################################################################### 6 | # 7 | # Libraries 8 | # 9 | ########################################################################################################################### 10 | library(beeswarm) 11 | library(ggplot2) 12 | library(ggbeeswarm) 13 | library(data.table) 14 | 15 | ########################################################################################################################### 16 | # 17 | # Load data 18 | # 19 | ########################################################################################################################### 20 | genotypes <- read.table("data/genotypes/maf_10.genotypes.txt", check.names = F) 21 | eqtl.table <- read.table("data/eqtl_table.csv", header = T, sep="\t") 22 | 23 | pbmc.expression <- read.table("data/pilot3_traitfile_ensembl_all_scaled.tsv", header = T, sep="\t", check.names = F, row.names = 1) 24 | b.expression <- read.table("data/pilot3_traitfile_ensembl_b_scaled.tsv", header = T, sep="\t", check.names = F, row.names = 1) 25 | th.expression <- read.table("data/pilot3_traitfile_ensembl_th_scaled.tsv", header = T, sep="\t", check.names = F, row.names = 1) 26 | tc.expression <- read.table("data/pilot3_traitfile_ensembl_tc_scaled.tsv", header = T, sep="\t", check.names = F, row.names = 1) 27 | nk.expression <- read.table("data/pilot3_traitfile_ensembl_nk_scaled.tsv", header = T, sep="\t", check.names = F, row.names = 1) 28 | dend.expression <- read.table("data/pilot3_traitfile_ensembl_dend_scaled.tsv", header = T, sep="\t", check.names = F, row.names = 1) 29 | mono.expression <- read.table("data/pilot3_traitfile_ensembl_mono_scaled.tsv", header = T, sep="\t", check.names = F, row.names = 1) 30 | c.mono.expression <- read.table("data/pilot3_traitfile_ensembl_c_mono_scaled.tsv", header = T, sep="\t", check.names = F, row.names = 1) 31 | nc.mono.expression <- read.table("data/pilot3_traitfile_ensembl_nc_mono_scaled.tsv", header = T, sep="\t", check.names = F, row.names = 1) 32 | 33 | genotypes <- genotypes[,colnames(genotypes) %in% colnames(pbmc.expression)] 34 | genotypes <- genotypes[,match(colnames(pbmc.expression), colnames(genotypes))] 35 | 36 | genes <- read.table("../scRNA-seq/data/lane_1/genes.tsv") 37 | 38 | ########################################################################################################################### 39 | # 40 | # Plotting 41 | # 42 | ########################################################################################################################### 43 | plot.all <- function(snp, gene, flip.levels = F) { 44 | snp.name <- snp 45 | 46 | snp <- unlist(genotypes[snp,]) 47 | 48 | snp[snp == "C/A"] <- "A/C" 49 | snp[snp == "T/A"] <- "A/T" 50 | snp[snp == "T/C"] <- "C/T" 51 | snp[snp == "G/A"] <- "A/G" 52 | snp[snp == "G/C"] <- "C/G" 53 | snp[snp == "G/T"] <- "T/G" 54 | 55 | snp <- droplevels(snp) 56 | if (flip.levels) snp = factor(snp, levels(snp)[c(3,2,1)]) 57 | 58 | eqtl <- eqtl.table[eqtl.table$SNPName == snp.name & eqtl.table$ProbeName == gene,] 59 | correlations <- paste("r =", sprintf("%.2f", round(eqtl[23:29], digits = 2)), unlist(eqtl[14:20])) 60 | 61 | data <- data.frame(snp= snp, expression= unlist(pbmc.expression[gene,]), cell.type= "PBMC", color="black") 62 | data <- rbind.data.frame(data, data.frame(snp= snp, expression= unlist(th.expression[gene,]), cell.type= "CD 4+ T", color="#153057")) 63 | data <- rbind.data.frame(data, data.frame(snp= snp, expression= unlist(tc.expression[gene,]), cell.type= "CD 8+ T", color="#009ddb")) 64 | data <- rbind.data.frame(data, data.frame(snp= snp, expression= unlist(nk.expression[gene,]), cell.type= "NK", color="#e64b50")) 65 | data <- rbind.data.frame(data, data.frame(snp= snp, expression= unlist(mono.expression[gene,]), cell.type= "Monocytes", color="#edba1b")) 66 | data <- rbind.data.frame(data, data.frame(snp= snp[colnames(pbmc.expression) %in% colnames(b.expression)], expression= unlist(b.expression[gene,]), cell.type= "B", color="#71bc4b")) 67 | data <- rbind.data.frame(data, data.frame(snp= snp, expression= unlist(dend.expression[gene,]), cell.type= "DC", color="#965ec8")) 68 | 69 | colors = c(rep("lightgrey", 3), rep("#153057",3), rep("#009ddb",3), rep("#e64b50",3), rep("#edba1b",3), rep("#71bc4b",3), rep("#965ec8",3)) 70 | colors.strip = c("black","#153057","#009ddb","#e64b50","#edba1b","#71bc4b","#965ec8") 71 | 72 | gene.name <- as.character(genes[genes$V1 == gene,]$V2) 73 | 74 | ggplot(data, aes(x=snp, y=expression, group=snp)) + 75 | geom_boxplot(notch=F, color = "black", outlier.shape=NA, fill= colors, lwd=0.6, alpha=1) + 76 | theme_minimal(base_family = "Helvetica") + 77 | theme(strip.text.x = element_text(colour = "black", size = 16, family = "Helvetica"), 78 | title = element_text(size = 20), 79 | axis.title.y = element_text(size = 16, family = "Helvetica"), 80 | axis.text.y = element_text(size = 12, family = "Helvetica"), 81 | axis.text.x = element_text(size = 12, family = "Helvetica"), 82 | panel.grid.major = element_blank(), panel.grid.minor = element_blank(), 83 | panel.border = element_rect(colour = "grey", fill=NA, size=2)) + 84 | facet_wrap(~cell.type, ncol = length(levels(data$cell.type)) ) + 85 | geom_quasirandom(cex=2, size = 2, shape = 21, color=rgb(0,0,0,1), fill=rgb(1,1,1,0.6)) + 86 | ggtitle(substitute(italic(x)~ " / "~y, list(x=gene.name, y=snp.name))) + 87 | ylab("Expression") + 88 | xlab("") + 89 | geom_label(data=data.frame(x=2, y=max(data$expression), label=correlations, 90 | cell.type=c("PBMC","CD 4+ T","CD 8+ T","NK","Monocytes","B","DC")), 91 | aes(x,y,label=label), inherit.aes=FALSE, colour = "white") + 92 | geom_text(data=data.frame(x=2, y=max(data$expression), label=correlations, 93 | cell.type=c("PBMC","CD 4+ T","CD 8+ T","NK","Monocytes","B","DC")), 94 | aes(x,y,label=label), inherit.aes=FALSE, size=6) 95 | } 96 | 97 | # plot.all("rs7142883","ENSG00000166165") 98 | # ggsave() 99 | plot.all("rs4804315", "ENSG00000133250") 100 | ggsave(filename = "plots/eqtl_znf414.pdf", width = 14, height = 5) 101 | plot.all("rs2272245", "ENSG00000106537") 102 | ggsave(filename = "plots/eqtl_tspan13.pdf", width = 14, height = 5) 103 | 104 | plot.mono <- function(snp, gene) { 105 | snp.name <- snp 106 | snp <- unlist(genotypes[snp,]) 107 | 108 | snp[snp == "C/T"] <- "T/C" 109 | snp[snp == "C/G"] <- "G/C" 110 | snp[snp == "C/A"] <- "A/C" 111 | snp[snp == "T/G"] <- "G/T" 112 | snp[snp == "T/A"] <- "A/T" 113 | snp[snp == "T/C"] <- "C/T" 114 | snp[snp == "G/A"] <- "A/G" 115 | snp[snp == "G/C"] <- "C/G" 116 | snp[snp == "G/T"] <- "T/G" 117 | 118 | snp <- droplevels(snp) 119 | #snp = factor(snp, levels(snp)[c(3,2,1)]) 120 | 121 | eqtl <- eqtl.table[eqtl.table$SNPName == snp.name & eqtl.table$ProbeName == gene,] 122 | correlations <- paste("r =", sprintf("%.2f", round(eqtl[c(23,29:31)], digits = 2)), unlist(eqtl[ c(14,20:22) ])) 123 | 124 | data <- data.frame(snp= snp, expression= unlist(pbmc.expression[gene,]), cell.type= "PBMC", color="black") 125 | data <- rbind.data.frame(data, data.frame(snp= snp, expression= unlist(mono.expression[gene,]), cell.type= "Monocytes", color="#edba1b")) 126 | data <- rbind.data.frame(data, data.frame(snp= snp, expression= unlist(c.mono.expression[gene,]), cell.type= "cMonocytes", color="#edba1b")) 127 | data <- rbind.data.frame(data, data.frame(snp= snp, expression= unlist(nc.mono.expression[gene,]), cell.type= "ncMonocytes", color="#edba1b")) 128 | 129 | colors = c(rep("lightgrey", 3), rep("#edba1b",9)) 130 | 131 | gene.name <- as.character(genes[genes$V1 == gene,]$V2) 132 | 133 | ggplot(data, aes(x=snp, y=expression, group=snp)) + 134 | geom_boxplot(notch=F, color = "black", outlier.shape=NA, fill= colors, lwd=0.6, alpha=1) + 135 | theme_minimal(base_family = "Helvetica") + 136 | theme(strip.text.x = element_text(colour = "black", size = 16, family = "Helvetica"), 137 | title = element_text(size = 20), 138 | axis.title.y = element_text(size = 16, family = "Helvetica"), 139 | axis.text.y = element_text(size = 12, family = "Helvetica"), 140 | axis.text.x = element_text(size = 12, family = "Helvetica"), 141 | panel.background = element_rect(fill = "white", colour = "grey"), 142 | panel.grid.major = element_blank(), panel.grid.minor = element_blank(), 143 | panel.border = element_rect(colour = "grey", fill=NA, size=2)) + 144 | facet_wrap(~cell.type, ncol = length(levels(data$cell.type)) ) + 145 | geom_quasirandom(cex=2, size = 2, shape = 21, color=rgb(0,0,0,1), fill=rgb(1,1,1,0.6)) + 146 | ggtitle(substitute(italic(x)~ " / "~y, list(x=gene.name, y=snp.name))) + 147 | ylab("Expression") + 148 | xlab("") + 149 | geom_text(data=data.frame(x=2, y=max(data$expression, na.rm = T), label=correlations, 150 | cell.type=c("PBMC","Monocytes","cMonocytes","ncMonocytes")), 151 | aes(x,y,label=label), inherit.aes=FALSE, size=6) 152 | } 153 | 154 | plot.mono("rs10878967", "ENSG00000257764") # RP11 155 | ggsave(filename = "plots/eqtl_RP11.pdf", width = 8, height = 5) 156 | 157 | plot.mono("rs61514665", "ENSG00000109861") # CTSC 158 | ggsave(filename = "plots/eqtl_CTSC.pdf", width = 8, height = 5) 159 | 160 | plot.mono("rs111631325", "ENSG00000198502") # HLA-DRB5 161 | ggsave(filename = "plots/eqtl_HLA-DRB5.pdf", width = 8, height = 5) 162 | 163 | plot.mono("rs4725361", "ENSG00000106565") # THEM176B 164 | ggsave(filename = "plots/eqtl_THEM176B.pdf", width = 8, height = 5) 165 | 166 | plot.mono("rs116232857", "ENSG00000196735") # HLA-DQA1 167 | ggsave(filename = "plots/eqtl_hla-dqa1.pdf", width = 8, height = 5) 168 | -------------------------------------------------------------------------------- /R-scripts/magic_plots.R: -------------------------------------------------------------------------------- 1 | ########################################################################################################################### 2 | # Authors: Dylan de Vries 3 | # Name: magic_plots.R 4 | # Function: Generates plots to determine the effect of MAGIC imputation on the gene expression in the CD4+ T cells. 5 | ########################################################################################################################### 6 | # 7 | # Libraries 8 | # 9 | ########################################################################################################################### 10 | library(ggplot2) 11 | 12 | ########################################################################################################################### 13 | # 14 | # Functions 15 | # 16 | ########################################################################################################################### 17 | magic.plot <- function(gene1, gene2, gene1.hgnc, gene2.hgnc){ 18 | imputed.exp.gene1 <- c() 19 | imputed.exp.gene2 <- c() 20 | nonImputed.exp.gene1 <- c() 21 | nonImputed.exp.gene2 <- c() 22 | for (i in 1:length(exp.matrices.nonImputed)){ 23 | if (gene1 %in% colnames(exp.matrices[[i]])){ 24 | imputed.exp.gene1 <- c(imputed.exp.gene1, exp.matrices[[i]][,gene1]) 25 | } else { 26 | imputed.exp.gene1 <- c(imputed.exp.gene1, rep(0, nrow(exp.matrices[[i]]))) 27 | } 28 | 29 | if (gene2 %in% colnames(exp.matrices[[i]])){ 30 | imputed.exp.gene2 <- c(imputed.exp.gene2, exp.matrices[[i]][,gene2]) 31 | } else { 32 | imputed.exp.gene2 <- c(imputed.exp.gene2, rep(0, nrow(exp.matrices[[i]]))) 33 | } 34 | 35 | if (gene1 %in% colnames(exp.matrices.nonImputed[[i]])){ 36 | nonImputed.exp.gene1 <- c(nonImputed.exp.gene1, exp.matrices.nonImputed[[i]][,gene1]) 37 | } else { 38 | nonImputed.exp.gene1 <- c(nonImputed.exp.gene1, rep(0, nrow(exp.matrices.nonImputed[[i]]))) 39 | } 40 | 41 | if (gene2 %in% colnames(exp.matrices.nonImputed[[i]])){ 42 | nonImputed.exp.gene2 <- c(nonImputed.exp.gene2, exp.matrices.nonImputed[[i]][,gene2]) 43 | } else { 44 | nonImputed.exp.gene2 <- c(nonImputed.exp.gene2, rep(0, nrow(exp.matrices.nonImputed[[i]]))) 45 | } 46 | } 47 | plot.nonImputed <- ggplot() + 48 | geom_point(aes(x=nonImputed.exp.gene1, y=nonImputed.exp.gene2)) + 49 | theme_minimal(base_size = 64) + 50 | theme(plot.title = element_text(hjust = 0.5)) + 51 | labs(x = paste(gene1.hgnc, "expression"), y = paste(gene2.hgnc, "expression")) + 52 | ggtitle(paste0("Correlation measured expression\n", gene1.hgnc, " vs. ", gene2.hgnc)) 53 | 54 | 55 | plot.imputed <- ggplot() + 56 | geom_point(aes(x=imputed.exp.gene1, y=imputed.exp.gene2)) + 57 | theme_minimal(base_size = 64) + 58 | theme(plot.title = element_text(hjust = 0.5)) + 59 | labs(x = paste(gene1.hgnc, "expression"), 60 | y = paste(gene2.hgnc, "expression")) + 61 | ggtitle(paste0("Correlation imputed expression\n", gene1.hgnc, " vs. ", gene2.hgnc)) 62 | 63 | return(list(plot.nonImputed, plot.imputed)) 64 | } 65 | 66 | ########################################################################################################################### 67 | # 68 | # Main code 69 | # 70 | ########################################################################################################################### 71 | ## 72 | ## Read the imputed data 73 | ## 74 | dir <- list.files(path="/Users/dylandevries/Documents/work/interactionAnalysis/expression_files/", pattern="*.tsv", full.names=T, recursive=FALSE) 75 | exp.matrices <- list() 76 | cell.counts <- c() 77 | sample.names <- vector() 78 | 79 | i <- 1 80 | for (file in dir) { 81 | sample.names <- c(sample.names, tools::file_path_sans_ext(basename(file))) 82 | sample <- read.csv(file = file, sep = "\t", row.names = 1) 83 | rownames(sample) <- substr(rownames(sample), start = 7, stop = 21) 84 | sample <- sample[apply(sample, 1, function(x){!any(x == 0)}),] 85 | sample <- t(sample) 86 | cell.counts <- c(cell.counts, nrow(sample)) 87 | 88 | exp.matrices[[i]] <- sample 89 | i <- i + 1 90 | } 91 | 92 | ## 93 | ## Read the non-imputed data 94 | ## 95 | exp.matrices.nonImputed <- list() 96 | sample.names <- vector() 97 | 98 | dir.path <- "./nonImputed_expression_files/thCellsPerSample/" 99 | dir <- list.dirs(path=dir.path, full.names=T, recursive=FALSE) 100 | 101 | i <- 1 102 | for (folder in dir) { 103 | print(i) 104 | print(paste0(dir[[i]], "/matrix.mtx")) 105 | sample.names <- c(sample.names, tools::file_path_sans_ext(basename(folder))) 106 | sample.raw <- readMM(paste0(dir[[i]], "/matrix.mtx")) 107 | rownames(sample.raw) <- read.table(paste0(dir[[i]], "/genes.tsv"), stringsAsFactors = F)$V1 108 | colnames(sample.raw) <- read.table(paste0(dir[[i]], "/barcodes.tsv"), stringsAsFactors = F)$V1 109 | exp.matrices.nonImputed[[i]] <- t(as.matrix(sample.raw)) 110 | 111 | i <- i + 1 112 | } 113 | 114 | ## 115 | ## Make the plots 116 | ## 117 | plots.CD3D.CD3E <- magic.plot("ENSG00000167286", "ENSG00000198851", "CD3D", "CD3E") 118 | png("./plots/CD3D_CD3E_nonImputed.png", width=1500, height=1500) 119 | print(plots.CD3D.CD3E[[1]]) 120 | dev.off() 121 | png("./plots/CD3D_CD3E_imputed.png", width=1500, height=1500) 122 | print(plots.CD3D.CD3E[[2]]) 123 | dev.off() 124 | 125 | plots.CD3D.CD4 <- magic.plot("ENSG00000167286", "ENSG00000010610", "CD3D", "CD4") 126 | png("./plots/CD3D_CD4_nonImputed.png", width=1500, height=1500) 127 | print(plots.CD3D.CD4[[1]]) 128 | dev.off() 129 | png("./plots/CD3D_CD4_imputed.png", width=1500, height=1500) 130 | print(plots.CD3D.CD4[[2]]) 131 | dev.off() 132 | 133 | plots.CD3D.CDMS4A1 <- magic.plot("ENSG00000167286", "ENSG00000156738", "CD3D", "MS4A1") 134 | png("./plots/CD3D_MS4A1_nonImputed.png", width=1500, height=1500) 135 | print(plots.CD3D.CDMS4A1[[1]]) 136 | dev.off() 137 | png("./plots/CD3D_MS4A1_imputed.png", width=1500, height=1500) 138 | print(plots.CD3D.CDMS4A1[[2]]) 139 | dev.off() 140 | 141 | plots.CD3D.CD14 <- magic.plot("ENSG00000167286", "ENSG00000170458", "CD3D", "CD14") 142 | png("./plots/CD3D_CD14_nonImputed.png", width=1500, height=1500) 143 | print(plots.CD3D.CD14[[1]]) 144 | dev.off() 145 | png("./plots/CD3D_CD14_imputed.png", width=1500, height=1500) 146 | print(plots.CD3D.CD14[[2]]) 147 | dev.off() 148 | -------------------------------------------------------------------------------- /R-scripts/make_co-expression_QTL_tables.R: -------------------------------------------------------------------------------- 1 | ########################################################################################################################### 2 | # Authors: Dylan de Vries 3 | # Name: make_co-expression_QTL_tables.R 4 | # Function: Make the co-expression QTL table with all top interactions and all significant interactions 5 | ########################################################################################################################### 6 | # 7 | # Main code 8 | # 9 | ########################################################################################################################### 10 | ## 11 | ## Read in data. 12 | ## 13 | load("/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/interactionAnalysis/nonImputed/interactionOutput.Rda") 14 | nonImputedOutput <- interaction.output 15 | load("/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/interactionAnalysis/imputed/interactionOutput.Rda") 16 | imputedOutput <- interaction.output 17 | 18 | pvalMatrix <- read.table("/Users/dylandevries/Documents/work/interactionAnalysis/highPerm/nonImputed_pval_perm_matrix.txt", header=T) 19 | 20 | ## 21 | ## Find the p-value threshold for the FDR threshold 22 | ## 23 | 24 | fdr.thresh = 0.1 25 | pval.thresh = 0 26 | for (pval in sort(as.numeric(as.matrix(pvalMatrix)))){ 27 | fdr = mean(apply(pvalMatrix[,-1], 2, function(x){length(which(x <= pval))})) / length(which(pvalMatrix[,1] <= pval)) 28 | if (fdr <= fdr.thresh){ 29 | pval.thresh = pval 30 | } 31 | } 32 | 33 | signif.interaction.matrix <- data.frame(SNP = character(0), 34 | eQTL.gene = character(0), 35 | eQTL.symbol = character(0), 36 | interaction.gene = character(0), 37 | interaction.symbol = character(0), 38 | AlleleAssessed = character(0), 39 | P.value = numeric(0), 40 | r = numeric(0), 41 | imputed.P.value = numeric(0), 42 | imputed.r = numeric(0), 43 | RNAseq.P.value = numeric(0)) 44 | 45 | top.interaction.matrix <- data.frame(SNP = character(0), 46 | eQTL.gene = character(0), 47 | eQTL.symbol = character(0), 48 | interaction.gene = character(0), 49 | interaction.symbol = character(0), 50 | AlleleAssessed = character(0), 51 | P.value = numeric(0), 52 | FDR = numeric(0), 53 | r = numeric(0)) 54 | 55 | for (i in 1:ncol(nonImputedOutput[[2]])){ 56 | eQTL.gene <- colnames(nonImputedOutput[[2]])[i] 57 | eQTL.symbol <- genes[genes[,1] == eQTL.gene,2] 58 | 59 | SNP <- eqtl.data[eqtl.data$ProbeName == eQTL.gene, "SNPName"] 60 | AlleleAssessed <- eqtl.data[eqtl.data$ProbeName == eQTL.gene, "AlleleAssessed"] 61 | 62 | interaction.gene <- rownames(nonImputedOutput[[1]])[which.min(nonImputedOutput[[2]][-1,i])] 63 | interaction.symbol <- genes[genes[,1] == interaction.gene,2] 64 | 65 | P.value <- signif(nonImputedOutput[[2]][interaction.gene, eQTL.gene], 10) 66 | FDR <- mean(apply(pvalMatrix[,-1], 2, function(x){length(which(signif(x, 10) <= P.value))})) / length(which(signif(pvalMatrix[,1], 10) <= P.value)) 67 | r <- nonImputedOutput[[1]][interaction.gene, eQTL.gene] 68 | 69 | top.interaction.matrix <- rbind(top.interaction.matrix, data.frame(SNP, eQTL.gene, eQTL.symbol, interaction.gene, interaction.symbol, AlleleAssessed, P.value, FDR, r)) 70 | 71 | for (index in which(nonImputedOutput[[2]][-1,i] <= pval.thresh)){ 72 | interaction.gene <- rownames(nonImputedOutput[[1]])[index] 73 | interaction.symbol <- genes[genes[,1] == interaction.gene,2] 74 | 75 | P.value <- nonImputedOutput[[2]][interaction.gene, eQTL.gene] 76 | r <- nonImputedOutput[[1]][interaction.gene, eQTL.gene] 77 | 78 | imputed.P.value <- imputedOutput[[2]][interaction.gene, eQTL.gene] 79 | imputed.r <- imputedOutput[[1]][interaction.gene, eQTL.gene] 80 | 81 | RNAseq.P.value <- biosRep[biosRep$gene == eQTL.gene & biosRep$interaction == interaction.gene, "interactionPvalue"][1] 82 | if (is.null(RNAseq.P.value)){ 83 | RNAseq.P.value <- NA 84 | } 85 | signif.interaction.matrix <- rbind(signif.interaction.matrix, data.frame(SNP, eQTL.gene, eQTL.symbol, interaction.gene, interaction.symbol, AlleleAssessed, P.value, r, imputed.P.value, imputed.r, RNAseq.P.value)) 86 | } 87 | } 88 | 89 | write.table(signif.interaction.matrix, file="signif_interaction_matrix.txt", row.names=F, col.names=T, quote=F, sep="\t") 90 | write.table(top.interaction.matrix, file="top_interaction_matrix.txt", row.names=F, col.names=T, quote=F, sep="\t") 91 | -------------------------------------------------------------------------------- /R-scripts/make_top_interaction_permutation_table.R: -------------------------------------------------------------------------------- 1 | ########################################################################################################################### 2 | # Authors: Harm Brugge & Dylan de Vries 3 | # Name: co-expression_QTL.R 4 | # Function: Calculate all interactions between a list of eQTL genes and all other expressed genes, using MAGIC imputed 5 | # expression data 6 | ########################################################################################################################### 7 | # 8 | # Main code 9 | # 10 | ########################################################################################################################### 11 | load("interactionOutput.Rda") 12 | 13 | for (type in c("imputed", "nonImputed")){ 14 | setwd(paste0("/groups/umcg-wijmenga/tmp03/projects/scRNAseq_10X_pilot/interactionAnalysis/", type)) 15 | load("/interactionOutput.Rda") 16 | 17 | files = dir("./permutations/") 18 | pvalMatrix = cbind(apply(interaction.output[[2]], 2, function(x){min(x[-1])})) 19 | permPvalues = NULL 20 | for (file in files){ 21 | if (!strsplit(file, "_")[[1]][1] %in% colnames(interaction.output[[2]])){next} 22 | permMatrix = read.table(paste0("./permutations/", file), header=T) 23 | permPvalues = rbind(permPvalues, apply(permMatrix, 2, min)) 24 | print(file) 25 | } 26 | 27 | pvalMatrix = cbind(pvalMatrix, permPvalues) 28 | 29 | 30 | for (i in 1:ncol(pvalMatrix)){ 31 | if (i == 1){ 32 | minOrder = order(pvalMatrix[,1]) 33 | rownames(pvalMatrix) = rownames(pvalMatrix)[minOrder] 34 | pvalMatrix[,1] = pvalMatrix[minOrder,1] 35 | } else { 36 | pvalMatrix[,i] = sort(pvalMatrix[,i]) 37 | } 38 | } 39 | 40 | colnames(pvalMatrix) = c("real", paste0("perm", 1:length(files))) 41 | 42 | write.table(pvalMatrix, file=paste0(type, "_pval_perm_matrix.txt"), row.names=T, col.names=T, quote=F, sep="\t") 43 | } 44 | -------------------------------------------------------------------------------- /R-scripts/readme.md: -------------------------------------------------------------------------------- 1 | # R scripts 2 | 3 | ## Data processing 4 | 5 | seurat_clustering.R - This script is used to process the output of Cell Ranger from all lanes of the chip into a single data object, which will be used for the rest of the analyses. 6 | This includes several QC steps, clustering, cell type assignment and linking the DeAnonimyzer output. 7 | It uses the output from Cell Ranger and the output from DeAnonimyzer and then writes the output to a file. 8 | 9 | ## Generate plots 10 | 11 | eqtl_box_plots.R - This makes the eQTL box plots found in figure 1.B, 1.D and 1.E, using the eQTL, genotypes and expression per cell type files. 12 | The plot.all function creates the plots used in 1.B and the plot.mono creates the plots used in 1.D and 1.E. 13 | Both plotting functions require you to provide the gene and the SNP ID. 14 | 15 | interaction_plots.R - Here we generate the plots used in figure 2.A, 2.B and 2.C in our paper. 16 | The script uses the expression, genotype, genes and eQTL files as input. 17 | Additionally, the script requires you to provide the two genes for which there is an interaction and the SNP ID. 18 | 19 | magic_plots.R - Generates plots (supplementary figure 3) to determine the effect of MAGIC imputation on the gene expression in the CD4+ T cells. 20 | 21 | ### eQTL replication 22 | concordance_eqtls.R - Script used to determine the concordance of the eQTLs found by doing an eQTL mapping confining to top eQTLs found in the RNA-seq and deepSAGE data. Corresponds to figure 1.A and supplementary table 1. 23 | 24 | eQTL_cohort_replication.R - Compares our eQTLs with the eQTLs identified by Kasela et al., PLOS Gen. (2017) () and those found by the Blueprint cohort (). 25 | 26 | eQTL_cohort_replication_make_tables.R - Makes the table in which our eQTLs are compared to those found by Kasela et al. and those found in the Blueprint cohort. 27 | 28 | eqtl_table.R - Generates a table (supplementary table 2) with the top eQTLs of all cell-types and their replication in the BIOS RNA-seq data. Also used to plot figure 1.C 29 | 30 | ### co-expression QTL identification and validation 31 | co-expression_QTL.R - Creates the correlation matrices for the eQTL genes and looks for interactions between genes. This script requires the genotype, gene ID conversion, expression and eQTL file as input. It will look for possible co-expression QTLs between every eQTL gene and all other genes for which there is variance within the expression in all samples. 32 | 33 | interactionOtherCellTypes.R - Calculates and plots all interactions for all cell types except the CD4+ T cells. It uses the Seurat object and the genotype file. 34 | 35 | make_co-expression_QTL_tables.R - Makes the co-expression QTL table with all top interactions and all significant interactions. 36 | It uses the output from the co-expression_QTL.R script and the p-value matrix to make a comprehensive table with all information about each co-expression QTL. 37 | It requires the output from the co-expression_QTL.R, the BIOS RNA-seq data and the eQTL data. 38 | 39 | make_top_interaction_permutation_table.R - Creates the p-value matrix with the p-values of the strongest interactions for every eQTL SNP and the strongest interaction found in the permutations. 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # scRNA-seq 2 | 3 | These scripts allow to process the scRNA-seq data, so that it can be used to identify eQTLs and co-expression QTLs. The website where you can download and request the data has changed to https://www.eqtlgen.org/sc/datasets/vanderwijst2018.html 4 | 5 | ## DeAnonymizer 6 | 7 | This tool uses the method as described in “Multiplexing droplet-based single cell RNA-sequencing using natural genetic barcodes” by Kang HM et al., Nat. Biotech. (2017) (). 8 | 9 | It takes as input a file with the following (tab separated) info fields: 10 | 11 | CHROM POS ALT REF cell_id A C G T 12 | 13 | Where CHROM and POS denote the chromosome and position of the SNP, respectively, and ALT and REF denote, respectively, the alternative and reference allele of the SNP. Cell_id consists of the cell barcode as present in the bam-file, and A, C, G and T denote how many unique UMIs are observed in the reads of the corresponding cell at the corresponding SNP having the corresponding base. 14 | In contrast to the tool presented in the aforementioned paper, this implementation assumes a fixed error in the base calling, which can be set using the -e flag. 15 | 16 | All flags are explained when running the program without arguments. 17 | 18 | ## MAGIC 19 | 20 | These are the settings used to run MAGIC, as described by Van Dijk et al. BioRxiv (2017) (). 21 | 1. n_pca_components=20 22 | 2. random_pca=True 23 | 3. t=4 24 | 4. k=9 25 | 5. ka=3 26 | 6. epsilon=1 27 | 7. rescale_percent=99 28 | 29 | In addition, the MAGIC script requires an output location and an input directory. The input directory needs to have all samples in a separate directory, with the following 3 files (standard 10X output): 30 | 1. barcodes.tsv 31 | 2. genes.tsv 32 | 3. matrix.mtx 33 | 34 | ## R-scripts 35 | 36 | Here we describe all the R scripts that were used to process the data, make plots, replicate the eQTLs and to identify co-expression QTLs. More detailed descriptions can be found in the R-scripts directory. 37 | 38 | ### Data processing 39 | seurat_clustering.R 40 | 41 | ### Generate plots 42 | eqtl_box_plots.R 43 | 44 | interaction_plots.R 45 | 46 | magic_plots.R 47 | 48 | ### eQTL replication 49 | concordance_eqtls.R 50 | 51 | eQTL_cohort_replication.R 52 | 53 | eQTL_cohort_replication_make_tables.R 54 | 55 | eqtl_table.R 56 | 57 | ### co-expression QTL identification and validation 58 | co-expression_QTL.R 59 | 60 | interactionOtherCellTypes.R 61 | 62 | make_co-expression_QTL_tables.R 63 | 64 | make_top_interaction_permutation_table.R 65 | -------------------------------------------------------------------------------- /website/data_access_agreement.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/website/data_access_agreement.docx -------------------------------------------------------------------------------- /website/figure-1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | scRNA-seq paper - Figure 1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 |
18 | 19 | 20 | 21 |
22 |
23 | 24 | 25 | 26 |
27 |
28 | 29 |

scRNA-seq cis-eQTLs and co-expression QTLs

30 | 31 |

32 | This web page accompanies the manuscript titled
'Single-cell RNA sequencing identifies cell type-specific cis-eQTLs and co-expression QTLs. 33 | ', by van der Wijst et al, published in Nature Genetics.
34 | For further questions, contact the corresponding author: lude@ludesign.nl
35 |

36 |
37 |
38 |
39 | 40 |
41 |

< Back

42 |

Figure 1: cis-eQTL analysis in single-cell RNA-seq data.

43 | 44 |
45 | 46 |
47 | Figure 1 - cis-eQTL analysis in single-cell RNA-seq data. 48 | (a) Effect size of the cis-eQTLs detected in the bulk-like PBMC scRNA-seq sample in which the analysis was confined to previously 49 | reported cis-eQTLs in (top) whole blood DeepSAGE or (bottom) bulk RNA-seq data. The number and percentage represent, respectively, the detected 50 | cis-eQTLs and their concordance (i.e. same allelic direction – green quadrants) between the bulk-like PBMC population scRNA-seq eQTLs and (top) 51 | whole blood DeepSAGE or (bottom) bulk RNA-seq data. The size of each dot represents the mean expression of the cis-regulated gene in the total 52 | scRNA-seq dataset. (b) Examples of undetectable cis-eQTLs in the bulk-like PBMC population caused by (top) masking of the cis-eQTL present in 53 | CD4+ T cells but absent in DCs with comparatively high expression of the cis-regulated gene or (bottom) opposite allelic effects in CD4+ T and NK 54 | cells. (c) Spearman’s rank correlation coefficient for the cMonocytes against the ncMonocytes of all top eQTLs that were identified in the total 55 | dataset or at least one (sub)cell cluster (see Suppl. Table 2). Significant correlations are shown in black (four red highlighted examples are shown 56 | in d and e), the non-significant in gray. (d) Cis-eQTLs specifically affecting expression in the cMonocytes, and not the ncMonocytes. (e) Cis-eQTLs 57 | significantly affecting the expression in both the cMonocytes and ncMonocytes. Each dot represents the mean expression of the eQTL gene in a donor. 58 | Box plots show the median, the first and third quartiles, and 1.5 times the interquartile range. r, Spearman’s rank correlation coefficient; 59 | *FDR≤0.05. 60 |
61 |
62 | 63 |
64 |
65 |
66 |
67 | 71 |
72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /website/figure-2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | scRNA-seq paper - Figure 1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 |
18 | 19 | 20 | 21 |
22 |
23 | 24 | 25 | 26 |
27 |
28 | 29 |

scRNA-seq cis-eQTLs and co-expression QTLs

30 | 31 |

32 | This web page accompanies the manuscript titled
'Single-cell RNA sequencing identifies cell type-specific cis-eQTLs and co-expression QTLs. 33 | ', by van der Wijst et al, published in Nature Genetics.
34 | For further questions, contact the corresponding author: lude@ludesign.nl
35 |

36 |
37 |
38 |
39 | 40 |
41 |

< Back

42 |

Figure 2: Most significant co-expression QTL in the CD4+ T cells.

43 | 44 |
45 | 46 |
47 | Figure 2 - Most significant co-expression QTL in the CD4+ T cells. 48 | (a) The non-imputed expression of RPS26 and RPL21 of all individual CD4+ T cells colored by genotype (left panel) 49 | and stratified per SNP rs7297175 genotype (right panels). Genotype- and donor-specific regression lines are shown in the left and right panel, 50 | respectively. Each data point represents a single cell. (b) The Spearman’s rank correlation coefficient (r) between RPS26 and RPL21 expression 51 | stratified by SNP rs7297175 genotype in the CD4+ T cells per donor. Each data point represents a single donor. Box plots show the median, the 52 | first and third quartiles, and 1.5 times the interquartile range. (c) The imputed expression of RPS26 and RPL21 of all individual CD4+ T cells 53 | colored by genotype (left panel) and stratified per SNP rs7297175 genotype (right panels). Genotype- and donor-specific regression lines are 54 | shown in the left and right panel, respectively. Each data point represents a single cell. (d) The expression of RPS26 and RPL21 of whole blood 55 | bulk RNA-seq samples colored by SNP rs7297175 genotype. Genotype-specific regression lines are shown. Each data point represents a single bulk 56 | RNA-seq sample. 57 |
58 |
59 | 60 |
61 |
62 |
63 |
64 | 68 |
69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /website/img/erc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/website/img/erc.png -------------------------------------------------------------------------------- /website/img/figure_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/website/img/figure_1.png -------------------------------------------------------------------------------- /website/img/figure_1_tumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/website/img/figure_1_tumb.png -------------------------------------------------------------------------------- /website/img/figure_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/website/img/figure_2.png -------------------------------------------------------------------------------- /website/img/figure_2_tumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/website/img/figure_2_tumb.png -------------------------------------------------------------------------------- /website/img/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/website/img/github.png -------------------------------------------------------------------------------- /website/img/lifelines.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Fill 15 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /website/img/nwo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/website/img/nwo.jpg -------------------------------------------------------------------------------- /website/img/umcg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/website/img/umcg.jpg -------------------------------------------------------------------------------- /website/img/umcg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/molgenis/scRNA-seq/0c67180cb216ed8b82d39628f0961bd6ead2f094/website/img/umcg.png --------------------------------------------------------------------------------