Skip to content

Commit

Permalink
Update prepare_reference.nf
Browse files Browse the repository at this point in the history
Fixed a bug in prepare_reference.nf where some input GFF files would not correctly transfer annotation fields for downstream comparisons.
  • Loading branch information
hseabolt authored Mar 9, 2024
1 parent 7b4c41e commit d9baf0d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions modules/local/prepare_reference.nf
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,18 @@ process PREPARE_REFERENCE {
foreach my \$feature ( @annots ) {
\$feature =~ s/(\\(|\\))//g;
last if ( grep(/^gene=/, @annots) );
if ( \$feature =~ /^locus_tag=/i ) {
if ( \$feature =~ /^(locus_tag=)/i || \$feature =~ /^(gene_id=)/i ) {
\$name = \$feature;
\$name =~ s/locus_tag=//i;
\$name =~ s/\$1//i;
\$name =~ s/_//g;
\$feature = \$feature . ";gene=\$name";
}
}
elsif ( \$feature =~ /^ID=/i ) {
\$name = \$feature;
\$name =~ s/ID=//i;
\$name =~ s/_//g;
\$feature = \$feature . ";gene=\$name";
}
}
\$line[8] = join(";", @annots);
print join("\\t", @line), "\\n";
Expand All @@ -64,4 +70,4 @@ process PREPARE_REFERENCE {
rm ${prefix}.tmp.gff
"""
}
}

0 comments on commit d9baf0d

Please sign in to comment.