csv2Fasta: Convert a CSV or dataframe with sequences in a column into a...

View source: R/csv2Fasta.R

csv2FastaR Documentation

Convert a CSV or dataframe with sequences in a column into a fasta

Description

Convert a CSV or dataframe with sequences in a column into a fasta file

Usage

csv2Fasta(input_csv, output_fasta="mysequences.fasta", external=TRUE,seqID="Genus",seq="sequence") 

Arguments

input_csv

The path to a csv file or the name of a dataframe in memory from which to extract the sequences and header

output_fasta

The name for your new fasta file

external

Whether or not input_csv is a path to an external file. Default is TRUE. Use FALSE if you wish to run this function on a dataframe

seqID

The name of the column that contains the names to use as headers for your fasta

seq

The name of the column that contains the sequences

Value

Returns a fasta in the working directory

Author(s)

Alex Dornburg, dornburgalex@gmail.com

Examples

all_summaries <- compile_busco_summaries(folder_path)

csv2Fasta(input_csv="Path/to/your/file.fasta", output_fasta="mysequences.fasta", external=TRUE,seqID="Genus",seq="sequence")

#or if internal and you need to filter by an identifier and combine a bunch of things to make a header (Genus, species, accession in this example)

dataframe 
  	filter(Class== "targetTaxonomicRank") 
    mutate(fasta_id = paste0(">", genus, "_", species, "_", accession))
csv2Fasta(input_csv=dataframe, output_fasta="mysequences.fasta", external=FALSE,seqID="fasta_id",seq="sequence")


carolinafishes/toast documentation built on Dec. 19, 2024, 12:47 a.m.