Skip to content

Commit d0fc8af

Browse files
committed
small fixes
Merge branch 'main' of https://github.com/ncgr/DE-Bookdown # Conflicts: # packages.bib
2 parents 7cce8a8 + 2ac0111 commit d0fc8af

8 files changed

Lines changed: 86 additions & 28 deletions

File tree

‎.DS_Store‎

0 Bytes
Binary file not shown.

‎02.Rmd‎

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
2. Type the following on your command line, substituting in your username for <username>.
88

99
```
10-
ssh -p2310 <username>@inbre.ncgr.org
10+
ssh -p2311 <username>@inbre.ncgr.org
1111
```
1212

1313
3. Enter your password.
@@ -35,25 +35,33 @@ In a Finder window, you would see this:
3535

3636
### Find the shell in system you’ll use to log into the NCGR’s server
3737

38-
+ For **Windows**: search for MobaXterm from the start menu.
39-
+ It may be useful to drag the terminal icon to the **desktop** for easier access in the future.
38+
+ For **Windows**: search for MobaXterm from the start menu
39+
40+
+ For **Mac**: search for "terminal" using spotlight (the magnifying glass in the top right of your mac screen)
4041

41-
+ For **Mac**: search for "terminal" in the bar located in the Launchpad (rocket icon in the taskbar).
42-
+ It may be useful to drag the terminal icon into the **Dock** for easier access in the future.
4342

4443
### Log on to NCGR's server
4544

46-
Enter the following command to log on to logrus:
45+
+ For **Windows**:
46+
Click "Sessioins," then "SSH" button
47+
+ Remote host: username@inbre.ncgr.org
48+
+ Specify Username: username
49+
+ Port: 2311
50+
+ click ok
51+
52+
+ For **Mac**:
53+
54+
Enter the following command in the linux terminal to log on to the NCGR Server:
4755

4856
+ substitute **your** personal username in for "username"
4957

5058
```
51-
ssh -p2310 <username>@inbre.ncgr.org
59+
ssh -p2311 <username>@inbre.ncgr.org
5260
```
5361

5462
Notes:
5563

56-
+ Because we’re logging in remotely, the -p option is required to specify port 2310.
64+
+ Because we’re logging in remotely, the -p option is required to specify port 2311.
5765
+ If you’re prompted to confirm the connection, say "yes", then enter your password.
5866

5967
### Now that I logged on, where am I?
@@ -62,7 +70,7 @@ You’re at the command line interface of NCGR's analysis server!
6270

6371
To the left of the command prompt, you should see something like this:
6472

65-
+ agomez@metagenomics-2310:~$
73+
+ agomez@de-2311:~$
6674

6775
Command **output** is shown after the "##" in this document.
6876

@@ -309,7 +317,7 @@ touch scp_test.txt
309317
+ the last period means that the destination is your working directory
310318

311319
```
312-
scp -P 2310 <username>@inbre.ncgr.org:~/linuxc/scp_test.txt .
320+
scp -P 2311 <username>@inbre.ncgr.org:~/linuxc/scp_test.txt .
313321
```
314322

315323
Note: When you designate a port with secure copy (scp), you use a capital P.
@@ -322,7 +330,7 @@ You will be prompted for your NCGR Server password if not using MobaXterm.
322330
+ Again, run the scp command from your **local** terminal window:
323331

324332
```
325-
scp -P 2310 scp_test.txt <username>@inbre.ncgr.org:~/linuxc
333+
scp -P 2311 scp_test.txt <username>@inbre.ncgr.org:~/linuxc
326334
```
327335

