Skip to content

Instantly share code, notes, and snippets.

@grassa
Created January 15, 2014 18:00
Show Gist options
  • Save grassa/8441084 to your computer and use it in GitHub Desktop.
Save grassa/8441084 to your computer and use it in GitHub Desktop.
#!/usr/bin/Rscript
args <- commandArgs(trailingOnly = TRUE)
lg<-args[1]
infile<-args[2]
assembly<-args[3]
bpmax<-as.integer(args[4])
genesinfile<-args[5]
pngout<-paste(infile,".genes.png",sep="")
header<-paste(lg,"",sep="\n")
dat<-read.table(infile,head=T)
genesdat<-read.table(genesinfile,head=T)
attach(dat)
attach(genesdat)
png(pngout,units="in", width=14, height=14, res=300)
par(bg = "transparent")
#plot(cM,position_end,xlim=c(0,100),ylim=c(0,bpmax),xlab="cM",ylab="bp",main=header)
plot(cM,position_end,xlim=c(-25,100),ylim=c(-75000000,275000000),xlab="cM",ylab="bp",main=lg, pch=20,cex=2,col="#00A0FF0A")
segments(0,0,-2,0,col="white")
segments(0,(max(position_end)),-2,(max(position_end)),col="white")
segments(-1,0,-1,(max(position_end)),col="white")
segments(0,0,0,(-2750000*2),col="white")
segments((max(cM)),0,(max(cM)),(-2750000*2),col="white")
segments(0,-2750000,(max(cM)),-2750000,col="white")
opar <- par(new = TRUE)
plot(cM,position_end,xlim=c(-25,100),ylim=c(-75000000,275000000),xlab="cM",ylab="bp",main=lg, pch=20,cex=0.3,col="#45FBFE")
apar <- par(new = TRUE)
plot(centiMorgans,End,xlim=c(-25,100),ylim=c(-75000000,275000000),xlab="cM",ylab="bp",main=lg, pch=20,cex=(Ha_XRQ_Leaves_IAA6_RPKM*0.001),col="#F7313132")
bpar <- par(new = TRUE)
plot(centiMorgans,End,xlim=c(-25,100),ylim=c(-75000000,275000000),xlab="cM",ylab="bp",main=lg, pch=20,cex=(Ha_XRQ_Leaves_Bra6_RPKM*0.001),col="#F7842932")
cpar <- par(new = TRUE)
plot(centiMorgans,End,xlim=c(-25,100),ylim=c(-75000000,275000000),xlab="cM",ylab="bp",main=lg, pch=20,cex=(Ha_XRQ_Ligule_RPKM*0.001),col="#FBFD0032")
dpar <- par(new = TRUE)
plot(centiMorgans,End,xlim=c(-25,100),ylim=c(-75000000,275000000),xlab="cM",ylab="bp",main=lg, pch=20,cex=(Ha_XRQ_Bract_RPKM*0.001),col="#4AA57B32")
epar <- par(new = TRUE)
plot(centiMorgans,End,xlim=c(-25,100),ylim=c(-75000000,275000000),xlab="cM",ylab="bp",main=lg, pch=20,cex=(Ha_XRQ_Pollen_RPKM*0.001),col="#4AFF2932")
fpar <- par(new = TRUE)
plot(centiMorgans,End,xlim=c(-25,100),ylim=c(-75000000,275000000),xlab="cM",ylab="bp",main=lg, pch=20,cex=(Ha_XRQ_Seed_RPKM*0.001),col="#4AEFF732")
gpar <- par(new = TRUE)
plot(centiMorgans,End,xlim=c(-25,100),ylim=c(-75000000,275000000),xlab="cM",ylab="bp",main=lg, pch=20,cex=(Ha_XRQ_Stamen_RPKM*0.001),col="#1842F732")
hpar <- par(new = TRUE)
plot(centiMorgans,End,xlim=c(-25,100),ylim=c(-75000000,275000000),xlab="cM",ylab="bp",main=lg, pch=20,cex=(Ha_XRQ_Style_RPKM*0.001),col="#5BB5FF32")
ipar <- par(new = TRUE)
plot(centiMorgans,End,xlim=c(-25,100),ylim=c(-75000000,275000000),xlab="cM",ylab="bp",main=lg, pch=20,cex=(Ha_XRQ_Stem_RPKM*0.001),col="#A573F732")
jpar <- par(new = TRUE)
plot(centiMorgans,End,xlim=c(-25,100),ylim=c(-75000000,275000000),xlab="cM",ylab="bp",main=lg, pch=20,cex=(Ha_XRQ_Corolla_RPKM*0.001),col="#E7ADF732")
kpar <- par(new = TRUE)
plot(centiMorgans,End,xlim=c(-25,100),ylim=c(-75000000,275000000),xlab="cM",ylab="bp",main=lg, pch=20,cex=(Ha_XRQ_Roots_PEG6_RPKM*0.001),col="#EF52F732")
par(opar)
par(apar)
par(bpar)
par(cpar)
par(dpar)
par(epar)
par(fpar)
par(gpar)
par(hpar)
par(ipar)
par(jpar)
par(kpar)
dev.off()
#[1] "#F731310A"
#[1] "#F73131"
#"#F731310A"
#"#F784290A"
#"#FBFD000A"
#"#4AFF290A"
#"#4AA57B0A"
#"#4AEFF70A"
#"#1842F70A"
#"#5BB5FF0A"
#"#A573F70A"
#"#E7ADF70A"
#"#EF52F70A"
#"#F4CC270A"
# "#F4CC270A"
#plot(centiMorgans,End,xlim=c(-25,100),ylim=c(-75000000,275000000),xlab="cM",ylab="bp",main=lg, pch=20,cex=(log((Ha_XRQ_Seed_RPKM*0.01))),col="green")
#plot(centiMorgans,End,xlim=c(-25,100),ylim=c(-75000000,275000000),xlab="cM",ylab="bp",main=lg, pch=20,cex=(log((Ha_XRQ_Seed_RPKM*0.001))),col="green")
@kgturner
Copy link

