[R] strategy for writing out file with lines header initiated with comment sign
Mao Jianfeng
jianfeng.mao at gmail.com
Wed Apr 13 12:15:36 CEST 2011
Dear all,
I have data.frame object in R. I want to export it in tab-delimited
file with several lines of header initiated with comment sign (#). I
do not know how to do that in R. Could you please give helps on this
problem?
Thanks in advance.
Best,
Jian-Feng,
##################################################################
The lines I want to write in the header lines look like, with words in
the last line (here the line "#CHROM POS ID REF ALT QUAL
FILTER INFO FORMAT NA00001") be
separated by tab :
##fileformat=VCFv4.1
##fileDate=20090805
##source=myImputationProgramV3.1
##reference=file:///seq/references/1000GenomesPilot-NCBI36.fasta
##contig=<ID=20,length=62435964,assembly=B36,md5=f126cdf8a6e0c7f379d618ff66beb2da,species="Homo
sapiens",taxonomy=x>
##phasing=partial
##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of Samples With Data">
##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
##INFO=<ID=AF,Number=A,Type=Float,Description="Allele Frequency">
##INFO=<ID=AA,Number=1,Type=String,Description="Ancestral Allele">
##INFO=<ID=DB,Number=0,Type=Flag,Description="dbSNP membership, build 129">
##INFO=<ID=H2,Number=0,Type=Flag,Description="HapMap2 membership">
##FILTER=<ID=q10,Description="Quality below 10">
##FILTER=<ID=s50,Description="Less than 50% of samples have data">
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
##FORMAT=<ID=HQ,Number=2,Type=Integer,Description="Haplotype Quality">
#CHROM POS ID REF ALT QUAL FILTER INFO
FORMAT NA00001
More information about the R-help
mailing list