This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to extract genomic sequence using genomic coordinates

These are the set of sequence a very small subset

chr1_6237786_6251176_F
chr1_10150615_10150781_R
chr1_12911118_12934193_R
chr1_13142230_13142459_R
chr1_13640475_13640801_R
chr1_13640480_13640801_R

I want to extract the set of sequences that lies with my coordinates as i have put above ..how to do that, do i use an lets say hg38 chromosome to parse the coordinates ,any help or suggestion would be highly appreciated ..

rna-seq

thank you i will look into it

2 answers

Hi, you convert to BED format and use "getfasta" from bedtools. For details, "http://bedtools.readthedocs.io/en/latest/content/tools/getfasta.html".

Example for BED file of your sample

chr1    6237786     6251176     x   y   +
chr1    10150615    10150781    x   y   -
chr1    12911118    12934193    x   y   - 
chr1    13142230    13142459    x   y   -
chr1    13640475    13640801    x   y   -
chr1    13640480    13640801    x   y   -

Best

so i have to convert my fasta file to bed file then get the coordinates you are saying?

No..

you need to convert your co-ordinates to BED file format. I assumed that your sample file is co-ordinate file.

well i have the input as i put in my question that is the information i have...

@krushnach: do this on your input file

cat file.bed | tr '_' '\t' > modified_file.bed

And use this file with bedtools

$ sed 's/_/\t/g' old.bed > new.bed

You can use python's slicing notation to extract sub-sequences. I implemented it in this code, look at lines 83-89.

Log in to answer this question.