Last data update: 2014.03.03

R: Extract a region and write it to a FASTA file
region.as.fasta-methodsR Documentation

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 signature '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


#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")

Results