IGV: Load custom data (chr, start, end, strand, sample)
1
0
Entering edit mode
8.1 years ago

Hi,

I've some data that I want to load into IGV. It represents some viral integration sites for a bunch of samples. For each integration site I've :

  • chromosome
  • start
  • end (in fact start+1)
  • strand (tell us the orientation of the virus relative to the reference genome)
  • sample id

What I want is to have a separate track for each sample id and to have different colors for + and - strand integration sites ? Is that possible ?

Thanks

IGV • 1.7k views
ADD COMMENT
0
Entering edit mode
8.1 years ago

To have each sample on a separate track you need a file per sample. To visualize features depending on strand, you could make your tracks as bedGraph (format: chrom, start, end, score). In the score field put 1 if strand is positive, -1 otherwise. Then in IGV you can assign different colour to values positive or negative.

To split your samples in individual files you can first sort by position (sort -k1,1 -k2,2n samples.txt > sorted.txt) then put one sample per bedgraph file with score as above with something like:

prev=''
while read line
do
    sample=`echo $line | cut -f 5 -d ' '` ## Get sample id
    if [[ $sample != $prev ]]
    then
        bedgraph=${sample}.bedGraph ## Initialize new file name
    fi
    ## Output bedGraph line
    echo $line | awk -v OFS='\t' '{if($4 == "+"){strand= 1}else{strand= -1}  print $1, $2, $3, strand}' >> $bedgraph 
done < sorted.txt

(I assume you don't have hundreds of samples otherwise it would be messy)

ADD COMMENT
0
Entering edit mode

Yes that was one of my first idea but I would like to avoid multiple files.

ADD REPLY

Login before adding your answer.

Traffic: 2996 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6