Skip to content

Commit

Permalink
Use simple report file to drive the AIRR format conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
mourisl committed Nov 25, 2021
1 parent ee98728 commit 2f549aa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion run-trust4
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ if ( $stage <= 2 )
if ( $stage <= 3 )
{
system_call( "perl $WD/trust-simplerep.pl ${prefix}_cdr3.out $simpleRepArgs > ${prefix}_report.tsv" ) ;
system_call( "perl $WD/trust-airr.pl ${prefix}_cdr3.out ${prefix}_annot.fa > ${prefix}_airr.tsv" ) ;
system_call( "perl $WD/trust-airr.pl ${prefix}_report.tsv ${prefix}_annot.fa > ${prefix}_airr.tsv" ) ;
if ( $hasBarcode == 1 )
{
system_call( "perl $WD/trust-barcoderep.pl ${prefix}_cdr3.out -a ${prefix}_annot.fa > ${prefix}_barcode_report.tsv" ) ;
Expand Down
23 changes: 20 additions & 3 deletions trust-airr.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use strict ;
use warnings ;

die "usage: trust-airr.pl trust_cdr3.out trust_annot.fa [--format cdr3|barcoderep]> trust_airr.tsv\n" if (@ARGV == 0) ;
die "usage: trust-airr.pl trust_report.tsv trust_annot.fa [--format simplerep|cdr3|barcoderep]> trust_airr.tsv\n" if (@ARGV == 0) ;

my %DnaToAa = (
'TCA' => 'S', # Serine
Expand Down Expand Up @@ -111,7 +111,7 @@ sub CoordToCigar
return $cigar ;
}

my $format = "cdr3" ;
my $format = "simplerep" ;
my $i ;
for ($i = 2 ; $i < @ARGV ; ++$i)
{
Expand All @@ -130,7 +130,24 @@ sub CoordToCigar
my %seqCDR3s ;

open FP, $ARGV[0] ;
if ($format eq "cdr3")

if ($format eq "simplerep")
{
while (<FP>)
{
next if (/^#/) ;
chomp ;
my @cols = split ;
next if ($cols[3] eq "partial") ;
my $seqId = $cols[8] ;
push @{$seqCDR3s{$seqId}}, $cols[2] ; # cdr3nt
push @{$seqCDR3s{$seqId}}, int($cols[0]) ; # abundance
my $fullLength = "F" ;
$fullLength = "T" if ($cols[9] == 1) ;
push @{$seqCDR3s{$seqId}}, $fullLength ; # full-length
}
}
elsif ($format eq "cdr3")
{
while (<FP>)
{
Expand Down

0 comments on commit 2f549aa

Please sign in to comment.