This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Target Network in Cytoscape

Dear All

I have xlsx file have miRNAs list and Target genes.

hsa-miR-29a-3p                    BCL7A; TNFAIP3; DICER1; CDK6; CDC42; BACE1; PXDN; PPP1R13B; DNMT3A; DNMT3B; COL4A1; COL4A2; MCL1; BCL2; CD276; DKK1; NAV3; SFRP2; ITIH5; S100B; IMPDH1; GLUL; PPM1D; PIK3R1; KREMEN2; FGG; FGA; FGB; LPL; CPEB3; CPEB4; ADAMTS9; ITGA11; NASP; NASP; PTEN; PTEN; ABL1; HBP1
hsa-miR-527, hsa-miR-518a-5p      MCL1
hsa-miR-27a-3p                    PAX3; IGF1; FOXO1; FBXW7; PHB; ZBTB10; MYT1; APC; THRB; SPRY2; WDR77; ABCA1; PDS5B; NFE2L2; EGFR
hsa-let-7b-5p                     CDC34; RDH10; RPIA; ACTG1; HMGA2; CDC25A; CDK6; CCND1; CCND1; LIN28B; CCND2; NRAS; CCNA2; LIN28A; IFNB1; NR2E1; PRDM1; CYP2J2
hsa-miR-498                       TERT; KRTAP5-9; RBFOX2

Some miRNAs have more than one target genes and these target genes are separated by semicolon.If I use Cytoscape then those miRNAs which have more than one target genes they will be displaced by just one node and all those genes can not be seen separately they will be merged but if I will have miRNAs in this shape for example for last miRNAs

hsa-miR-498
hsa-let-7b-5p      TERT
hsa-let-7b-5p      KRTAP5-9
hsa-let-7b-5p      RBFOX2

If I will have miRNAs having more than one target genes in this format then individual gene can be displayed separately in Cytoscape network..

Can you suggest me how I can make my xlsx file or txt file in this format in R?

gene rna-seq r

1 answer

It seems to me that you could easily convert your file into a format read by cytoscape like sif. Assuming that miRNAs are separated from targets by tabs then the following perl script should do it:

open FH,"<",$ARGV[0] or die "Failed to read file $ARGV[0]: $!";
while (my $line = <FH>) {
  next if ($line=~/^\s*$/); # Skip empty lines
  chomp($line);
  my ($miRNAs,$targets) = split(/\t+/,$line);
  my @miRNAs = split(/, /,$miRNAs);
  my @targets = split(/; /,$targets);
  foreach my $miRNA(@miRNAs) {
    foreach my $target(@targets) {
      print "$miRNA\t\t$target\n";
    }
  }
}
close FH;

Hey Thanks for your reply. Is there any way in R??

You can write something similar in R along the line of the following:

path <- 'path/to/yout/file'
fh <- file(path, open='rt' )
line <- readLines(fh, n=1 )
tmp <- strsplit(line, "\\t")
miRNAs <- tmp[[1]][1]
targets <- tmp[[1]][2]
for (miRNA in strsplit(miRNAs, ", ") {
    for (target in strsplit(targets, "; ") {
        line<-paste(miRNA,target,sep="\t\t")
        writeLines(line, con = stdout(), sep = "\n")
    }

This is very perlish, there's probably a more R-ish way of doing it.

Log in to answer this question.