Wednesday, February 22, 2017

Transfer folder contents via FTP without prompting

If you need to transfer multiple files via ftp from a folder, as folder transfer per se is not supported, go into local folder, connect to ftp server and use mput to place multiple files. The problem with this option is that you would be prompted to confirm each file, that may be a problem for large folders. Thus, to avoid this connect to ftp with -i option.


Miloss-MacBook-Air:~ cd local_folder
Miloss-MacBook-Air:~ milospjanic$ ftp -i sftp.lsnet.ucla.edu
Connected to sftp.lsnet.ucla.edu.
220 (vsFTPd 2.2.2)
Name (sftp.lsnet.ucla.edu:milospjanic): username
331 Please specify the password.
Password: password
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> mput *

Friday, February 17, 2017

Removing duplicate genes based on the conditions of another column for differential expression and gene ontology pipelines in R

Some differential gene expression tools may reject your input table if for some reason gene name has been duplicated in another row. If your data frame contains duplicated rows on a single column (e.g. gene name) you can remove them in R using the following code. Note that this will remove any subsequent occurrence of the duplicated gene, therefore preserving only the first occurrence.

table<-read.delim("table.csv", header=T, sep=",")
table
    X         id    baseMean   baseMeanA  baseMeanB foldChange log2FoldChange
1   1 SEC24B-AS1    3.837647   3.0343409   4.640954  1.5294767     0.61303813
2   2       A1BG    1.769987   0.7314147   2.808559  3.8398998     1.94106866
3   3       A1CF    0.000000   0.0000000   0.000000         NA             NA
4   4      GGACT    5.722972   3.5491983   7.896745  2.2249378     1.15376499
5   5        A2M    0.000000   0.0000000   0.000000         NA             NA
6   6      A2ML1    0.000000   0.0000000   0.000000         NA             NA
7   7      A2MP1    0.000000   0.0000000   0.000000         NA             NA
8   8     A4GALT  261.976303 281.3563018 242.596304  0.8622387    -0.21384071
9   9      A4GNT    0.000000   0.0000000   0.000000         NA             NA
10 10       AAAS  237.463538 240.8107614 234.116315  0.9722004    -0.04067439
11 11       AACS  262.054727 268.0227018 256.086753  0.9554666    -0.06572258
12 12      GGACT 1000.000000   0.0000000   0.000000         NA             NA
13 13     A4GALT 1000.000000   0.0000000   0.000000         NA             NA
14 14 SEC24B-AS1 1000.000000   0.0000000   0.000000         NA             NA
        pval padj
1  0.4469177    1
2  0.3359994    1
3         NA   NA
4  0.1943902    1
5         NA   NA
6         NA   NA
7         NA   NA
8  0.3760542    1
9         NA   NA
10 0.8189333    1
11 0.6515563    1
12        NA   NA
13        NA   NA
14        NA   NA
> table.2 <- subset(table, !duplicated(table[,2])) > table.2 X id baseMean baseMeanA baseMeanB foldChange log2FoldChange 1 1 SEC24B-AS1 3.837647 3.0343409 4.640954 1.5294767 0.61303813 2 2 A1BG 1.769987 0.7314147 2.808559 3.8398998 1.94106866 3 3 A1CF 0.000000 0.0000000 0.000000 NA NA 4 4 GGACT 5.722972 3.5491983 7.896745 2.2249378 1.15376499 5 5 A2M 0.000000 0.0000000 0.000000 NA NA 6 6 A2ML1 0.000000 0.0000000 0.000000 NA NA 7 7 A2MP1 0.000000 0.0000000 0.000000 NA NA 8 8 A4GALT 261.976303 281.3563018 242.596304 0.8622387 -0.21384071 9 9 A4GNT 0.000000 0.0000000 0.000000 NA NA 10 10 AAAS 237.463538 240.8107614 234.116315 0.9722004 -0.04067439 11 11 AACS 262.054727 268.0227018 256.086753 0.9554666 -0.06572258 pval padj 1 0.4469177 1 2 0.3359994 1 3 NA NA 4 0.1943902 1 5 NA NA 6 NA NA 7 NA NA 8 0.3760542 1 9 NA NA 10 0.8189333 1 11 0.6515563 1
You can see that the last three rows were removed as those genes were previously repeated. In some cases you would need to remove duplicated genes based on some condition in another column.

