---
# System prepended metadata

title: Project code

---

# Project code

## Getting to our puma folder

```cd /home/ecl243-07```
```cd puma```

## downloading admixture
```wget http://dalexander.github.io/admixture/binaries/admixture_linux-1.3.0.tar.gz```

## untar
```tar -zxvf admixture_linux-1.3.0.tar.gz```


## Running ADMIXTURE
`

Run ADXTURE with the .bed file
```
#!/bin/bash
#SBATCH --job-name=admixture
#SBATCH --nodes 1
#SBATCH --ntasks 1
#SBATCH --time 12:00:00
#SBATCH --mem=2GB
#SBATCH -o puma_admix_K2.out
#SBATCH --partition=ecl243
#SBATCH --error admix_errors.err
#SBATCH --mail-type=ALL
#SBATCH --mail-user=mgserrano@ucdavis.edu

/home/ecl243-07/bin/dist/admixture_linux-1.3.0/admixture --cv /home/ecl243-07/puma/pumabed.bed 2
```
## converting .ped to .bed
```
module load plink 
plink --file /home/ecl243-07/puma/pumaco2.ped --out /home/ecl243-07/puma/pumabed --make-bed --dog
```

## Download data from Farm
sftp -P 2022 user@farm.cse.ucdavis.edu
get /path/to/file

sftp -P 2022 ecl243-07@farm.cse.ucdavis.edu
get /home/ecl243-07/puma/pumabed.2.Q




## Making Graph
```
dat <-read.csv ("pumaQdata.csv", header=TRUE)

library (ggplot2)

q <- ggplot(dat, aes(fill = Ancestry, y = Percentage, x = Population)) + geom_bar(position = "stack", stat = "identity") + scale_fill_manual(values = c("mediumseagreen", "maroon4", "red", "orange2", "royalblue4", "honeydew4"))

q + theme(axis.text.x = element_text(angle = 90, hjust = 1))
p <- q + theme_classic()
p

```

### Changes made from Lauren's
```

dat <-read.csv ("pumaQdata.csv", header=TRUE)

library (ggplot2)

q <- ggplot(dat, aes(fill = "Ancestry", x = "Percentage", y = "Population")) + geom_bar(position = "stack", stat = "identity") + scale_fill_manual(values = c("mediumseagreen", "maroon4", "red", "orange2", "royalblue4", "honeydew4"))

q + theme(axis.text.x = element_text(angle = 90, hjust = 1))
p <- q + theme_classic()
p
```


### This one worked for me!! ###
```
tbl <- read.csv("pumaQdata.csv")

barplot(t(as.matrix(tbl)), col=rainbow(3),
          xlab="Individual #", ylab="Ancestry", border=NA)
```
The output was saved as a pdf file and edited with adobe illustrator.