Commit 1079c436 authored by TomKellyGenetics's avatar TomKellyGenetics
Browse files

Merge branch 'dev' of github.com:kbattenb/universc into dev

parents 7af6665d 920fba49
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -3608,15 +3608,7 @@ fi
#####extracting per cell data#####
if [[ $percelldata == true ]]; then
    echo "generating basic run statistics and per cell data"
    if [[ ${barcodefile} == "default:10x" ]]; then
        barcodefile=${barcodedir}/${v3}.gz
        gunzip ${barcodefile}
        barcodefile=`echo ${barcodefile} | sed 's/\.[^.]*$//'`
        perl ${PERCELLSTATS} ${barcodefile} ${barcodeadjust} ${id}
        gzip ${barcodefile}
    else
    perl ${PERCELLSTATS} ${barcodefile} ${barcodeadjust} ${id}
    fi
    echo "per cell data generated"
fi
##########
+31 −23
Original line number Diff line number Diff line
@@ -43,6 +43,15 @@ elsif (! -e $feature_file || ! -e $raw_barcode_file || ! -e $filtered_barcode_fi
#####MAIN#####
#make a hash of original and adjusted barcodes
my %adjusted2original;
if ($barcodefile =~ m/^default\:10x$/) {
    my $originals = `zcat $filtered_barcode_file | cut -f1 -d'-'`;
    chomp $originals;
    my @originals = split (/\n/, $originals);
    foreach my $original (@originals) {
        $adjusted2original{$original} = $original;
    }
}
else {
    open (ORIGINAL, "<$barcodefile") or die "cannot open $barcodefile.\n";
    while (my $line = <ORIGINAL>) {
        my $original = $line;
@@ -60,9 +69,9 @@ while (my $line = <ORIGINAL>) {
        }
        
        $adjusted2original{$adjusted} = $original;
    print "Original($original) -> Adjusted($adjusted) $adjust_length\n";
    }
    close (ORIGINAL);
}

#gene count
print " getting gene count.\n";
@@ -207,10 +216,9 @@ foreach my $entry (@umicount) {
}
foreach my $id (keys %umicount) {
    if (exists $percell{ $barcodes{$id} }) {
        my %data = %{ $percell{ $barcodes{$id} } };
        $data{UMI} = $umicount{$id};
        
        $percell{ $barcodes{$id} } = \%data;
        my %barcode = %{ $percell{ $barcodes{$id} } };
        $barcode{UMI} = $umicount{$id};
        $percell{$barcodes{$id}} = \%barcode;
    }
}
foreach my $barcode (sort keys %percell) {