• Stars
    star
    109
  • Rank 319,077 (Top 7 %)
  • Language
    HTML
  • License
    MIT License
  • Created over 1 year ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Growing collection of scripts to summarize the scientific literature using large-language models like ChatGPT.

License

This repository contains basic scripts designed to investigate scientific publication PDFs utilizing the ChatGPT API. It has been created to share helpful code for navigating the literature. Please note that this code is experimental. We encourage others to test it, and if you find it useful, feel free to share your feedback with us.

Installing

  1. You first need to create your conda environment as :

conda create --name <your_env_name> python=3.10

  1. Then activate it:

conda activate <your_env_name>

  1. Install the package

pip install .

  1. We rely on the adjustText library for positioning labels that currently only work from the master branch so install it using:

pip install https://github.com/Phlya/adjustText/archive/master.zip

  1. Go the script folder:

cd scripts

  1. Copy your openAi API key in the .env file. You can find this here: https://platform.openai.com/account/api-keys

Running scripts

This package contains a list of classes to facilitate exploring the litterature using Large Language Models. Currently, we are focusing on OpenAI API but we plan to extend in the future. Classes are documented and tested but we recommend using our scripts first (in the script/ folder). Those scripts were designed to be simple to use and facilitate growing a local database of publication data.

  1. First, after installing, go the script folder:

cd scripts

  1. You can use 3 scripts currently.
  • The first one is ran using

python pdf_summary.py --path_pdf <path_to_your_pdf> --save_summary True

This will save a little text file along with your pdf with the same filename but with a .txt extension.

  • The second one is ran using

python list_pdfs_embedding.py --path_folder <path_to_your_pdfs> --database_path <path_to_a_folder>

The embedding is saved automatically in the folder with all your pdfs as tsne_embeddings.png. Currently this plot uses the filename of each pdf to assign a label.

  • The third one is ran using

python pubmed_embedding.py --pubmed_query "your query" --field abstract --save_path <path_to_a_png_file> --database_path <path_to_a_folder>

Althought database_path is optional, we highly recommend choosing a folder on your local hard drive to store your paper database. This will limit calls to the Large Language Models and save you time. Papers embedding could scale to thousands of papers eventually if you process your entire litterature.

Parameters for pdf_summary

  • --path_pdf: Path to a PDF file that you want to summarize.

Type: string

Default: os.path.join(script_path, '../example/2020.12.15.422967v4.full.pdf')

  • --save_summary: Save the generated summary in a txt file alongside the PDF file.

Type: boolean

Default: True

  • --save_raw_text: Save the raw text in a txt file along the pdf file.

Type: boolean

Default: True

  • --cut_bibliography: Try not to summarize the bibliography at the end of the PDF file.

Type: boolean

Default: True

  • --chunk_length: Determines the final length of the summary by summarizing the document in chunks. More chunks result in a longer summary but may lead to inconsistency across sections. Typically, 1 is a good value for an abstract, and 2 or 3 for more detailed summaries.

Type: integer

Default: 1

  • --database_path: Path to the database file. This is an optional argument. If path is not provided, no database will be used or created. If the path is provided, the database will be created if it does not exist. If it exists, it will be loaded and used. Use this to grow your database of papers.

Type: str

Default: None

Parameters for pubmed_embedding

  • --pubmed_query: A query made to pubmed. This can return a very large number of publications and they will be processed up to max_results.

Type: str

Default: None

  • --field: You can embed the title or the abstract currently. Just give 'title' or 'abstract'. Your choice here will depends on how much details you want your embedding to rely on.

Type: str

Default: abstract

  • --database_path: Path to the database file. This is an optional argument. If path is not provided, no database will be used or created. If the path is provided, the database will be created if it does not exist. If it exists, it will be loaded and used. Use this to grow your database of papers.

Type: str

Default: None

  • --save_path: Path to a local image file. This is where the plot will be saved.

Type: str

Default: None

  • --perplexity: Perplexity for the t-SNE plot, default is 8. Higher values will make the plot more spread out. Lower values will make the plot more clustered.

Type: int

Default: 8

  • --max_results: Maximum number of results to fetch from pubmed

Type: int

Default: 100

Examples

  • paper_summary