328336
6) Check to see if the file you copied from your computer is on **the NCGR Server**!
@@ -376,7 +384,7 @@ If you can't execute commands, then CTRL c
376384
## ^C
377385
```
378386

379-
You should be returned to your prompt: username@metagenomics-2310:~/linuxc$
387+
You should be returned to your prompt: username@de-2311:~/linuxc$
380388

381389

382390
## Linux basics: Part II
@@ -386,7 +394,7 @@ You should be returned to your prompt: username@metagenomics-2310:~/linuxc$
386394
#### Syntax: ln -s FileYouWantToLink/PointTo NameYouWantToGiveIt{-}
387395

388396
```
389-
ln -s /home/data/metagenomics-2310/covid.fasta covid.fasta
397+
ln -s /home/data/de-2311/covid.fasta covid.fasta
390398
391399
ls -l
392400
```
@@ -484,7 +492,7 @@ cat covid.fasta | tail
484492
Fastq files contain sequence reads and associated **meta data**.
485493

486494
```
487-
ln -s /home/data/metagenomics-2310/SP1.fq
495+
ln -s /home/data/de-2311/SP1.fq
488496
489497
ls -ltr
490498
```
@@ -686,7 +694,7 @@ Powerful Z commands (zcat)
686694
Let’s copy another file:
687695

688696
```
689-
cp /home/data/metagenomics-2310/table1.txt.gz .
697+
cp /home/data/de-2311/table1.txt.gz .
690698
zcat table1.txt.gz
691699
692700
```
@@ -978,7 +986,7 @@ There is also cheat sheet on the weebly site under Supplemental Documents.
978986
2) Enter the following command to log on to the NCGR Server:
979987

980988
```
981-
ssh -p2310 <username>@inbre.ncgr.org
989+
ssh -p2311 <username>@inbre.ncgr.org
982990
```
983991

984992
+ Don't forget to substitute **your** personal username in

‎03QC.Rmd‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ OPTION 1:
2424
```{bash, eval=FALSE}
2525
source activate sra-tools
2626
27-
while read line; do fasterq-dump --outdir ./ ${line}; done < /home/elavelle/SRRlist.txt
27+
while read line; do fasterq-dump --outdir ./ ${line}; done < /home/elavelle/DGE_workshop/SRRlist.txt
2828
2929
```
3030

3131

3232
OPTION 2:
3333
```{bash, eval=FALSE}
34-
ln -s home/elavelle/DGE_workshop/reads/*.gz ./
34+
ln -s /home/elavelle/DGE_workshop/reads/*.gz ./
3535
```
3636

3737
## fastp QC
@@ -41,12 +41,16 @@ conda deactivate
4141
4242
source activate fastp
4343
44-
for file in SRR*; do fastp -w 10 -i ${file} -o ${file}.fastp.gz; done
44+
for file in SRR*; do fastp -w 10 -h ${file}.html -i ${file} -o ${file}.fastp.gz; done
4545
```
4646
This sort of messes up the extensions. Rename the files
4747

4848
```{bash, eval=FALSE}
4949
rename .gz.fastp.gz .fastp.gz *.gz
50+
51+
OR
52+
53+
while read line; do mv ${line}.fastq.gz.fastp.gz ${line}.fastq.fastp.gz; done < /home/elavelle/SRRlist.tx
5054
```
5155

5256
Download and view the .html report.
@@ -60,7 +64,7 @@ following example illustrates one use of this built-in variable.
6064

6165
Prints the line number of the first 10 lines
6266
```{bash, eval=FALSE}
63-
zcat SRR23869771.fastq.fastq.gz | awk '{print NR}' | head
67+
zcat SRR23869771.fastq.fastp.gz | awk '{print NR}' | head
6468
6569
```
6670
awk modulo arithmatic: The modulo operator, "%", returns the remainder of division. The expression

‎05Alignment.Rmd‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,18 @@ wget https://ftp.ncbi.nlm.nih.gov/genomes/refseq/vertebrate_mammalian/Mus_muscul
2626
Activate environment, and use HISAT2 to create indices. If time prohibits, we will likely need to terminate and softlink to output files.
2727

2828
```{bash, eval=FALSE}
29+
gunzip GCF_000001635.27_GRCm39_genomic.fna.gz
30+
2931
source activate hisat2
3032
3133
hisat2-build -p 10 GCF_000001635.27_GRCm39_genomic.fna GRCm39.index
3234
```
3335

34-
From the reads directory, run alignments
36+
Make the output directory, then, trom the reads directory, run alignments
3537

3638
```{bash, eval=FALSE}
39+
mkdir ~/DGE_workshop/alignments
40+
3741
for file in *.fastp.gz; do hisat2 -x /home/$USER/DGE_workshop/genome/GRCm39.index --threads 10 -U ${file} -S /home/$USER/DGE_workshop/alignments/${file}.sam; done
3842
```
3943

@@ -53,6 +57,9 @@ Some alignment tools (HISAT2 for example) will print alignment metrics after gen
5357
Change environments and use this statistics summarization command. It takes about a minute per sample.
5458

5559
```{bash, eval=FALSE}
60+
conda deactivate
61+
source activate samtools
62+
5663
samtools flagstat SRR23869771.fastq.fastp.gz.sam
5764
```
5865

@@ -96,6 +103,8 @@ Therefore, the number of primary alignments can also be found by:
96103
samtools view -F 0x904 -c SRR23869771.fastq.fastp.gz.sam
97104
```
98105

106+
Note that this is less than the total number of reads in our file. This operates in an "or" fashion. If we run the above command with "-f", it yields 0, because the postive search runs in an "and" fashion.
107+
99108
Exercise: Select another sample, and using any of the means above, determine 1) Total read count 2) Total mapped reads 3) Total primary alignments
100109

101110
## .sam/.bam conversion and alignment sorting
@@ -107,7 +116,11 @@ for file in *.sam; do samtools view -u ${file} | samtools sort -o ${file}.sorted
107116
Rename the output files
108117

109118
```{bash, eval=FALSE}
110-
rename .fastq.fastp.gz.sam.sorted .sorted.bam *.sorted
119+
rename .fastq.fastp.gz.sam.sorted .sorted.bam *.bam
120+
121+
or
122+
123+
file-rename -- 's/\.fastq.fastp.gz.sam.sorted$/.sorted.bam/' *.sorted
111124
```
112125

113126
Exercise: What average genome coverage do our primary alignments give us?

‎06Abundancy_Estimation.Rmd‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ Exercise: Which genome/annotation pair in the folder /home/elavelle/DGE_Virtual/
1515

1616
# Generate counts form the alignments directory.
1717

18+
Make sure the annotation is unzipped first.
19+
1820
```{bash, eval=FALSE}
21+
1922
source activate featurecounts
2023
21-
featureCounts -a ~/DGE_workshop/genome/GCF_000001635.27_GRCm39_genomic.gtf -o /home/$USER/DGE_workshop/count_matrix.tsv --largestOverlap -M --primary -T 10 -g gene *.bam
24+
featureCounts -a ~/DGE_workshop/genome/GCF_000001635.27_GRCm39_genomic.gff -o /home/$USER/DGE_workshop/count_matrix.tsv --largestOverlap -M --primary -T 10 -g gene *.bam
2225
```
2326

2427
FeatureCounts put in an extra row and some columns we want to get rid of before doing differential expression analysis.

‎07DGE.Rmd‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Sort our results table, and export a file with counts appended to it.
148148
```{R, eval=FALSE}
149149
stress_from_control_sorted <- stress_from_control[order(stress_from_control$padj),]
150150
151-
write.table(merge(as.data.frame(stress_from_control_sorted),as.data.frame(counts(dds,normalized=TRUE)), by="row.names"), row.names=TRUE, quote=FALSE, sep="\t", file="SfromC.tsv")
151+
write.table(merge(as.data.frame(stress_from_control_sorted),as.data.frame(counts(dds,normalized=TRUE)), by="row.names"), row.names=FALSE, quote=FALSE, sep="\t", file="SfromC.tsv")
152152
```
153153

154154
## Heatmap
@@ -185,12 +185,27 @@ dev.off()
185185
Camk2n1 is skewing the color palette. Let's make a version omitting it.
186186
```{R, eval=FALSE}
187187
pdf ("heatmapSigsMost.pdf")
188-
heatmap.2(plotCounts[-7,], col=hmcol, cexRow=0.8,
188+
heatmap.2(plotCounts[-5,], col=hmcol, cexRow=0.8,
189189
key.title = NA, scale="none", dendrogram="col",
190190
trace="none", density.info='none', cexCol=0.6, margin=c(6,10))
191191
dev.off()
192192
```
193193

194+
If we want the same decreasing order:
195+
```{R, eval=FALSE}
196+
# Sorts, removes Camk2n1
197+
sorted <- row.names(data.frame(sort(rowMeans(plotCounts), decreasing=TRUE)))[-1]
198+
# makes new dataframe with these indeces
199+
new_counts <- plotCounts[match(sorted, row.names(plotCounts)),]
200+
201+
pdf ("heatmapSigsMost.pdf")
202+
heatmap.2(new_counts, col=hmcol, cexRow=0.8,
203+
key.title = NA, scale="none", dendrogram="col",
204+
trace="none", density.info='none', cexCol=0.6, margin=c(6,10), Rowv=FALSE)
205+
dev.off()
206+
```
207+
208+
194209
![workflow](./Figures/heatmapSigsMost-1.png){width=100%}
195210

196211
Principal Component Analysis now.
@@ -211,6 +226,8 @@ aesthetic layers
211226
x-axis labels and jittering
212227

213228
```{R, eval=FALSE}
229+
libary('ggplot2')
230+
214231
for(k in 1:length(sigIndices)) {
215232
gene <- rownames(stress_from_control_sorted)[k]
216233
pval <- format(stress_from_control_sorted$padj[k], digits=4)

‎index.Rmd‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ _____
157157
Feedback Survey\
158158

159159
Logrus Access Request\
160+
160161
_____
161162

162163
<span style="color: forestgreen;">Green</span> text indicates hands-on sessions. Please note that the timing might shift slightly.

‎packages.bib‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,23 @@ @Manual{R-base
33
author = {{R Core Team}},
44
organization = {R Foundation for Statistical Computing},
55
address = {Vienna, Austria},
6+
<<<<<<< HEAD
67
year = {2020},
8+
=======
9+
year = {2022},
10+
>>>>>>> 2ac0111043520eeb6c18989debcc45a63bd62da7
711
url = {https://www.R-project.org/},
812
}
913

1014
@Manual{R-bookdown,
1115
title = {bookdown: Authoring Books and Technical Documents with R Markdown},
1216
author = {Yihui Xie},
1317
year = {2023},
18+
<<<<<<< HEAD
1419
note = {R package version 0.33},
20+
=======
21+
note = {R package version 0.32},
22+
>>>>>>> 2ac0111043520eeb6c18989debcc45a63bd62da7
1523
url = {https://CRAN.R-project.org/package=bookdown},
1624
}
1725

@@ -25,9 +33,13 @@ @Manual{R-knitr
2533

2634
@Manual{R-rmarkdown,
2735
title = {rmarkdown: Dynamic Documents for R},
28-
author = {JJ Allaire and Yihui Xie and Christophe Dervieux and Jonathan McPherson and Javier Luraschi and Kevin Ushey and Aron Atkins and Hadley Wickham and Joe Cheng and Winston Chang and Richard Iannone},
36+
author = {JJ Allaire and Yihui Xie and Jonathan McPherson and Javier Luraschi and Kevin Ushey and Aron Atkins and Hadley Wickham and Joe Cheng and Winston Chang and Richard Iannone},
2937
year = {2023},
38+
<<<<<<< HEAD
3039
note = {R package version 2.21},
40+
=======
41+
note = {R package version 2.20},
42+
>>>>>>> 2ac0111043520eeb6c18989debcc45a63bd62da7
3143
url = {https://CRAN.R-project.org/package=rmarkdown},
3244
}
3345

@@ -68,7 +80,7 @@ @Book{rmarkdown2018
6880
publisher = {Chapman and Hall/CRC},
6981
address = {Boca Raton, Florida},
7082
year = {2018},
71-
isbn = {9781138359338},
83+
note = {ISBN 9781138359338},
7284
url = {https://bookdown.org/yihui/rmarkdown},
7385
}
7486

@@ -78,7 +90,7 @@ @Book{rmarkdown2020
7890
publisher = {Chapman and Hall/CRC},
7991
address = {Boca Raton, Florida},
8092
year = {2020},
81-
isbn = {9780367563837},
93+
note = {ISBN 9780367563837},
8294
url = {https://bookdown.org/yihui/rmarkdown-cookbook},
8395
}
8496

0 commit comments

Comments
 (0)