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

Fix analysis cluster #5343

Open
wants to merge 3 commits into
base: master
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
12 changes: 7 additions & 5 deletions R/solGS/kclustering.r
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@
library(phenoAnalysis)
library(factoextra)

allArgs <- commandArgs()

Check warning on line 23 in R/solGS/kclustering.r

View workflow job for this annotation

GitHub Actions / Lint

file=/github/workspace/R/solGS/kclustering.r,line=23,col=1,[object_name_linter] Variable and function name style should match snake_case or symbols.

outputFiles <- grep("output_files", allArgs, value = TRUE)

Check warning on line 25 in R/solGS/kclustering.r

View workflow job for this annotation

GitHub Actions / Lint

file=/github/workspace/R/solGS/kclustering.r,line=25,col=1,[object_name_linter] Variable and function name style should match snake_case or symbols.
outputFiles <- scan(outputFiles, what = "character")

Check warning on line 26 in R/solGS/kclustering.r

View workflow job for this annotation

GitHub Actions / Lint

file=/github/workspace/R/solGS/kclustering.r,line=26,col=1,[object_name_linter] Variable and function name style should match snake_case or symbols.

inputFiles <- grep("input_files", allArgs, value = TRUE)

Check warning on line 28 in R/solGS/kclustering.r

View workflow job for this annotation

GitHub Actions / Lint

file=/github/workspace/R/solGS/kclustering.r,line=28,col=1,[object_name_linter] Variable and function name style should match snake_case or symbols.
inputFiles <- scan(inputFiles, what = "character")

Check warning on line 29 in R/solGS/kclustering.r

View workflow job for this annotation

GitHub Actions / Lint

file=/github/workspace/R/solGS/kclustering.r,line=29,col=1,[object_name_linter] Variable and function name style should match snake_case or symbols.

optionsFile <- grep("options", inputFiles, value = TRUE)

Check warning on line 31 in R/solGS/kclustering.r

View workflow job for this annotation

GitHub Actions / Lint

file=/github/workspace/R/solGS/kclustering.r,line=31,col=1,[object_name_linter] Variable and function name style should match snake_case or symbols.
clusterOptions <- read.table(optionsFile, header = TRUE, sep = "\t", stringsAsFactors = FALSE,

Check warning on line 32 in R/solGS/kclustering.r

View workflow job for this annotation

GitHub Actions / Lint

file=/github/workspace/R/solGS/kclustering.r,line=32,col=1,[object_name_linter] Variable and function name style should match snake_case or symbols.

Check warning on line 32 in R/solGS/kclustering.r

View workflow job for this annotation

GitHub Actions / Lint

file=/github/workspace/R/solGS/kclustering.r,line=32,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 94 characters.
na.strings = "")

Check warning on line 33 in R/solGS/kclustering.r

View workflow job for this annotation

GitHub Actions / Lint

file=/github/workspace/R/solGS/kclustering.r,line=33,col=4,[indentation_linter] Hanging indent should be 29 spaces but is 4 spaces.
print(clusterOptions)

kmeansPlotFile <- grep("k-means_plot", outputFiles, value = TRUE)

Check warning on line 36 in R/solGS/kclustering.r

View workflow job for this annotation

GitHub Actions / Lint

file=/github/workspace/R/solGS/kclustering.r,line=36,col=1,[object_name_linter] Variable and function name style should match snake_case or symbols.
kResultFile <- grep("result", outputFiles, value = TRUE)
elbowPlotFile <- grep("elbow_plot", outputFiles, value = TRUE)
clusterMeansFile <- grep("k-means_means", outputFiles, value = TRUE)
Expand Down Expand Up @@ -77,7 +77,7 @@

} else {
genoFile <- genoFiles
genoData <- fread(genoFile, header = TRUE, na.strings = c("NA", " ", "--",
genoData <- fread(genoFile, header = TRUE, na.strings = c("NA", "", "--",
"-", "."))

if (is.null(genoData)) {
Expand Down Expand Up @@ -129,7 +129,7 @@
metaFile <- grep("meta", inputFiles, value = TRUE)

clusterData <- cleanAveragePhenotypes(inputFiles, metaDataFile = metaFile)

if (length(predictedTraits) > 1) {
clusterData <- rownames_to_column(clusterData, var = "germplasmName")
clusterData <- clusterData %>%
Expand Down Expand Up @@ -216,7 +216,7 @@

clusterMeans <- c()
if (!grepl('genotype', kResultFile)) {
message('adding cluster means to clusters...')
message("adding cluster means to clusters...")
clusterMeans <- aggregate(clusterDataNotScaled, by = list(cluster = kMeansOut$cluster),
mean)

Expand All @@ -227,7 +227,9 @@
}

pca <- c()
if (is.null(selectedIndexGenotypes)) {
if (grepl("genotype", dataType, ignore.case = TRUE)) {
pca <- prcomp(clusterData, retx=TRUE)
} else if (is.null(selectedIndexGenotypes)) {
pca <- prcomp(clusterData, scale=TRUE, retx=TRUE)
} else {
pca <- prcomp(clusterData, retx=TRUE)
Expand All @@ -240,7 +242,7 @@

clusterPcScoresGroups <- c()
if (length(clusterPcScoresFile)) {
message('adding cluster groups to pc scores...')
message("adding cluster groups to pc scores...")
scores <- rownames_to_column(scores)
names(scores)[1] <- c("germplasmName")

Expand Down
13 changes: 8 additions & 5 deletions lib/solGS/JobSubmission.pm
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,16 @@ sub run_prerequisite_jobs {
$remaining_jobs = $self->wait_till_jobs_end($submitted_priority_jobs);
}
else {
if ( reftype $pre_jobs eq 'SCALAR' ) {
if ( reftype($pre_jobs) eq 'SCALAR' ) {
$pre_jobs = [$pre_jobs];
}

my $submitted_jobs = $self->submit_jobs($pre_jobs);

$remaining_jobs = $self->wait_till_jobs_end($submitted_jobs);
print STDERR "\nremaining jobs: $remaining_jobs\n";

if (defined $remaining_jobs) {
print STDERR "\nremaining jobs: $remaining_jobs\n";
}
}
}

Expand Down Expand Up @@ -126,14 +127,16 @@ sub run_dependent_jobs {
my $jobs_file = $self->dependent_jobs;
my $dep_jobs = retrieve($jobs_file);

if ( reftype $dep_jobs ne 'ARRAY' ) {
if ( reftype($dep_jobs) ne 'ARRAY' ) {
$dep_jobs = [$dep_jobs];
}

my $submitted_jobs = $self->submit_jobs($dep_jobs);

my $remaining_jobs = $self->wait_till_jobs_end($submitted_jobs);
print STDERR "\nremaining jobs: $remaining_jobs\n";
if (defined $remaining_jobs) {
print STDERR "\nremaining jobs: $remaining_jobs\n";
}
return $remaining_jobs;

}
Expand Down