If you need to filter rows duplicated on a certain column by, e.g. sorting on another column, use this rather elegant code that involved presorting followed by subsetting.

table<-read.delim("table.csv", header=T, sep=",")
> table
    X         id    baseMean   baseMeanA  baseMeanB foldChange log2FoldChange
1   1 SEC24B-AS1    3.837647   3.0343409   4.640954  1.5294767     0.61303813
2   2       A1BG    1.769987   0.7314147   2.808559  3.8398998     1.94106866
3   3       A1CF    0.000000   0.0000000   0.000000         NA             NA
4   4      GGACT    5.722972   3.5491983   7.896745  2.2249378     1.15376499
5   5        A2M    0.000000   0.0000000   0.000000         NA             NA
6   6      A2ML1    0.000000   0.0000000   0.000000         NA             NA
7   7      A2MP1    0.000000   0.0000000   0.000000         NA             NA
8   8     A4GALT  261.976303 281.3563018 242.596304  0.8622387    -0.21384071
9   9      A4GNT    0.000000   0.0000000   0.000000         NA             NA
10 10       AAAS  237.463538 240.8107614 234.116315  0.9722004    -0.04067439
11 11       AACS  262.054727 268.0227018 256.086753  0.9554666    -0.06572258
12 12      GGACT 1000.000000   0.0000000   0.000000         NA             NA
13 13     A4GALT 1000.000000   0.0000000   0.000000         NA             NA
14 14 SEC24B-AS1 1000.000000   0.0000000   0.000000         NA             NA
        pval padj
1  0.4469177    1
2  0.3359994    1
3         NA   NA
4  0.1943902    1
5         NA   NA
6         NA   NA
7         NA   NA
8  0.3760542    1
9         NA   NA
10 0.8189333    1
11 0.6515563    1
12        NA   NA
13        NA   NA
14        NA   NA
> table = table[order(table[,'id'],-table[,'baseMean']),]
> table
    X         id    baseMean   baseMeanA  baseMeanB foldChange log2FoldChange
2   2       A1BG    1.769987   0.7314147   2.808559  3.8398998     1.94106866
3   3       A1CF    0.000000   0.0000000   0.000000         NA             NA
5   5        A2M    0.000000   0.0000000   0.000000         NA             NA
6   6      A2ML1    0.000000   0.0000000   0.000000         NA             NA
7   7      A2MP1    0.000000   0.0000000   0.000000         NA             NA
13 13     A4GALT 1000.000000   0.0000000   0.000000         NA             NA
8   8     A4GALT  261.976303 281.3563018 242.596304  0.8622387    -0.21384071
9   9      A4GNT    0.000000   0.0000000   0.000000         NA             NA
10 10       AAAS  237.463538 240.8107614 234.116315  0.9722004    -0.04067439
11 11       AACS  262.054727 268.0227018 256.086753  0.9554666    -0.06572258
12 12      GGACT 1000.000000   0.0000000   0.000000         NA             NA
4   4      GGACT    5.722972   3.5491983   7.896745  2.2249378     1.15376499
14 14 SEC24B-AS1 1000.000000   0.0000000   0.000000         NA             NA
1   1 SEC24B-AS1    3.837647   3.0343409   4.640954  1.5294767     0.61303813
        pval padj
2  0.3359994    1
3         NA   NA
5         NA   NA
6         NA   NA
7         NA   NA
13        NA   NA
8  0.3760542    1
9         NA   NA
10 0.8189333    1
11 0.6515563    1
12        NA   NA
4  0.1943902    1
14        NA   NA
1  0.4469177    1
> table.2 <- subset(table, !duplicated(table[,2]))
> table.2
    X         id    baseMean   baseMeanA  baseMeanB foldChange log2FoldChange
2   2       A1BG    1.769987   0.7314147   2.808559  3.8398998     1.94106866
3   3       A1CF    0.000000   0.0000000   0.000000         NA             NA
5   5        A2M    0.000000   0.0000000   0.000000         NA             NA
6   6      A2ML1    0.000000   0.0000000   0.000000         NA             NA
7   7      A2MP1    0.000000   0.0000000   0.000000         NA             NA
13 13     A4GALT 1000.000000   0.0000000   0.000000         NA             NA
9   9      A4GNT    0.000000   0.0000000   0.000000         NA             NA
10 10       AAAS  237.463538 240.8107614 234.116315  0.9722004    -0.04067439
11 11       AACS  262.054727 268.0227018 256.086753  0.9554666    -0.06572258
12 12      GGACT 1000.000000   0.0000000   0.000000         NA             NA
14 14 SEC24B-AS1 1000.000000   0.0000000   0.000000         NA             NA
        pval padj
