~ubuntu-branches/ubuntu/utopic/circos/utopic-proposed

« back to all changes in this revision

Viewing changes to data/karyotype/parse.karyotype

  • Committer: Package Import Robot
  • Author(s): Olivier Sallou, Olivier Sallou, Charles Plessy, Andreas Tille
  • Date: 2012-06-14 12:56:33 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120614125633-0wh7ovv69s5k1uiq
Tags: 0.61-1
[ Olivier Sallou ]
* New upstream release

[ Charles Plessy ]
* renamed debian/upstream-metadata.yaml to debian/upstream

[ Andreas Tille ]
* debian/upstream: enhanced citation information 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
# Parses UCSC Chromosome Band table into a Circos karyotype file. 
 
4
#
 
5
# This script will only work on the Chromosome Band table - it will not 
 
6
# work on an 'Assembly' or 'Scaffold' table. Many organisms do not have
 
7
# a Chromosome Band table, and for these you will need to 
 
8
#
 
9
# parse.karyotype chromosome.band.hg19.txt hs > karyotype.hg19.txt
 
10
#
 
11
# The prefix, e.g. hs, will be used to label the chromosomes (e.g. hs1, hs2 ... )
 
12
# By default, "chr" is used.
 
13
#
 
14
# To download data tables, see http://genome.ucsc.edu/cgi-bin/hgTables
 
15
 
 
16
file=$1
 
17
prefix=$2
 
18
 
 
19
if [ ! -n "$file" ]
 
20
then
 
21
echo "Plese specify the UCSC karyotype table file"
 
22
exit
 
23
fi
 
24
 
 
25
if [ ! -n "$prefix" ]
 
26
then
 
27
prefix="chr"
 
28
fi
 
29
 
 
30
# chromosomes
 
31
cat $file | grep -v ^\# | tr A-Z a-z | sort +0 -1 +2rn -3 | sort -u -k 1,1 | sed 's/\t/ /g' | tr -s " " | sed 's/chr//' | awk '{print $1,$0}' | awk -v prefix=$2 '{print "chr -",prefix$2,$1,0,$4,"chr"$1}' | sort -n +3 -4 
 
32
 
 
33
# bands
 
34
cat $file  | grep -v ^\# | tr A-Z a-z | sed 's/\t/ /g' | tr -s " " | sed "s/chr/$prefix/" | awk '{print $1,$0}' | sed 's/chr//' | awk '{print "band",$2,$5,$5,$3,$4,$6}' | sort +1 -2 +4n -5
 
35
 
 
36
 
 
37