What do dat and genesdat look like?

@grassa
Copy link
Author

grassa commented Jan 16, 2014


LG  cM  ctg scf orientation length  position_end
17  00.000000000    ctg767.17.XX    GAP BE  25927   25927
17  00.000000000    ctg767.17.XX    scf7180038279935    BE  38926   64853
17  00.000000000    ctg767.17.XX    GAP BE  25927   90780
17  00.000000000    ctg767.17.XX    scf7180038281777    EB  15419   106199
17  00.000000000    ctg767.17.XX    GAP BE  25927   132126
17  00.000000000    ctg767.17.XX    scf7180038285947    BE  24321   156447
17  00.000000000    ctg767.17.XX    GAP BE  25927   182374
17  00.000000000    ctg767.17.XX    scf7180038288895    BE  17093   199467
17  00.000000000    ctg767.17.XX    GAP BE  25927   225394

~~~~~~~~~~~~~~~~~~~~~~~~~~~~ genesdat ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LinkageGroup    Start   End centiMorgans    GeneAccession   Accession   Ha_XRQ_Leaves_IAA6_RPKM Ha_XRQ_Leaves_Bra6_RPKM Ha_XRQ_Ligule_RPKM  Ha_XRQ_Bract_RPKM   Ha_XRQ_Pollen_RPKM  Ha_XRQ_Seed_RPKM    Ha_XRQ_Stamen_RPKM  Ha_XRQ_Style_RPKM   Ha_XRQ_Stem_RPKM    Ha_XRQ_Corolla_RPKM Ha_XRQ_Roots_PEG6_RPKM
17  11128618    11133276    27.419354839    HaT13l000025    HaT13l000025    18.1    16.66   24.9    20.91   0.11    13.62   2.94    10.66   39.68   5.87    21.56
17  11868612    11868711    27.419354839    HaT13l000048    HaT13l000048    20.53   28.86   13.21   4.7 0.6 13.56   4.9 11.4    9.93    6.78    37.92
17  15355054    15369926    31.720430108    HaT13l000051    HaT13l000051    4.89    7.21    3.81    1.62    0.4 2.78    0.88    1.93    2.75    1.55    8.69
17  85175609    85184338    53.494623656    HaT13l000067    HaT13l000067    15.38   14.06   11.39   12.17   0.94    18.15   6.51    10.02   17.43   5.85    19.89
17  48892087    48892199    47.849462366    HaT13l000081    HaT13l000081    16.13   13.83   18.06   13.39   0.1 6.02    3   8.9 18.59   7.54    22.55
17  165767841   165771287   56.182795699    HaT13l000091    HaT13l000091    100.95  71.37   264.3   171.83  2.95    79.4    79.74   331.41  77.35   104.78  97.22
17  45888269    45893627    47.043010753    HaT13l000103    HaT13l000103    8.56    9.45    7.39    4.35    0.27    8.27    5.22    6.27    6.83    4.26    17.2
17  80625074    80644503    53.225806452    HaT13l000135    HaT13l000135    7.73    10.96   5.49    1.08    1.63    4.36    1.96    4.12    4.55    3.1 9.38
17  64769582    64769633    51.075268817    HaT13l000129    HaT13l000129    55.58   47.03   124.14  20.44   0.08    15.42   5.81    19.17   70.24   16.01   69.65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment