This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Script to download fasta seqeuences for FGF1 to FGF12

Hi All,

Who can share a script to download human gene fasta/sequences for FGF1, FGF2, FGF3, FGF4, FGF5, FGF6 and FGF7 at the same time?

Thanks.

human fasta

You can try using bedtools getfasta.

  1. First obtain coordinates of the gene (eg. FGF1 and genome version hg19).

    chr5 141971743 142077635 FGF1(GRCh37/hg19) (note: tab-separated)

  2. Run getfasta using fasta file hg19 version:

bedtools getfasta -fi hg19.fa -bed FGF1.bed -fo FGF1.fa

FGF1.fa will be your fasta sequence.

And you can do the same for other genes by making a shell script and it will extract all at the same time. Make a bed of file of all coordinates of the gene of your interest and run getfasta.

2 answers

Why won't BioMart at ensembl do what you want?

Thanks. any script to share?

Why didn't Biomart work for you?

Using EntrezDirect. Following will get you only RefSeq entries (which is what I assume would be of interest).

$  esearch -db nuccore -query "FGF1 [GENE] AND Homo sapiens [ORGN]" | efetch -format docsum | xtract -pattern DocumentSummary -if SourceDb -contains refseq -element Caption | xargs -n 1 sh -c 'efetch -db nuccore -id "$0" -format fasta_cds_na'

Log in to answer this question.