-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMonocle_S1_3_parse_pData.pl
51 lines (47 loc) · 1.06 KB
/
Monocle_S1_3_parse_pData.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/perl
use strict;
use warnings;
my $index = 1;
my %index_RawBatch;
open IN,"<","/Users/m/tmp/data/_AGG11_170901/AGG11_mapped/outs/aggregation_csv.csv" or die $!;
<IN>;
while(<IN>){
# print "$index\t$_";
chomp;
my @in = split/\,/;
# print "$index\t$in[0]\n";
$index_RawBatch{$index} = $in[0];
$index++;
}
close IN;
my %barcode_MEFXENES;
open IN,"<","MEFXENES.csv" or die $!;
<IN>;
while(<IN>){
# print "$_";
chomp;
my @in = split/\,/;
$barcode_MEFXENES{$in[0]} = $in[1];
}
close IN;
open IN,"<","pData_raw.csv" or die $!;
open OUT,">","pData_to_monocle.csv" or die $!;
<IN>;
print OUT ",Barcode,RawBatch,Batch\n";
while(<IN>){
# print "$_";
chomp;
my @in = split/\,/;
my $barcode = $in[1];
# print "$barcode\n";
my $batchIndex = (split/\-/,$barcode)[1];
# print "$barcode\t$batchIndex\n";
if($batchIndex == 1){
# print "$_\n";
print OUT "$in[0]\,$barcode\,$index_RawBatch{$batchIndex}\,$barcode_MEFXENES{$barcode}\n";
}else{
print OUT "$in[0]\,$barcode\,$index_RawBatch{$batchIndex}\,$index_RawBatch{$batchIndex}\n";
}
}
close IN;
close OUT;