2  0.3359994    1
3         NA   NA
5         NA   NA
6         NA   NA
7         NA   NA
13        NA   NA
9         NA   NA
10 0.8189333    1
11 0.6515563    1
12        NA   NA
14        NA   NA

Wednesday, February 1, 2017

Code for plotting up- and down-regulated gene FC and p-val distributions in R

In differential expression analysis, use the DE output table:

> head(res)
          id baseMean baseMeanA baseMeanB foldChange log2FoldChange      pval
1 SEC24B-AS1 3.837647 3.0343409  4.640954   1.529477      0.6130381 0.4469177
2       A1BG 1.769987 0.7314147  2.808559   3.839900      1.9410687 0.3359994
3       A1CF 0.000000 0.0000000  0.000000        NaN            NaN        NA
4      GGACT 5.722972 3.5491983  7.896745   2.224938      1.1537650 0.1943902
5        A2M 0.000000 0.0000000  0.000000        NaN            NaN        NA
6      A2ML1 0.000000 0.0000000  0.000000        NaN            NaN        NA
  padj
1    1
2    1
3   NA
4    1
5   NA
6   NA
Subset and create two data frames with up and down-regulated genes. Use na.omit to remove row with NA.

> down<-na.omit(res[res$log2FoldChange<(-0.5)&res$padj<0.05,])
> head (down)
            id     baseMean   baseMeanA    baseMeanB foldChange log2FoldChange
139        ACE    81.090090   128.42927 3.375091e+01 0.26279761     -1.9279759
266   ADAMTS15   109.686212   142.19707 7.717536e+01 0.54273520     -0.8816796
315      ADH1B   224.356545   348.75853 9.995456e+01 0.28660106     -1.8028842
421     AHNAK2   493.239479   623.24438 3.632346e+02 0.58281245     -0.7788964
435       AIM1   311.990989   409.72136 2.142606e+02 0.52294227     -0.9352764
              pval         padj
139   3.009363e-13 6.979143e-10
266   1.234959e-04 1.774189e-02
315   9.575011e-18 5.181357e-14
421   2.785485e-05 5.652445e-03
435   1.215970e-05 2.860877e-03

> up<-na.omit(res[res$log2FoldChange>0.5&res$padj<0.05,])
> head(up)
            id    baseMean    baseMeanA   baseMeanB foldChange log2FoldChange
198      ACTG2    28.00957    13.571106    42.44803   3.127824      1.6451595
206      ACTN1  7221.10709  5591.227639  8850.98654   1.583013      0.6626732
783      APLP1    56.91524    36.938228    76.89226   2.081645      1.0577237
1416      BEX1   134.33394    83.364379   185.30350   2.222814      1.1523872
2832      CCL2  3879.93627  2577.263209  5182.60934   2.010896      1.0078388
              pval         padj
198   2.693990e-05 5.535979e-03
206   2.481289e-04 3.196924e-02
783   1.122944e-04 1.672465e-02
1416  1.364952e-07 5.831217e-05
2832  3.065576e-08 1.605373e-05
Next, concatenate log2FoldChange from up and down dataframes to the dat$dens, and concatenate and repeat DOWN and UP elements exactly length(down$log2FoldChange) and length(up$log2FoldChange) times to the dat$lines column of the dat data frame.

> dat <- data.frame(dens = c(down$log2FoldChange, up$log2FoldChange), lines = rep(c("DOWN", "UP"), c(length(down$log2FoldChange), length(up$log2FoldChange))))

> head (dat)
          dens lines
1   -1.9279759  DOWN
2   -0.8816796  DOWN
3   -1.8028842  DOWN
4   -0.7788964  DOWN
5   -0.9352764  DOWN

> tail (dat)
143  1.2182830    UP
144  1.0698604    UP
145  0.7518891    UP
146  1.1097739    UP
147  0.6468804    UP
148  0.9988166    UP
Plot dat as density plot using ggplot2,

> library(ggplot2)

