Learn R Programming

PopGenome (version 2.7.2)

region.as.fasta-methods: Extract a region and write it to a FASTA file

Description

This generic function writes a FASTA file of the observed biallelic positions to the current workspace.

Usage

# S4 method for GENOME
region.as.fasta(object,region.id=FALSE,filename=FALSE,type=1,ref.chr=FALSE)

Arguments

object

an object of class "GENOME"

region.id

region of the genome

filename

name of the FASTA file

type

1: extract SNPs; 2: extract all nucleotides

ref.chr

reference sequence

Details

In case of type=2 we recommend to use the function splitting.data(,positions=list( ... ), type=2) before and apply the region.as.fasta() to this splitted object afterwards. The type=1 method will write a FASTA file including only the biallelic.sites. region.id is the the region number specified in the PopGenome class GENOME.

Examples

Run this code
# NOT RUN {
#GENOME.class       <- readSNP("Arabidopsis",CHR=1)
# split the data into the genmic positions 100 to 2000
#GENOME.class.split <- splitting.data(GENOME.class, positions=list(100:2000),type=2)
#GENOME.class.split@region.names
#region.as.fasta(GENOME.class.split,1,"my_fasta_file.fas",type=2, ref.chr="chrom1.fas")

# }

Run the code above in your browser using DataLab