See the example/ folder for example runs. There is a typical short example (length of a typical abstract) and a long summary (using chunk_length 4).

  • list_pdfs_embedding

Here is an example embedding for approximately 100 publications, mostly around in vivo calcium imaging of neuronal activity.

Example embedding

  • pubmed_embedding

Here is an example embedding for the following command: python pubmed_embedding.py --pubmed_query "In vivo two photon voltage imaging" --field abstract --save_path ../example/twophotonvoltage.html --perplexity 5

Below is a screenshot. The generated plot is interactive to explore the content of each paper. Download the html on your machine and open in a browser. Example embedding

Here is an second embedding for the following command for a very large number of paper: python pubmed_embedding.py --pubmed_query "Mouse visual cortex" --field abstract --save_path ../example/mouse_invivo_recordings.html --max_result 3500 --perplexity 30

Below is a screenshot. The generated plot is interactive to explore the content of each paper. Download the html on your machine and open in a browser. Example embedding

Database

The papers_extractor utilizes a straightforward database created with the DiskCache Python package. By specifying the database_path, the module will handle everything for you. Its purpose is to compile a collection of papers, complete with statistics and numerical embeddings. Additionally, it automatically regulates the number of calls made to LLM APIs, effectively reducing costs. Any previously processed pdf is automatically cached. To determine if a pdf was previously processed, it uses a hash from the content of the pdf, so you can freely rename them.

You can store your database (or several) at any location on your local drive using the database_path parameter.

How to contribute?

  1. First go to tests/ and read the README.md

  2. Make a PR against main. This will run CI through github actions.

Credits

This repository was started by Jerome Lecoq on April 12th 2023. Please reach out [email protected] for any questions. If this is useful to you, πŸ‘‹ are welcome!

More Repositories

1

AllenSDK

code for reading and processing Allen Institute for Brain Science data
Jupyter Notebook
340
star
2

bmtk

Brain Modeling Toolkit
Python
269
star
3

deepinterpolation

Python
207
star
4

scrattch.hicat

Hierarchical, iterative clustering for analysis of transcriptomics data in R
HTML
105
star
5

ecephys_spike_sorting

Modules for processing extracellular electrophysiology data from Neuropixels probes
Python
105
star
6

openscope_databook

OpenScope databook: a collaborative, versioned, data-centric collection of foundational analyses for reproducible systems neuroscience πŸπŸ§ πŸ”¬πŸ–₯οΈπŸ“ˆ
Python
63
star
7

sonata

Collaboration between BBP and AIBS
Python
53
star
8

abc_atlas_access

Documentation and examples demonstrating how to access data from the Allen Brain Cell Atlas
Jupyter Notebook
49
star
9

aics-segmentation

AICS Segmentation (One-Way) Mirror
Jupyter Notebook
44
star
10

mouse_connectivity_models

Python package providing mesoscale connectivity models for mouse.
Python
39
star
11

neuroglia

a Python machine learning library for neurophysiology data
Python
36
star
12

cocoframer

COmmon COordinate FRAMEwork in R
R
35
star
13

MicronsBinder

A collection of notebooks to provide examples of using Microns-explorer.org datasets
Jupyter Notebook
33
star
14

scrattch

Single cell RNA-seq analysis for transcriptomic type characterization
R
30
star
15

aics-ml-segmentation

AICS ML Segmentation (One-Way) Mirror
Python
26
star
16

ipfx

computes intrinsic cell features from intracellular electrophysiology data
Python
24
star
17

brain_observatory_examples

Gallery of visualizations and analyses of the Allen Brain Observatory
Jupyter Notebook
24
star
18

tasic2018analysis

Scripts related to VISp and ALM scRNA-seq and FISH analysis for Tasic, et al., 2018.
R
24
star
19

scrattch.vis

scRNA-seq data visualization from scrattch
R
24
star
20

argschema

This python module simplifies the development of modules that would like to define and check a particular set of input parameters, but be able to flexibly define those inputs in different ways in different contexts.
Python
24
star
21

MTG_celltypes

Human cortical cell types
R
23
star
22

SWDB_2019

Repository for course materials for the Summer Workshop on the Dynamic Brain 2019
HTML
23
star
23

visual_behavior_analysis

