---
# System prepended metadata

title: Genome Assembly in Julia

---

# Genome Assembly in Julia
Started on August 25 (Week 3 - Assembly pt. 2)
https://biojulia.net/GenomeGraphs.jl/v0.1/man/guide/

Software for making genome graphs
http://rrwick.github.io/Bandage/
If you're installing on a Mac, you may receive a warning stating that Bandage 'can't be opened because it is from an unidentified developer. 'Right click on the file and select 'Open' to override this warning (for more installation information, including buiding from source, look through the README in the Bandage repository on Github linked above).

1. Create new directory and put 2 trimmed files [from last session](https://hackmd.io/@NFpEogXySTuWExLvDQQHig/H1NojYYMw) into directory
    - SRR2584863_1.trim.fastq
    - SRR2584863_2.trim.fastq
     - Copies of these files exist on the CRC, if you're already working in the CRC you can use the following command to copy them to your working directory: 
        ```
        cp /tmp/ND_ICG_AUG_24/* .
        ```
    - If you need to transfer from the CRC to your local machine, use the ```scp``` command.
    - Example if you have already made these files:
```scp <netid>@crcfe01.crc.nd.edu:path/to/files/*.trim.* . ```
or if you need the copies:
```scp <netid>@crcfe01.crc.nd.edu:/tmp/ND_ICG_AUG_24/* .```

2. Once you have the files in your working directory, start Julia
    - on CRC:
```module load julia```
```julia```
    - on local machine:
```julia```

:::info
The way you start Julia will differ according to your preferences as time goes on - there are a lot of ways and (generally) they're fine for our purposes. Note that in the **[textbook recommended for this course](https://benlauwens.github.io/ThinkJulia.jl/latest/book.html)**, there's a suggestion to use JuliaBox, which it seems has been deprecated. 
:::

Installation of the julia package Genome Graphs 

? for help
]? for package help 
Use the ```]``` key to enter package mode
(you should see the prompt change from ```julia>``` to ```pkg>``` )

```add GenomeGraphs```
^C to exit package mode (control+c)
```using GenomeGraphs```  to load package
Define variable/data structure:
```
ws = WorkSpace()

fwq = open(FASTQ.REader, "SRR2584863_1.trim.fastq")
rvq = open(FASTQ.Reader, "SRR2584863_2.trim.fastq")

Pkg.add("FASTX")
Pkg.add("ReadDatastores")
using FASTX
using ReadDatastores

ds = PairedReads{DNAAlphabet{4}}(fwq, rvq, "ecoli-test-paired", "my-ecoli-test", 75, 400, 0, FwRv)
# ds = PairedReads(fwq, rvq, "ecoli-test-paired", "my-ecoli", 250, 300, 0, FwRv)

add_paired_reads!(ws,ds)

dbg!(ws, BigDNAMer{27}, 10, Symbol("my-ecoli-test"))

remove_tips!(ws, 200)
```

---

ended here 8/25 to have discussion of final project abstracts

---
8/27 
https://biojulia.net/GenomicFeatures.jl/latest/io/gff3
Start with new directory 
copy files from temp folder to working direcotry 
/tmp/ND_ICG)2020_AUG_27/* 
```
scp <netid>@crcfe01.crc.nd.edu:/tmp/ND_ICG_2020_AUG_27/TE_2.gtf .
scp <netid>@crcfe01.crc.nd.edu:/tmp/ND_ICG_2020_AUG_27/PA42_TE.gff3 .
start julia 
]
add GenomicFeatures
^+c (to exit package manager)
using GenomicFeatures
]
add GFF3
^+c
using GFF3
reader = open(GFF3.Reader,"PA42_TE.gff3")
 
#side note re: julia environment
#pwd()   -will print your working directory
#cd(“change/to/directory”) 
#cd(readdir,"/tmp/") - temporarily use files/access files in another directory
#

#example for loop
for record in reader
    # do something on Record
    seqid - GFF3.seqid(reader)
    #...
end
#working example
for record in reader
    println(record)
end


```



Julia script on crc
```
#!/usr/bin/env julia
using <library>
# getopts - get files into script (hard coding won't work for class)
```
Another way:
```
#!/bin/bash
# -*- mode: julia -*-
#=
exec julia --color=yes --startup-file=no -e "include(popfirst!(ARGS))" "${BASH_SOURCE[0]}" "$@"
=#
```