comparison non_miRNA_reads.pl @ 50:7b5a48b972e9 draft

Uploaded
author big-tiandm
date Fri, 05 Dec 2014 00:11:02 -0500
parents
children
comparison
equal deleted inserted replaced
49:f008ab2cadc6 50:7b5a48b972e9
1 #!/usr/bin/perl -w
2 #Filename:
3 #Author: Tian Dongmei
4 #Email: tiandm@big.ac.cn
5 #Date: 2013/7/19
6 #Modified:
7 #Description:
8 my $version=1.00;
9
10 use strict;
11 use Getopt::Long;
12
13 my %opts;
14 GetOptions(\%opts,"i=s","fa=s","o=s","h");
15 if (!(defined $opts{i} and defined $opts{o} ) || defined $opts{h}) { #necessary arguments
16 &usage;
17 }
18
19 my $filein=$opts{'fa'};
20 my $fileout=$opts{'o'};
21
22 open IN,"<$filein"; #input file
23 my (%fa,%seq);
24 while (my $aline=<IN>){
25 chomp $aline;
26 $aline=~s/^>//;
27 my $seq=<IN>;
28 chomp $seq;
29 #$seq{$seq}=$aline;
30 $fa{$aline}=$seq;
31 }
32 close IN;
33
34 open IN,"<$opts{i}";
35 while(my $aline=<IN>){
36 chomp $aline;
37 if($aline=~/^\S+_x\d+/){
38 $aline=~/^(\S+_x\d+)/;
39 my $name=$1;
40 delete($fa{$name});
41 }
42 }
43 close IN;
44
45 open OUT,">$fileout"; #output file
46 foreach my $key (keys %fa) {
47 print OUT ">$key\n$fa{$key}\n";
48 }
49 close OUT;
50 sub usage{
51 print <<"USAGE";
52 Version $version
53 Usage:
54 $0 -i -o
55 options:
56 -i input file
57 -o output file
58 -h help
59 USAGE
60 exit(1);
61 }
62