How can I extract a DNA sequence using a Perl script from UCSC if I have their coordinates?

How can I extract a DNA sequence using a Perl script from the genome browser (UCSC) if I have their coordinates?

+3
source share
1 answer

You can pass the DAS sequence request to a Perl script that parses the XML element containing the sequence.

For example, the following curlUCSC DAS server request that discards a standard error is sent to parseSeq.pl:

$ curl http://genome.ucsc.edu/cgi-bin/das/hg19/dna?segment=1:10000,10999 2>/dev/null | parseSeq.pl

curl XML-, 1000 hg19 . 10000 10999 (, UCSC 0 ) . XML , .

XML Perl script Perl XML:: Simple, , .

, parseSeq.pl :

#!/usr/bin/perl -w                                                                                                                                                                                                                          

use strict;                                                                                                                                                                                                                                 
use XML::Simple;                                                                                                                                                                                                                            
use Data::Dumper;                                                                                                                                                                                                                           

my $xml = new XML::Simple;                                                                                                                                                                                                                  
my $ref = $xml->XMLin('-');                                                                                                                                                                                                                       

print Dumper $ref;

, $ref.

+6

Source: https://habr.com/ru/post/1743315/


All Articles