### Assigning sequences in R Source: https://github.com/kvanderwaal/prrsv2_classification/blob/main/README.md Uses a pre-trained random forest model to classify sequences from a FASTA file. Requires the adegenet, caret, and randomForest packages. ```r #instal required packages #install.packages("adegenet","caret","randomForest") #load functions for making the predictions. source(url("https://github.com/kvanderwaal/prrsv2_classification/raw/main/rf10v.predict.fun.R")) #load the model load(url("https://github.com/kvanderwaal/prrsv2_classification/raw/main/model.Rdata")) #note, if you would like to predict lineages/sub-lineages instead of variants, you can load this model instead. #lineages/sub-lineages reflect Paploski et al. 2021 (Vaccines: https://dx.doi.org/10.3201/eid2208.160496) and Yim-im et al. 2023 (Microbiology Spectrum: https://dx.doi.org/10.1128/spectrum.02916-23) #load(url("https://github.com/kvanderwaal/prrsv2_classification/raw/main/model.rf10v.new.lin.11.2023.Rdata")) #load alignment file (should be in your working directory). align.ex <- read.alignment("sequences.example.fasta",format="fasta") #An example sequence file is available for download from Github, and should be placed in your working directory. This should be replaced with your own .fasta file #make the assigments out <- make.predict(al.new=align.ex) #write the assigments to a file. This file will appear in your working directory write.csv(out,file="out.csv") #view the assignments head(out) #> SequenceName assign.final assign.top prob.top assign.2 #> ex1 ex1 1A-unclassified 1A.19 0.404 1A-unclassified #> ex2 ex2 1A.14 1A.14 0.998 1A.38 #> ex3 ex3 1A-unclassified 1A-unclassified 0.942 1A.32 #> ex4 ex4 5A.1 5A.1 0.982 5B-unclassified #> ex5 ex5 1A.5 1A.5 1.000 #> ex6 ex6 1H.4 1H.4 0.986 1H.17 #> prob.2 num.gaps.amb #> ex1 0.316 0 #> ex2 0.002 0 #> ex3 0.046 0 #> ex4 0.006 0 #> ex5 0.000 0 #> ex6 0.004 0 ``` -------------------------------- ### Assigning sequences in Python Source: https://github.com/kvanderwaal/prrsv2_classification/blob/main/README.md Executes the classification script via terminal. Requires Python 3 and specific libraries including Pandas, Numpy, Biopython, SKOPS, and Requests. ```bash usage: python3 finalPRRSVclass.py [-h] -s SEQALI -o OUT options: -h, --help Show this help message and exit -s, --seqali PRRSV-2 multiple sequence alignment with length of 603 nt in FASTA format -o, --out Name or full path of classification report in .csv format ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.