> pdf("pvalues.pdf")
> ggplot(dat, aes(x = dens, fill = lines)) + geom_density(alpha = 0.5) + ggtitle("Upregulated and downregulated gene -logFC distribution") +xlab("-logFC")+ylab("Density")+theme(axis.text=element_text(size=18),
+         axis.title=element_text(size=16), plot.title=element_text(size=16))
> dev.off()



Similarly, make a density plot for adjusted p-values.

> dat <- data.frame(dens = c(-log(down$padj), -log(up$padj)), lines = rep(c("DOWN", "UP"), c(length(down$padj), length(up$padj))))

> head (dat)
       dens lines
1 21.082925  DOWN
2  4.031827  DOWN
3 30.591124  DOWN
4  5.175667  DOWN
5  5.856627  DOWN
6  4.568621  DOWN
> tail (dat)
         dens lines
143 10.512156    UP
144 12.505760    UP
145  6.208198    UP
146 14.345963    UP
147  3.691205    UP
148 10.043970    UP
> pdf("pvalues.pdf")
> ggplot(dat, aes(x = dens, fill = lines)) + geom_density(alpha = 0.5) + ggtitle("Upregulated and downregulated gene pvalues distribution") +xlab("-logPvalue")+ylab("Density")+theme(axis.text=element_text(size=18),
+         axis.title=element_text(size=16), plot.title=element_text(size=16))
> dev.off()

Subsetting and ordering gene lists in R

In a differential expression (DE) experiment you obtained a gene list with several output columns:

> head(res)
          id baseMean baseMeanA baseMeanB foldChange log2FoldChange      pval
1 SEC24B-AS1 3.837647 3.0343409  4.640954   1.529477      0.6130381 0.4469177
2       A1BG 1.769987 0.7314147  2.808559   3.839900      1.9410687 0.3359994
3       A1CF 0.000000 0.0000000  0.000000        NaN            NaN        NA
4      GGACT 5.722972 3.5491983  7.896745   2.224938      1.1537650 0.1943902
5        A2M 0.000000 0.0000000  0.000000        NaN            NaN        NA
6      A2ML1 0.000000 0.0000000  0.000000        NaN            NaN        NA
  padj
1    1
2    1
3   NA
4    1
5   NA
6   NA
You have an ordered list of genes, for example, a list of genes in order of appearance on chromosome 7.

> cisgenes<-read.table("cis-genes")
> cisgenes
             V1
1        OSBPL3
2          CYCS
3       C7orf31
4          NPVF
5      RNU6-16P
6       MIR148A
7        NFE2L3
8     HNRNPA2B1
9          CBX3
10        SNX10
11    LOC441204
12     KIAA0087
13      C7orf71
14        SKAP2
15        HOXA1
16        HOXA2
17     HOTAIRM1
18        HOXA3
19        HOXA4
20        HOXA5
21        HOXA6
22     HOXA-AS3
23        HOXA7
24 HOXA10-HOXA9
25        HOXA9
26     HOXA-AS4
27      MIR196B
28       HOXA10
29       HOXA11
30    HOXA11-AS
31       HOXA13
32       HOTTIP
33         EVX1
34       HIBADH
35      TAX1BP1
36        JAZF1
You need to subset DE output with this gene list while preserving the order of genes.

First, using logical vector denoting all positions in the DE output that contain genes from the cisgenes list, subset the DE output:

> cisgenestable<-res[res$id %in% cisgenes$V1,]
> cisgenestable
             id     baseMean    baseMeanA   baseMeanB foldChange log2FoldChange
