Dear all,
I have a file with mir-target information as well as a list file shown below. I wrote a script to extract mir-target information according to list file.
mir-target infor file:
miR156 AT1G19920.1:1068 5' AUGUUC-CUCUUGA-UGUUA 3' ||o|| ||||o |||o| 3' CACGAGUGAGAGAAGACAGU 5'
miR390 AT1G19920.1:1247 5' GGUCGUGAUCCUGCAGGAAUGGGCCA 3' || ||o ||||o ||o|| 3' CC-GCGAUAGGGAGG----ACUCGAA 5'
miR172 AT1G19940.1:899 5' GGGCAGCUUCAU---GGUUGU 3' ||||| |||| |o|| | 3' UACGUCGUAGUAGUUCUAAGA 5'
list file:
miR156 AT1G19920.1:1068
miR172 AT1G19940.1:899
my perl script:
#!/usr/bin/perl -w
use strict;
if (@ARGV<1){print "perl sta.pl LIST INPUT"; exit;}
my %h;
open LIST, '<', $ARGV[0];
while(my $line = <LIST>){
chomp $line;
$h{$line} = 1;
}
close LIST;
open FH, '<', $ARGV[1];
while (my $line2 = <FH>){
chomp $line2;
my @a = split/\t/, $line2;
my $mirsite = "$a[0]"."\t"."$a[1]";
if (exists $h{$mirsite} ){
print "$line2\n";
}
}
close FH;
My PROBLEM is when running perl extr.pl list input
I only got the miR172 line, the miR156 line can't be outputted.
Your help on my script will be much appreciated! THANKS!!
Hi Prakki, thanks a lot. Adding a "#" didn't work. I am sure my list file and input file are tab separated. Something is weird. Thanks anyway.
I finally sorted out the problem. When deleting all
\r
in the list and input files, the script works well.Sorry for my non-biology-relavant post, but I do hope it could give little help to others.
but the above script with # worked for me! anyway good that, you could sort it out.:)