Entering edit mode
mauede@alice.it
▴
870
@mauedealiceit-3511
Last seen 10.2 years ago
Not quite .. Here is a excerpt of my code. Function writeFASTA won't
work even if the connection is opened (as the write function works)
and
the list variable has been generated according to the syntax you
showed me.
}else if (substr(buf,1,4) == "ENSG") {
#ENSEMBL_GENE_ID KEYWORD
gene.map <- getBM (attributes=c("hgnc_symbol","ensembl_gene_id","e
nsembl_transcript_id"),
filters = "ensembl_gene_id",
values =buf, mart=hmart)
cat("\n",miRNA.rec ,"\n")
cat("\n",buf,"\n")
show(gene.map)
if (nrow(gene.map) == 0) next
gene.id <- paste(gene.map[1,"hgnc_symbol"], "|", buf,sep="")
gene.seq <- getSequence (id=gene.map[,"ensembl_transcript_id"],
type="ensembl_transcript_id", seqType="3utr",
mart=hmart)
show(gene.seq)
if (nrow(gene.seq >0)) {
if (!file.exists(filname)) {
zz <- file (filname,"w")
write(miRNA.rec, zz, append = FALSE)
write(miRNA.seq,zz, append = TRUE)
}
for (i in 1: nrow (gene.seq)) {
write ("\n", zz, append = TRUE)
geneDesc <- paste (">",gene.id, "|",
gene.map[i,"ensembl_transcript_id"], sep="")
geneSeq <- gene.seq[i,"3utr"]
gene.string <- list(desc=geneDesc, seq=geneSeq)
writeFASTA (gene.string, zz)
}
}
}
Here is the response that I cannot understand:
> library(biomaRt)
> source(file.choose())
Checking attributes ... ok
Checking filters ... ok
>hsa-miR-23a
ENSG00000114315
hgnc_symbol ensembl_gene_id ensembl_transcript_id
1 HES1 ENSG00000114315 ENST00000232424
3utr
1 GGGGGCTCAGGCCACCCCTCCTCCTAAACTCCCCAACCCACCTCTCTTCCCTCCGGACTCTAAACAGG
AACTTGAATACTGGGAGAGAAGAGGACTTTTTTGATTAAGTGGTTACTTTGTGTTTTTTTAATTTCTAAG
AAGTTACTTTTTGTAGAGAGAGCTGTATTAAGTGACTGACCATGCACTATATTTGTATATATTTTATATG
TTCATATTGGATTGCGCCTTTGTATTATAAAAGCTCAGATGACATTTCGTTTTTTACACGAGATTTCTTT
TTTATGTGATGCCAAAGATGTTTGAAAATGCTCTTAAAATATCTTCCTTTGGGGAAGTTTATTTGAGAAA
AT
ensembl_transcript_id
1 ENST00000232424
Error in rec$desc : $ operator is invalid for atomic vectors
> gene.string
$desc
[1] ">HES1|ENSG00000114315|ENST00000232424"
$seq
[1] "GGGGGCTCAGGCCACCCCTCCTCCTAAACTCCCCAACCCACCTCTCTTCCCTCCGGACTCTAAAC
AGGAACTTGAATACTGGGAGAGAAGAGGACTTTTTTGATTAAGTGGTTACTTTGTGTTTTTTTAATTTCT
AAGAAGTTACTTTTTGTAGAGAGAGCTGTATTAAGTGACTGACCATGCACTATATTTGTATATATTTTAT
ATGTTCATATTGGATTGCGCCTTTGTATTATAAAAGCTCAGATGACATTTCGTTTTTTACACGAGATTTC
TTTTTTATGTGATGCCAAAGATGTTTGAAAATGCTCTTAAAATATCTTCCTTTGGGGAAGTTTATTTGAG
AAAAT"
> writeFASTA (gene.string, zz)
Error in rec$desc : $ operator is invalid for atomic vectors
>
-----Messaggio originale-----
Da: Steve Lianoglou [mailto:mailinglist.honeypot@gmail.com]
Inviato: gio 16/07/2009 17.43
A: mauede@alice.it
Cc: bioconductor List
Oggetto: Re: [BioC] R: how to use writeFASTA in modality "append"
Hi,
> I have the 3UTR sequence and the description in separated variables.
> How can I generate a list with the two elements $seq and $desc as
> expected by writeFASTA ?
Let's say your var names that hold the data are: seqs and descs:
fasta.list <- lapply(seq(seqs), function (i) list(seq=seqs[[i]],
desc=descs[[i]]))
I think that should work, no?
-steve
--
Steve Lianoglou
Graduate Student: Physiology, Biophysics and Systems Biology
Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
tutti i telefonini TIM!
[[alternative HTML version deleted]]