You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/1_pipeline_setup/2_database.md
+33-14Lines changed: 33 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,31 +7,50 @@ parent: Pipeline Setup
7
7
8
8
## Part II: Database Preparation
9
9
10
-
In addition to the tools and dependencies, you will also need to prepare **databases for reference genomes**which will be used in alignment, quantification and QC assessment.
10
+
In addition to installiing the necessary tools and dependencies, you will also need to prepare **reference genome databases**for use in alignment, quantification and QC assessment.
11
11
12
-
In this pipeline, we manage the databases in **one database per reference genome** manner. Below is an overview of database preparation (use hg38 as an example):
12
+
For this pipeline, each reference genome assembly has its own dedicated database folder. Below is an overview of the database preparation process and key inputs and outputs of each step:
13
13
14
14

15
15
16
16
1.**Data collection**
17
17
18
-
There are **FOUR** files required in dataset preparation, and three of them can be directly downloaded from websites:
18
+
There are **FOUR** files required for database preparation. Three of them can be directly downloaded from online resources:
19
19
20
-
-**<u>*annotation.gtf*</u>**: **Gene Annotation file in [GTF](https://biocorecrg.github.io/PhD_course_genomics_format_2021/gtf_format.html) (Gene Transfer Format) format**
20
+
-**<u>*annotation.gtf*</u>**: Gene Annotation file in [GTF](https://biocorecrg.github.io/PhD_course_genomics_format_2021/gtf_format.html) (Gene Transfer Format) format.
21
21
22
+
-***<u>transcriptome.fa</u>***: Transcriptome sequence file in [FASTA](https://www.ncbi.nlm.nih.gov/genbank/fastaformat/) format
22
23
23
-
-***<u>transcriptome.fa</u>***: **Transcriptome sequence file in [FASTA](https://www.ncbi.nlm.nih.gov/genbank/fastaformat/) format**
24
+
-***<u>genome.fa</u>***: Genome sequence file in [FASTA](https://www.ncbi.nlm.nih.gov/genbank/fastaformat/) format
24
25
25
-
-***<u>genome.fa</u>***: **Genome sequence file in [FASTA](https://www.ncbi.nlm.nih.gov/genbank/fastaformat/) format**
26
+
```bash
27
+
# locate to your conda env, change the path accordingly
28
+
cd /research_jude/rgs01_jude/groups/yu3grp/projects/software_JY/yu3grp/conda_env/bulkRNAseq_2025
29
+
30
+
# create and change to the database folder
31
+
mkdir -p pipeline/databases/hg38/gencode.release48 # for annotation release 48 for hg38
32
+
cd pipeline/databases/hg38/gencode.release48
33
+
34
+
# download the three files from https://www.gencodegenes.org/human/release_48.html
***<u>NOTE:</u>*** For human and mouse, we recommend [GENCODE](https://www.gencodegenes.org/)to download them, while for other species, we recommend[Ensembl](https://useast.ensembl.org/info/data/ftp/index.html).
48
+
***<u>NOTE:</u>*** For the three files listed above, we recommend downloading them from [GENCODE](https://www.gencodegenes.org/) for human and mouse. For other species, we suggest using [Ensembl](https://useast.ensembl.org/info/data/ftp/index.html).
28
49
29
50
- ***<u>HouseKeeping gene list</u>***: the housekeeping genes defined by [this study](https://www.sciencedirect.com/science/article/pii/S0168952513000899?via%3Dihub) (N = 3804).
30
51
31
-
52
+
***<u>NOTE:</u>*** For human, the list of housekeeping genes can be downloaded [here](https://github.com/jyyulab/bulkRNAseq_quantification_pipeline/blob/main/databases/housekeepingGenes_human.txt). For other species, you can generate the housekeeping gene list by gene homology conversion using BiomaRt or other tools. Below is the codes we used to generate the housekeeping genes for mouse (avaibale [here](https://github.com/jyyulab/bulkRNAseq_quantification_pipeline/blob/main/databases/housekeepingGenes_mouse.txt)):
32
53
33
-
***<u>NOTE:</u>*** For human, the housekeeping genes can be downloaded [here](https://github.com/jyyulab/bulkRNAseq_quantification_pipeline/blob/main/databases/housekeepingGenes_human.txt); While for other species, you can generate the housekeeping gene list by gene homology conversion using BiomaRt or other tools. Below is the codes I used to generate the housekeeping genes in mouse (avaibale [here](https://github.com/jyyulab/bulkRNAseq_quantification_pipeline/blob/main/databases/housekeepingGenes_mouse.txt)):
34
-
35
54
``` R
36
55
library(NetBID2)
37
56
@@ -47,12 +66,12 @@ In this pipeline, we manage the databases in **one database per reference genome
- **`annotation.gene2transcript.txt`**&**`annotation.transcript2gene.txt`**: These files provide mappings between transcripts and genes, which are necessary for gene-level quantification.
72
+
- **`annotation.geneAnnotation.txt`**&**`annotation.transcriptAnnotation.txt`**: These files contain detailed annotations forgenes and transcripts, and are usedingenerating the final gene expression matrix.
## We take the longest transcript to present each gene. The genes of which the longest transcript is less than 300nt were excluded.
8
+
9
+
if (@ARGV == 3) {
10
+
if (-e$ARGV[0]) { unless ($ARGV[0] =~ /\.fa$/ig) { print"ERROR: The transcriptome sequence file, $ARGV[0], must be in FASTA format, and the file name much be ended with '.fa'.\n"; die; }
11
+
} else { print"ERROR: The transcriptome sequence file, $ARGV[0], doesn't exist. Please check and retry.\n"; die; }
12
+
unless (-e$ARGV[1]) { print"ERROR: The housekeeping gene file, $ARGV[1], doesn't exist. Please check and retry.\n"; die; }
13
+
unless (-d$ARGV[2]) { print"The output directory, $ARGV[2], doesn't exist. We are generating it...\n"; make_path($ARGV[2]); }
14
+
} else {
15
+
print"ERROR: Please use THREE arguments to specify 1) transcriptome sequence file, 2) housekeeping gene file, 3) directory to save output files, respectively.\n\n\tperl prepareBins.pl xxx.transcripts.fa housekeeping_genes.xxx.txt ./bulkRNAseq/genebodyBins\n\n"; die;
16
+
}
17
+
18
+
my$input_gtf = $ARGV[0];
19
+
my$input_hk = $ARGV[1];
20
+
my$outout_dir = $ARGV[2];
21
+
22
+
open (REF, $input_gtf) ordie;
23
+
print"We are paring $input_gtf ...\n";
24
+
my%ref = ();
25
+
while (<REF>) {
26
+
chomp;
27
+
nextunless ($_ =~ /^>ENS/);
28
+
my@F = split(/\|/, $_);
29
+
nextif ($F[6] < 300);
30
+
$F[0] =~ /^>(.+)/; my$isoform = $1;
31
+
if (exists$ref{$F[5]}) {
32
+
formy$x (sortkeys %{$ref{$F[5]}}) {
33
+
if ($ref{$F[5]}{$x} > $F[6]) {
34
+
next;
35
+
}
36
+
else {
37
+
delete$ref{$F[5]}{$x};
38
+
$ref{$F[5]}{$isoform} = $F[6];
39
+
}
40
+
}
41
+
}
42
+
else {
43
+
$ref{$F[5]}{$isoform} = $F[6];
44
+
}
45
+
}
46
+
close REF;
47
+
48
+
my%hk_genes = ();
49
+
open (HK, $input_hk) ordie;
50
+
print"We are collecting housekeeping genes from $input_hk ...\n";
51
+
while (<HK>) {
52
+
chomp;
53
+
nextif ($_ =~ /^#/);
54
+
my@HK = split(/\t/, $_);
55
+
$hk_genes{$HK[0]}++;
56
+
}
57
+
close HK;
58
+
59
+
open (OUT1, "> $outout_dir/genebodyBins_all.txt") ordie;
60
+
open (OUT2, "> $outout_dir/genebodyBins_housekeeping.txt") ordie;
print"ERROR: The INPUT file doesn't exist. Please check and retry.\n"; die;
9
+
}
10
+
} elsif (@ARGV < 1) {
11
+
print"ERROR: Please specify the gene annotation file to parse!\n\n\tperl parseAnnotation.pl xxx.annotation.gtf\n\n"; die;
12
+
} else {
13
+
print"ERROR: Please use only ONE argument which specifies the gene annotation file to parse!\n\n\tperl parseAnnotation.pl xxx.annotation.gtf\n\n"; die;
0 commit comments