Python package for analyzing behavioral data for Brain Observatory: Visual Behavior
Jupyter Notebook
22
star
24

MIES

Multichannel Igor Electrophysiology Suite
IGOR Pro
22
star
25

BICCN_M1_Evo

Analysis for BICCN cross-species primary motor cortex project
Jupyter Notebook
22
star
26

SWDB_2018

Course materials for the 2018 Summer Workshop on the Dynamic Brain
Jupyter Notebook
22
star
27

swdb_2022

Repository to host materials for the summer workshop on the dynamic brain
Jupyter Notebook
21
star
28

dipde

Numerical solver for coupled population density equations
Python
21
star
29

neuron_morphology

Tools for working with single-neuron morphological reconstructions
Python
19
star
30

cell_type_mapper

Repository for storing prototype functionality implementations for the BKP
Python
18
star
31

AIBSOPT

Optical projection tomography microscope for isotropic whole-brain imaging
Python
15
star
32

All-active-Workflow

Creating the code base for All-active Model generation written on top of Bluepyopt
Python
15
star
33

patchseqtools

QC and cell type assignment for patch-seq transcriptomics data
HTML
15
star
34

biophys_optimize

Optimization of single-cell biophysically detailed models
Python
15
star
35

asap-modules

Shared repo for EM connectomics and Array Tomography render based image processing modules
Python
14
star
36

visual_coding_2p_analysis

Visual Coding 2P analysis code
Python
14
star
37

NucCellTypes

HTML
13
star
38

drcme

Dimensionality-reduction and classification for morphology and electrophysiology
Python
12
star
39

MouseBrainHierarchy

Python
12
star
40

allensdk.eye_tracking

Allen Institute mouse eye tracker.
Python
12
star
41

octoDAC

8 channel analog output shield for Arduino Uno
C++
12
star
42

nomenclature

This repository contains code to generate standardized cell type nomenclature from an R "dendrogram".
HTML
12
star
43

scrattch.io

Functions for handling RNA-seq files and formats as input and output for scrattch functions.
R
11
star
44

mfishtools

Building Gene Sets and Mapping mFISH Data
HTML
11
star
45

SWDB_2017

course materials for the 2017 Summer Workshop on the Dynamic Brain
HTML
11
star
46

aifi-swanson-teaseq

Code related to Swanson, et. al. for TEA-seq, ICICLE-seq, and scATAC-seq data processing, analysis, and visualization
R
11
star
47

ophys_etl_pipelines

Pipelines and modules for processing optical physiology data
Python
9
star
48

scrattch.bigcat

iterative clustering pipeline of big single cell datasets.
R
9
star
49

tasic2016data

Single cell transcriptomic data from Tasic, et al. (2016)
R
9
star
50

ZeroMQ-XOP

The ZeroMQ XOP enables Igor Pro to interface over the network using a ZeroMQ messaging layer and JSON as message format
C
9
star
51

nwb-api

HTML
8
star
52

open_dataset_tools

Tools for accessing open data sets published by the Allen Institute for Brain Sciences
Jupyter Notebook
8
star
53

pytic

PyTic - An Object-Oriented Python Wrapper for Pololu Tic Stepper Drivers
Python
8
star
54

All-active-Manuscript

Code for reproducing the figures presented in: Single-neuron models linking electrophysiology, morphology and transcriptomics across cortical cell types
Jupyter Notebook
8
star
55

swdb_2017_tools

A collaborative Python package built by participants of the Summer Workshop on the Dynamic Brain
Jupyter Notebook
8
star
56

ImageryClient

Publication-ready visualization of overlays of imagery and segmentation from cloudvolume data
Python
8
star
57

coupledAE-patchseq

Multimodal data alignment and cell type analysis with coupled autoencoders.
Jupyter Notebook
8
star
58

piTEAM

Parallel Imaging Pipeline Using Transmission Electron Automated Microscopes (piTEAM)
8
star
59

scrattch.mapping

Genearlized mapping scripts for RNA-seq and Patch-seq data
R
8
star
60

aics-automated-cell-culture-workflow

Venus method files in the β€œ.pkg” format for the Semi Automated Passaging, Seeding and Maintenance, of the Allen cell collection of hiPSC lines expressing green fluorescent protein tagged to protein identifying specific cellular organelles and structures.
8
star
61

pcg_skel

Robust skeletonization of PyChunkedGraph-backed objects
Python
7
star
62

render-python

A python interface for render
Python
7
star
63

GLIF_Teeter_et_al_2018

Analysis code for Teeter et al 2018 Nature Communications Manuscript
Python
6
star
64

coupledAE

Repository for NeurIPS 2019 paper
Jupyter Notebook
6
star
65

neuropixels_platform_paper

Code used to generate figures for Siegle, Jia et al. (2019)
Jupyter Notebook
6
star
66

U-DAGAN

Unsupervised data augmentation using GANs.
Python
6
star
67

3D-atlas-reverse-mapping

This repository contains a Jupyter Notebook that demonstrates the reverse mapping of the 3D atlas onto an imaged section.
Jupyter Notebook
5
star
68

swdb_2019_student

A repository for student code for the 2019 Summer Workshop on the Dynamic Brain
Jupyter Notebook
5
star
69

arkhipov2018_layer4

Modeling code related to Arkhipov 2018 publication
Python
5
star
70

stpt_registration

STPT registration methods
C++
5
star
71

CCF_Tutorial

Jupyter Notebook
5
star
72

swdb_2021

Jupyter Notebook
5
star
73

patchseq_human_L23

Code for reproducing the analyses presented in "Human cortical expansion involves diversification and specialization of supragranular intratelencephalic-projecting neurons".
HTML
5
star
74

DashDataFrame

An simplified interface for making dash apps to explore multi-dimensional dataframes with custom link integration and filtering.
Python
5
star
75

L5_VEN

This repository contains code for reproducing the analysis of snRNA-seq data from human fronto-insula
R
5
star
76

CCFv3_Volumetric_Analysis

Scripts for measuring surface area and volumes of structures in both the reference and original spaces.
Python
5
star
77

OFS-EM-Connectomics

Code and data for the 2021 Open for Science tutorial for EM connectomics.
Jupyter Notebook
5
star
78

human_cross_areal

Human cellular diversity across cortex
Jupyter Notebook
4
star
79

CNS_2021

Resources for Allen Instutite tutorials presented at CNS 2021
Jupyter Notebook
4
star
80

deepinterpolation_nextflow

Python
4
star
81

em_coregistration

align a 3D data set to another
Python
4
star
82

croissant

Classifying regions of interest in mouse brain as cell or not cell
Python
4
star
83

ephys_pink_noise

Creates the pink noise stimuli used in the noise1, noise2, and ramp to rheo stimulus used in the Allen Institute for Brain Science electrophysiology pipeline.
Python
4
star
84

em_stitch

EM microscopy lens correction
Python
4
star
85

neuropixels_protocol_resources

Notebooks and design files for Allen Brain Observatory experimental procedures
Jupyter Notebook
4
star
86

bmtk-workshop

Jupyter Notebook
4
star
87

Great_Ape_MTG

snRNA-seq of temporal cortex in great apes
Jupyter Notebook
4
star
88

brain_observatory_utilities

A repository for analysis tools for data available from the AllenSDK
Jupyter Notebook
4
star
89

skeleton_plot

tools for plotting swc and meshparty skeletons
Jupyter Notebook
3
star
90

deepinterpolation_paper

Python
3
star
91

Guidebook

Python
3
star
92

GLIFS_ASC

GLIFS plus after spike currents
Python
3
star
93

patchseq_human_L1

supporting data and code for human L1 patchSeq manuscript
Jupyter Notebook
3
star
94

jem

Repository containing JEM (JSON Electrophysiology Metadata), a web-form for logging metadata during slice electrophysiology experiments.
HTML
3
star
95

ophys_nway_matching

Python
3
star
96

cortical_coordinates

Code and scripts for used in the generation of cortical streamlines and coordinates for the Allen CCF
C++
3
star
97

Contrast_Analysis

Python
3
star
98

BigFeta

Big FeaTure Aligner: a scalable solution for feature alignment
Python
3
star
99

PeptidergicNetworks

Repository for Smith et al. 2019
R
3
star
100

bonsai_workflows

A collection of bonsai workflows developed at the Allen Institute
Jupyter Notebook
3
star