Mercurial > repos > yufei-luo > s_mart
comparison SMART/bacteriaRegulatoryRegion_Detection/strictlyIncludeGff.pl @ 18:94ab73e8a190
Uploaded
author | m-zytnicki |
---|---|
date | Mon, 29 Apr 2013 03:20:15 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
17:b0e8584489e6 | 18:94ab73e8a190 |
---|---|
1 #!/usr/bin/perl -w | |
2 ### | |
3 # But : protocol permettant la detection d'RNA non codant potentiel | |
4 # | |
5 # Entrees : fichier de mapping Smart gff3 | |
6 # fichier gff des gènes | |
7 # fichier gff des clusters Cis regulateur potentiel | |
8 # | |
9 # Sortie : fichier gff des clusters ARN nc | |
10 # | |
11 ###------------------------------------------------------ | |
12 | |
13 use vars qw($USAGE); | |
14 use strict; | |
15 | |
16 =head1 NAME | |
17 | |
18 protocol_NC_V2_CTN3.pl | |
19 | |
20 =head1 SYNOPSIS | |
21 | |
22 % strictlyIncludeGff.pl -i toSelect.gff3 -t template.gff3 > result.gff3 | |
23 | |
24 =head1 DESCRIPTION | |
25 | |
26 strictlyIncludeGff.pl - print elements strictly include in template (gff files) | |
27 | |
28 -i|--input fileName gff input file name | |
29 -t|--template fileName gff template file name | |
30 [-h|--help] help mode then die | |
31 | |
32 =head1 AUTHOR - CTN - mar.11 | |
33 (from RNA-Vibrio/protocol_NC_V2_CTN3.pl - Claire KUCHLY) | |
34 | |
35 =cut | |
36 | |
37 #---------------------------------------------------------------------------- | |
38 # check command line : | |
39 my $outFileName = "outSIG.gff3"; | |
40 if ($#ARGV==0) { | |
41 die (exec("pod2text $0\n")); | |
42 } else { | |
43 foreach my $num (0 .. $#ARGV) { | |
44 SWITCH: for ($ARGV[$num]) { | |
45 /--input|-i/ && do { open(ARN,"<$ARGV[$num+1]") | |
46 or die "Error: Can't open \"$ARGV[$num+1]\", $!"; | |
47 last }; | |
48 /--template|-t/ && do { open(SEED,"<$ARGV[$num+1]") | |
49 or die "Error : Can't open file \"$ARGV[$num+1]\", $!"; | |
50 last }; | |
51 /--help|-h/ && do { exec("pod2text $0\n") ; die }; | |
52 } | |
53 } | |
54 ##NC_011753.2 RefSeq gene 367 834 . - . locus_tag=VS_0001;db_xref=GeneID:7162789 | |
55 # open(OUT,">$outFileName") or die "Error can't $outFileName open for output. $!\n"; | |
56 my @seed ; | |
57 my $s=0; | |
58 while (my $seedLine = <SEED> ) { | |
59 my @list = split(/\t/,$seedLine); | |
60 $seed[$s][0]= $list[3] ; # position begin seed | |
61 $seed[$s][1]= $list[4] ; # position end seed | |
62 $seed[$s][2]= $list[6] ; # seed sens | |
63 $seed[$s][3]= $list[0] ; # chromesome name | |
64 $s++; | |
65 } | |
66 close SEED ; | |
67 while(my $ligne = <ARN>){ | |
68 $s=0; | |
69 my @list = split(/\t/,$ligne); | |
70 while (($s <= $#seed)) { | |
71 if (($seed[$s][3] eq $list[0]) and ($seed[$s][0] <= $list[3]) and ($seed[$s][1] >= $list[4]) and ($seed[$s][2] eq $list[6])) { # if list include in seed + same direction | |
72 print "$ligne"; | |
73 } | |
74 $s++; | |
75 } | |
76 } | |
77 close ARN ; | |
78 exit(0); | |
79 } |