2320    C7orf31 2.192879e+01   18.8046996   25.052883  1.3322671     0.41388339
2343    C7orf71 0.000000e+00    0.0000000    0.000000        NaN            NaN
2655       CBX3 1.759203e+03 1825.7736950 1692.632838  0.9270770    -0.10923889
4116       CYCS 1.296481e+03 1029.4350096 1563.527666  1.5188212     0.60295200
5312       EVX1 0.000000e+00    0.0000000    0.000000        NaN            NaN
7270     HIBADH 1.627873e+03 1682.7986406 1572.946466  0.9347205    -0.09739299
7434  HNRNPA2B1 5.182713e+03 5138.0376662 5227.387459  1.0173899     0.02487263
7464      HOXA1 5.655727e+01   59.2621971   53.852338  0.9087132    -0.13810314
7465     HOXA10 5.852647e+01   53.5037521   63.549197  1.1877522     0.24823384
7466     HOXA11 3.429798e+01   31.0907859   37.505171  1.2063115     0.27060245
7467     HOXA13 0.000000e+00    0.0000000    0.000000        NaN            NaN
7468      HOXA2 3.410123e+00    2.6565888    4.163658  1.5672947     0.64827651
7469      HOXA3 3.221184e+01   29.5762769   34.847408  1.1782216     0.23661089
7470      HOXA4 3.436599e+01   32.5189782   36.213007  1.1135961     0.15522606
7471      HOXA5 4.144621e+02  382.1294264  446.794798  1.1692237     0.22555103
7472      HOXA6 4.799613e-01    0.9599225    0.000000  0.0000000           -Inf
7473      HOXA7 6.213861e+01   66.3285481   57.948674  0.8736611    -0.19485431
7474      HOXA9 6.145887e+01   59.5366534   63.381083  1.0645725     0.09027418
8140      JAZF1 4.351783e+02  414.6587972  455.697835  1.0989706     0.13615282
8350   KIAA0087 0.000000e+00    0.0000000    0.000000        NaN            NaN
11452    NFE2L3 1.338157e+01   15.3937337   11.369414  0.7385742    -0.43718525
11682      NPVF 0.000000e+00    0.0000000    0.000000        NaN            NaN
12362    OSBPL3 2.267887e+03 2432.8657172 2102.908879  0.8643752    -0.21027035
15469     SKAP2 5.550645e+02  600.1091497  510.019934  0.8498786    -0.23467129
16074     SNX10 0.000000e+00    0.0000000    0.000000        NaN            NaN
16809   TAX1BP1 1.335639e+02  132.2648988  134.862901  1.0196424     0.02806329
19566  HOTAIRM1 3.643398e+01   35.9232515   36.944708  1.0284344     0.04044978
19583  HOXA-AS3 1.585353e+00    2.0919464    1.078760  0.5156730    -0.95547163
19993    HOTTIP 9.142684e-02    0.1828537    0.000000  0.0000000           -Inf
20308 LOC441204 0.000000e+00    0.0000000    0.000000        NaN            NaN
              pval       padj
2320  0.1849568634 1.00000000
2343            NA         NA
2655  0.6771715212 1.00000000
4116  0.0003720528 0.04280161
5312            NA         NA
7270  0.7867184492 1.00000000
7434  0.8618323432 1.00000000
7464  0.6034579494 1.00000000
7465  0.5036170761 1.00000000
7466  0.5783529928 1.00000000
7467            NA         NA
7468  0.5237115868 1.00000000
7469  0.7841492733 1.00000000
7470  0.7264099930 1.00000000
7471  0.1572548872 1.00000000
7472  0.4054614692 1.00000000
7473  0.3100149829 1.00000000
7474  0.7576922017 1.00000000
8140  0.3905309791 1.00000000
8350            NA         NA
11452 0.3423512037 1.00000000
11682           NA         NA
12362 0.3125796571 1.00000000
15469 0.2314128577 1.00000000
16074           NA         NA
16809 0.9664970152 1.00000000
19566 0.9024484685 1.00000000
19583 0.6002077334 1.00000000
19993 0.9516100747 1.00000000
20308           NA         NA
Next, use match to create a position vector, for example, showing here that on third position of the cisgenes there is first entry in cisgenestable$id:

match(cisgenes$V1, cisgenestable$id)
 [1] 23  4  1 22 NA NA 21  7  3 25 30 20  2 24  8 12 27 13 14 15 16 28 17 NA 18
[26] NA NA  9 10 NA 11 29  5  6 26 19
Use this vector to re-order cisgenestable:

> cisgenestable2<-cisgenestable[match(cisgenes$V1, cisgenestable$id),]
> cisgenestable2
             id     baseMean    baseMeanA   baseMeanB foldChange log2FoldChange
