Mercurial > repos > big-tiandm > sirna_plant
diff bed2wig.pl @ 0:07745c0958dd draft
Uploaded
author | big-tiandm |
---|---|
date | Thu, 18 Sep 2014 21:40:25 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bed2wig.pl Thu Sep 18 21:40:25 2014 -0400 @@ -0,0 +1,64 @@ +#!/usr/bin/perl -w +#Filename: +#Author: Chentt +#Email: chentt@big.ac.cn +#Date: 2014/06/25 +#Modified: +#Description: get out larger than cut off sequence +my $version=1.00; + +use strict; +use Getopt::Long; +use File::Basename; +use FileHandle; + +my %opts; +GetOptions(\%opts,"i=s","o=s","h"); +if (!(defined $opts{i} and defined $opts{o} ) || defined $opts{h}) { #necessary arguments +&usage; +} + +my $outputdir=$opts{'o'}; +unless ($outputdir=~/\/$/) {$outputdir .="/";} + +##############################get cmap################## +my %cmap; +open IN,"<$opts{i}"; +while (my $aline=<IN>) { + chomp $aline; + next if($aline=~/^\#/); + my @temp=split/\t/,$aline; + $cmap{$temp[0]}=$outputdir.$temp[0]; +} +close IN; +###########################split ma file###################### +my %handle; +foreach (keys %cmap) { + my $name=$cmap{$_}.".sam"; + open $handle{$_},">$name"; +} +open IN,"<$opts{i}"; +while (my $aline=<IN>) { + next if($aline=~/^\#/); + chomp $aline; + my @temp=split/\t/,$aline; + $handle{$temp[0]}-> print ($aline,"\n"); + +} +close IN; +foreach (keys %handle) {close $_;} + + +sub usage{ +print <<"USAGE"; +Version $version +Usage: +$0 -i -o +options: +-i input file +-o output file +-h help +USAGE +exit(1); +} +