comparison scripts/sorting.pl @ 9:695d28139f3e

toolshed8
author biomonika <biomonika@psu.edu>
date Tue, 09 Sep 2014 14:31:02 -0400
parents 1955f03f092e
children
comparison
equal deleted inserted replaced
8:983278b1fdb2 9:695d28139f3e
1 #!/usr/bin/perl -w
2 use strict;
3 #usage: perl sorting.pl A/
4
5 my @inputs = @ARGV;
6 chomp(@inputs);
7
8 my $dir = $inputs[0];
9 my $reference = $inputs[1];
10 my $LINKYX_PATH = $inputs[2];
11 my $results = "X_results.txt";
12 my %hash = (); #contig <-> family member with the maximal number of not uniquely mapped reads
13 my $contig; my $count=0; my $iso;
14
15 open(RESULTS_FILE, $results) or die "(sorting.pl) Impossible to open source file: $!\n";
16
17 while (<RESULTS_FILE>) {
18 $contig = $_; chomp($contig);
19 $count = `bash $LINKYX_PATH/scripts/number_of_not_uniq_mapped_reads.sh $dir $contig`;
20 $hash{$contig} = $count;
21 }
22
23 foreach (sort {$hash{$a} <=> $hash{$b}} keys %hash) {
24 print "$_ $hash{$_}";
25
26 #get sequence
27 print "% of not uniquely mapped reads for contig ".$_.": ".$hash{$_}."\n";
28 system("perl $LINKYX_PATH/scripts/get_sequences_based_on_ids.pl $reference $_");
29
30 $iso = `bash $LINKYX_PATH/scripts/isoform_exists.sh $_ references/reference_contig_names`;
31 if ($iso eq '') {
32 print "No isoforms.\n";
33 } else {
34 print "Isoforms exists:\n";
35 print $iso;
36 }
37 print "----------\n";
38 }