Question: How To Get The Sequence Of A Genomic Region From Ucsc?
12
gravatar for Giovanni M Dall'Olio
7.7 years ago by
London, UK
Giovanni M Dall'Olio25k wrote:

Let's say I want to download the fasta sequence of the region chr1:100000..200000 from the UCSC browser. How do you do that? I can't find a button to 'export to fasta' in the UCSC genome browser. I think that the solution is to click on one of the tracks displayed, but I am not sure of which. If I go to the Tables section, I can't find a table with the fasta sequences among the many.

fasta sequence ucsc • 44k views
ADD COMMENTlink modified 17 months ago by jayanthisreejith70 • written 7.7 years ago by Giovanni M Dall'Olio25k
23
gravatar for Pierre Lindenbaum
7.7 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum100k wrote:

Use the DAS server:

http://genome.ucsc.edu/cgi-bin/das/hg19/dna?segment=chr1:100000,200000

ADD COMMENTlink modified 5.3 years ago by Istvan Albert ♦♦ 74k • written 7.7 years ago by Pierre Lindenbaum100k
4

be careful: the DAS server uses an index of (+1) for the first base.

ADD REPLYlink written 7.7 years ago by Pierre Lindenbaum100k
1

that's really neat!

ADD REPLYlink written 7.7 years ago by Istvan Albert ♦♦ 74k
1

Thanks!! I didn't know that, very cool!! :-)

ADD REPLYlink written 7.7 years ago by Giovanni M Dall'Olio25k
1

Wow, thanks. That's quite useful.

ADD REPLYlink written 7.7 years ago by Madelaine Gogol4.8k
12
gravatar for Madelaine Gogol
7.7 years ago by
Madelaine Gogol4.8k
Kansas City
Madelaine Gogol4.8k wrote:

Just click "DNA" at the top of the screen.

ADD COMMENTlink written 7.7 years ago by Madelaine Gogol4.8k
1

Currently, you need to go to "View --> DNA," but the function is the same

ADD REPLYlink written 3.5 years ago by Charles Warden4.9k
7
gravatar for Maximilian Haeussler
3.8 years ago by
UCSC
Maximilian Haeussler1.3k wrote:

There is no table with sequences. The sequences are in a file because that's a lot faster.

I think the question was mostly about how to get a single sequence and the answer to that is very simple: click View - DNA.

If you need to get the sequence from a script, use the UCSC utility twoBitToFa (see http://hgdownload.cse.ucsc.edu/admin/exe/) like this:

twoBitToFa http://hgdownload.cse.ucsc.edu/gbdb/hg19/hg19.2bit test.fa -seq=chr21 -start=1 -end=10000

ADD COMMENTlink written 3.8 years ago by Maximilian Haeussler1.3k

This is exactly what I was looking for Thanks!!!

ADD REPLYlink written 3.7 years ago by vivekdna0
5
gravatar for Hiroyuki Mishima
3.1 years ago by
Nagasaki. Japan
Hiroyuki Mishima130 wrote:

Yet another solution.

TogoWS's REST API now supports the UCSC Genome Database.

For example, http://togows.org/api/ucsc/hg38/chr1:12,345-12,500.fasta returns the reference genome sequence in the fasta format.

Please see further information at the "External API" section of http://togows.org/help/

 

ADD COMMENTlink written 3.1 years ago by Hiroyuki Mishima130
4
gravatar for Istvan Albert
7.7 years ago by
Istvan Albert ♦♦ 74k
University Park, USA
Istvan Albert ♦♦ 74k wrote:

The Genome Browser is for visualization.

To get data in many formats use the UCSC Table Browser then select the output format of your choice.

You may also need to select the right group and track to get the data you want.

ADD COMMENTlink written 7.7 years ago by Istvan Albert ♦♦ 74k

I tought so, but I can't find the table for sequences, not even when I select 'All tracks' and 'AlLl tables'. Thanks anyway..

ADD REPLYlink written 7.7 years ago by Giovanni M Dall'Olio25k

I guess you are right, now that I tried myself and it seems that information is awfully hard to get - sometimes the seemingly getting the easiest thing is not possible. You could try your luck with the Ensemble API.

ADD REPLYlink written 7.7 years ago by Istvan Albert ♦♦ 74k

I guess you are right, now that I tried myself and it seems that information is awfully hard to get - sometimes getting something seemingly easy end up as being not possible. You could try your luck with the Ensemble API.

ADD REPLYlink written 7.7 years ago by Istvan Albert ♦♦ 74k

I you need to download sequences, first you need to tell the website the coordinates that you want to download. (Remember that table browser is for batch processing). Click on "Custom track" and type in something like this:

chr1 1 1000
chr2 123 12345

Click Submit. 

Now you can go to the table browser, select your "custom track" and select "Fasta format" as output format.

The advantage of this procedure is that you can request thousands of sequences in one go. No need to use an API. For scripting see my reply above that uses the linux command line tool "twoBitToFa" from UCSC.

ADD REPLYlink modified 2.5 years ago • written 3.3 years ago by Maximilian Haeussler1.3k
3
gravatar for pengchy
2.0 years ago by
pengchy360
China/Beijing/CAS
pengchy360 wrote:

Another solution is using Heng Li's sequence toolkit:

seqtk subseq

Usage:   seqtk subseq [options] <in.fa> <in.bed>|<name.list>

Options: -t       TAB delimited output
         -l INT   sequence line length [0]

Note: Use 'samtools faidx' if only a few regions are intended.

which can be downloaded from: https://github.com/lh3/seqtk , however, seqtk subseq does not consider the strand information, which has been implemented in bedtools getfasta

bedtools getfasta

Tool:    bedtools getfasta (aka fastaFromBed)
Version: v2.23.0
Summary: Extract DNA sequences into a fasta file based on feature coordinates.

Usage:   bedtools getfasta [OPTIONS] -fi <fasta> -bed <bed/gff/vcf> -fo <fasta> 

Options: 
        -fi     Input FASTA file
        -bed    BED/GFF/VCF file of ranges to extract from -fi
        -fo     Output file (can be FASTA or TAB-delimited)
        -name   Use the name field for the FASTA header
        -split  given BED12 fmt., extract and concatenate the sequencesfrom the BED "blocks" (e.g., exons)
        -tab    Write output in TAB delimited format.
                - Default is FASTA format.

        -s      Force strandedness. If the feature occupies the antisense,
                strand, the sequence will be reverse complemented.
                - By default, strand information is ignored.

        -fullHeader     Use full fasta header.
                - By default, only the word before the first space or tab is used.
ADD COMMENTlink modified 2.0 years ago • written 2.0 years ago by pengchy360

Thanks, this is really handy!!

ADD REPLYlink written 5 weeks ago by phosphodiester_bond0
0
gravatar for jayanthisreejith7
17 months ago by
jayanthisreejith70 wrote:

I understand this is a very old post, but if it helps anyone who is searching for programmatic access directly using UCSC tools, I found the below link http://genomewiki.ucsc.edu/index.php/Programmatic_access_to_the_Genome_Browser

It has details on

1) How to download data from their MySQL database

2) Get Chromosome sequence for a range (using REST API, which was what I was looking for)

... and few such things including accessing a copy of current Genome browser image

Hope this helps!

ADD COMMENTlink written 17 months ago by jayanthisreejith70
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 700 users visited in the last hour