12362    OSBPL3 2.267887e+03 2432.8657172 2102.908879  0.8643752    -0.21027035
4116       CYCS 1.296481e+03 1029.4350096 1563.527666  1.5188212     0.60295200
2320    C7orf31 2.192879e+01   18.8046996   25.052883  1.3322671     0.41388339
11682      NPVF 0.000000e+00    0.0000000    0.000000        NaN            NaN
NA         <NA>           NA           NA          NA         NA             NA
NA.1       <NA>           NA           NA          NA         NA             NA
11452    NFE2L3 1.338157e+01   15.3937337   11.369414  0.7385742    -0.43718525
7434  HNRNPA2B1 5.182713e+03 5138.0376662 5227.387459  1.0173899     0.02487263
2655       CBX3 1.759203e+03 1825.7736950 1692.632838  0.9270770    -0.10923889
16074     SNX10 0.000000e+00    0.0000000    0.000000        NaN            NaN
20308 LOC441204 0.000000e+00    0.0000000    0.000000        NaN            NaN
8350   KIAA0087 0.000000e+00    0.0000000    0.000000        NaN            NaN
2343    C7orf71 0.000000e+00    0.0000000    0.000000        NaN            NaN
15469     SKAP2 5.550645e+02  600.1091497  510.019934  0.8498786    -0.23467129
7464      HOXA1 5.655727e+01   59.2621971   53.852338  0.9087132    -0.13810314
7468      HOXA2 3.410123e+00    2.6565888    4.163658  1.5672947     0.64827651
19566  HOTAIRM1 3.643398e+01   35.9232515   36.944708  1.0284344     0.04044978
7469      HOXA3 3.221184e+01   29.5762769   34.847408  1.1782216     0.23661089
7470      HOXA4 3.436599e+01   32.5189782   36.213007  1.1135961     0.15522606
7471      HOXA5 4.144621e+02  382.1294264  446.794798  1.1692237     0.22555103
7472      HOXA6 4.799613e-01    0.9599225    0.000000  0.0000000           -Inf
19583  HOXA-AS3 1.585353e+00    2.0919464    1.078760  0.5156730    -0.95547163
7473      HOXA7 6.213861e+01   66.3285481   57.948674  0.8736611    -0.19485431
NA.2       <NA>           NA           NA          NA         NA             NA
7474      HOXA9 6.145887e+01   59.5366534   63.381083  1.0645725     0.09027418
NA.3       <NA>           NA           NA          NA         NA             NA
NA.4       <NA>           NA           NA          NA         NA             NA
7465     HOXA10 5.852647e+01   53.5037521   63.549197  1.1877522     0.24823384
7466     HOXA11 3.429798e+01   31.0907859   37.505171  1.2063115     0.27060245
NA.5       <NA>           NA           NA          NA         NA             NA
7467     HOXA13 0.000000e+00    0.0000000    0.000000        NaN            NaN
19993    HOTTIP 9.142684e-02    0.1828537    0.000000  0.0000000           -Inf
5312       EVX1 0.000000e+00    0.0000000    0.000000        NaN            NaN
7270     HIBADH 1.627873e+03 1682.7986406 1572.946466  0.9347205    -0.09739299
16809   TAX1BP1 1.335639e+02  132.2648988  134.862901  1.0196424     0.02806329
8140      JAZF1 4.351783e+02  414.6587972  455.697835  1.0989706     0.13615282
              pval       padj
12362 0.3125796571 1.00000000
4116  0.0003720528 0.04280161
2320  0.1849568634 1.00000000
11682           NA         NA
NA              NA         NA
NA.1            NA         NA
11452 0.3423512037 1.00000000
7434  0.8618323432 1.00000000
2655  0.6771715212 1.00000000
16074           NA         NA
20308           NA         NA
8350            NA         NA
2343            NA         NA
15469 0.2314128577 1.00000000
7464  0.6034579494 1.00000000
7468  0.5237115868 1.00000000
19566 0.9024484685 1.00000000
7469  0.7841492733 1.00000000
7470  0.7264099930 1.00000000
7471  0.1572548872 1.00000000
7472  0.4054614692 1.00000000
19583 0.6002077334 1.00000000
7473  0.3100149829 1.00000000
NA.2            NA         NA
7474  0.7576922017 1.00000000
NA.3            NA         NA
NA.4            NA         NA
7465  0.5036170761 1.00000000
7466  0.5783529928 1.00000000
NA.5            NA         NA
7467            NA         NA
19993 0.9516100747 1.00000000
5312            NA         NA
7270  0.7867184492 1.00000000
16809 0.9664970152 1.00000000
8140  0.3905309791 1.00000000
Convert Inf entries to NA and plot a barplot:

is.na(cisgenestable2)<-sapply(cisgenestable2, is.infinite)
pdf("Rplots.pdf")
barplot(cisgenestable2$log2FoldChange,names.arg=cisgenestable2$id, ylab="-logFC", border="red", las=2, cex.names=0.85)
dev.off()