Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Species Taxon Row and use in Reflow steps #7

Open
wants to merge 1 commit into
base: webdb_workflow
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions Main/lib/perl/Util/OrganismInfo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,24 @@ sub new {

my ($organismId, $nameForFiles, $strainAbbrev, $publicAbbrev, $isFamilyRepresentative, $familyNcbiTaxonIds, $familyNameForFiles) = $workflowStep->runSqlFetchOneRow($test,$sql);

$sql = "select tn.name, t.ncbi_tax_id, o.taxon_id
$sql = "select tn.name, t.ncbi_tax_id, o.taxon_id, t.parent_id as species_taxon_id
from sres.taxonname tn, sres.taxon t, apidb.organism o
where o.abbrev = '$organismAbbrev'
and t.taxon_id = o.taxon_id
and tn.taxon_id = t.taxon_id
and tn.name_class = 'scientific name'";

my ($fullName, $ncbiTaxonId, $taxonId) = $workflowStep->runSqlFetchOneRow($test,$sql);
my ($fullName, $ncbiTaxonId, $taxonId, $speciesTaxonId) = $workflowStep->runSqlFetchOneRow($test,$sql);

die "Could not find taxon_id for organismAbbrev '$organismAbbrev'" unless $taxonId;

$sql = "select ncbi_tax_id, rank from sres.taxon where taxon_id = $speciesTaxonId";

my ($speciesNcbiTaxonId, $speciesRank) = $workflowStep->runSqlFetchOneRow($test,$sql);

die "Could not find species taxon_id for organismAbbrev '$organismAbbrev'" unless $speciesNcbiTaxonId;
die "Parent of $organismAbbrev expected rank of $species" unless($rank eq 'species');

$self->{fullName} = $fullName;
$self->{nameForFiles} = $nameForFiles;
$self->{organismId} = $organismId;
Expand All @@ -42,7 +49,8 @@ sub new {
$self->{isFamilyRepresentative} = $isFamilyRepresentative;
$self->{familyNcbiTaxonIds} = $familyNcbiTaxonIds;
$self->{familyNameForFiles} = $familyNameForFiles;

$self->{speciesNcbiTaxonId} = $speciesNcbiTaxonId;
$self->{speciesTaxonId} = $speciesTaxonId;
return $self;
}

Expand Down Expand Up @@ -77,6 +85,19 @@ sub getSpeciesNameForFiles {
$speciesNameForFiles =~ s/$self->{strainAbbrev}$//;
return $speciesNameForFiles;
}

sub getSpeciesNcbiTaxonId {
my ($self) = @_;
return "$self->{organismAbbrev}_SPECIES_NCBI_TAXON_ID" if $self->{test};
return $self->{speciesNcbiTaxonId};
}

sub getSpeciesTaxonId {
my ($self) = @_;
return "$self->{organismAbbrev}_SPECIES_TAXON_ID" if $self->{test};
return $self->{speciesTaxonId};
}

sub getOrganismId {
my ($self) = @_;
return "$self->{organismAbbrev}_ORGANISM_ID" if $self->{test};
Expand Down
9 changes: 8 additions & 1 deletion Main/lib/perl/WorkflowSteps/LoadNcbiTaxonId.pm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work as the plugin doesn't create the parent taxon entry if it doesn't exist. Instead, we need to call the plugin twice, once for inserting the parent and second time for the organism (and provide the parent ncbi tax id).

Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ sub run {

my $organismFullName = $self->getParamValue('organismFullName');
my $ncbiTaxonId = $self->getParamValue('ncbiTaxonId');
my $speciesNcbiTaxonId = $self->getParamValue('speciesNcbiTaxonId');
my $rank = $self->getParamValue('rank');

my $args = "--ncbiTaxId $ncbiTaxonId --rank 'no rank' --name '$organismFullName' --mode insert";
my $parentNcbiTaxId;
if($speciesNcbiTaxonId) {
$parentNcbiTaxId = "--parentNcbiTaxId $speciesNcbiTaxonId";
}

my $args = "--ncbiTaxId $ncbiTaxonId --rank '${rank}' $parentNcbiTaxId --name '$organismFullName' --mode insert";

$self->runPlugin($test, $undo, "GUS::Supported::Plugin::InsertTaxonAndTaxonName", $args);

Expand Down
16 changes: 15 additions & 1 deletion Main/lib/xml/workflowTemplates/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@

<prop name="maxIntronSize"/>
<prop name="isNotEbiGenome"/>
<prop name="speciesNcbiTaxonId"/>

<step name="${organismAbbrev}_makeDataDir" stepClass="ReFlow::StepClasses::MakeDataDir" groupName="${organismAbbrev}">
<paramValue name="dataDir">${organismAbbrev}</paramValue>
Expand Down Expand Up @@ -99,11 +100,24 @@
<depends name="initClusterHomeDir"/>
</step>


<step name="${organismAbbrev}_loadSpeciesNcbiTaxonId" stepClass="ApiCommonWorkflow::Main::WorkflowSteps::LoadNcbiTaxonId" groupName="${organismAbbrev}">
<paramValue name="ncbiTaxonId">${speciesNcbiTaxonId}</paramValue>
<paramValue name="parentNcbiTaxonId"></paramValue>
<paramValue name="rank">species</paramValue>
<paramValue name="organismFullName">NCBI:${speciesNcbiTaxonId}</paramValue>
<paramValue name="gusConfigFile">${organismAbbrev}/${organismAbbrev}_gus.config</paramValue>
<depends name="${organismAbbrev}_makeGusConfig"/>
</step>


<step name="${organismAbbrev}_loadNcbiTaxonId" stepClass="ApiCommonWorkflow::Main::WorkflowSteps::LoadNcbiTaxonId" groupName="${organismAbbrev}">
<paramValue name="ncbiTaxonId">${ncbiTaxonId}</paramValue>
<paramValue name="parentNcbiTaxonId">${speciesNcbiTaxonId}</paramValue>
<paramValue name="rank">no rank</paramValue>
<paramValue name="organismFullName">${organismFullName}</paramValue>
<paramValue name="gusConfigFile">${organismAbbrev}/${organismAbbrev}_gus.config</paramValue>
<depends name="${organismAbbrev}_makeGusConfig"/>
<depends name="${organismAbbrev}_loadSpeciesNcbiTaxonId"/>
</step>

<subgraph name="${organismAbbrev}_LoadGenome" xmlFile="loadGenome.xml" groupName="${organismAbbrev}">
Expand Down