<commit_before>
##SNOPSIS

##A bunch of r and r/qtl commands for reading input data,
##running qtl analysis, and writing output data. Input data are feed to R
##from and output data from R feed to a perl script called
##../phenome/population_indls.
##QTL mapping visualization is done by the perl script mentioned above.
## r/qtl has functions for data visualization but the perl script
## allows more control for publishing on the browser,
##cross-referencing to other SGN datasets and CONSISTENT formatting/appearance


##AUTHOR
## <NAME> (<EMAIL>)


options(echo = FALSE)

library(qtl)

allargs<-commandArgs()

infile <- grep("infile_list",
               allargs, ignore.case=TRUE,
               perl=TRUE,
               value=TRUE
               )

outfile<-grep("outfile_list",
              allargs,
              ignore.case=TRUE,
              perl=TRUE,
              value=TRUE
              )

statfile<-grep("stat",
               allargs,
               ignore.case=TRUE,
               perl=TRUE,
               value=TRUE
               )


##### stat files
statfiles<-scan(statfile,
                what="character"
                )


###### QTL mapping method ############
qtlmethodfile<-grep("stat_qtl_method",
                    statfiles,
                    ignore.case=TRUE,
                    fixed = FALSE,
                    value=TRUE
                    )
qtlmethod<-scan(qtlmethodfile,
                what="character",
                sep="\n"
                )

if (qtlmethod == "Maximum Likelihood")
{
  qtlmethod<-c("em")
} else

if (qtlmethod == "Haley-Knott Regression")
{
  qtlmethod<-c("hk")

} else

if (qtlmethod == "Multiple Imputation")
{
  qtlmethod<-c("imp")

} else
if (qtlmethod == "Marker Regression")
{
  qtlmethod<-c("mr")
}

###### QTL model ############
qtlmodelfile<-grep("stat_qtl_model",
                   statfiles,
                   ignore.case=TRUE,
                   fixed = FALSE,
                   value=TRUE
                   )
qtlmodel<-scan(qtlmodelfile,
               what="character",
               sep="\n"
               )
if (qtlmodel == "Single-QTL Scan")
{
  qtlmodel<-c("scanone")
} else
if  (qtlmodel == "Two-QTL Scan")
{
  qtlmodel<-c("scantwo")
}

###### permutation############
userpermufile<-grep("stat_permu_test",
                    statfiles,
                    ignore.case=TRUE,
                    fixed = FALSE,
                    value=TRUE
                    )
userpermuvalue<-scan(userpermufile,
                     what="numeric",
                     dec = ".",
                     sep="\n"
                     )

if (userpermuvalue == "None")
{
  userpermuvalue<-c(0)
}
userpermuvalue<-as.numeric(userpermuvalue)

#####for test only
#userpermuvalue<-c(100)
#####


######genome step size############
stepsizefile<-grep("stat_step_size",
                   statfiles,
                   ignore.case=TRUE,
                   fixed = FALSE,
                   value=TRUE)

stepsize<-scan(stepsizefile,
               what="numeric",
               dec = ".",
               sep="\n"
               )

if (is.null(stepsize) == TRUE)
{
  stepsize<-c(0)
}

if (stepsize == "zero")
{
  stepsize<-c(0)
}

stepsize<-as.numeric(stepsize)

######genotype calculation method############
genoprobmethodfile<-grep("stat_prob_method",
                         statfiles,
                         ignore.case=TRUE,
                         fixed = FALSE,
                         value=TRUE
                         )

genoprobmethod<-scan(genoprobmethodfile,
                     what="character",
                     dec = ".",
                     sep="\n"
                     )
<commit_msg>If marker regression is running, use 0 value for genome scan size regardless what the user may select. If zero is selected for other methods changed it to 0<commit_after>
##SNOPSIS

##A bunch of r and r/qtl commands for reading input data,
##running qtl analysis, and writing output data. Input data are feed to R
##from and output data from R feed to a perl script called
##../phenome/population_indls.
##QTL mapping visualization is done by the perl script mentioned above.
## r/qtl has functions for data visualization but the perl script
## allows more control for publishing on the browser,
##cross-referencing to other SGN datasets and CONSISTENT formatting/appearance


##AUTHOR
## <NAME> (<EMAIL>)


options(echo = FALSE)

library(qtl)

allargs<-commandArgs()

infile <- grep("infile_list",
               allargs, ignore.case=TRUE,
               perl=TRUE,
               value=TRUE
               )

outfile<-grep("outfile_list",
              allargs,
              ignore.case=TRUE,
              perl=TRUE,
              value=TRUE
              )

statfile<-grep("stat",
               allargs,
               ignore.case=TRUE,
               perl=TRUE,
               value=TRUE
               )


##### stat files
statfiles<-scan(statfile,
                what="character"
                )


###### QTL mapping method ############
qtlmethodfile<-grep("stat_qtl_method",
                    statfiles,
                    ignore.case=TRUE,
                    fixed = FALSE,
                    value=TRUE
                    )
qtlmethod<-scan(qtlmethodfile,
                what="character",
                sep="\n"
                )

if (qtlmethod == "Maximum Likelihood")
{
  qtlmethod<-c("em")
} else

if (qtlmethod == "Haley-Knott Regression")
{
  qtlmethod<-c("hk")

} else

if (qtlmethod == "Multiple Imputation")
{
  qtlmethod<-c("imp")

} else
if (qtlmethod == "Marker Regression")
{
  qtlmethod<-c("mr")
}

###### QTL model ############
qtlmodelfile<-grep("stat_qtl_model",
                   statfiles,
                   ignore.case=TRUE,
                   fixed = FALSE,
                   value=TRUE
                   )
qtlmodel<-scan(qtlmodelfile,
               what="character",
               sep="\n"
               )
if (qtlmodel == "Single-QTL Scan")
{
  qtlmodel<-c("scanone")
} else
if  (qtlmodel == "Two-QTL Scan")
{
  qtlmodel<-c("scantwo")
}

###### permutation############
userpermufile<-grep("stat_permu_test",
                    statfiles,
                    ignore.case=TRUE,
                    fixed = FALSE,
                    value=TRUE
                    )
userpermuvalue<-scan(userpermufile,
                     what="numeric",
                     dec = ".",
                     sep="\n"
                     )

if (userpermuvalue == "None")
{
  userpermuvalue<-c(0)
}
userpermuvalue<-as.numeric(userpermuvalue)

#####for test only
#userpermuvalue<-c(100)
#####


######genome step size############
stepsizefile<-grep("stat_step_size",
                   statfiles,
                   ignore.case=TRUE,
                   fixed = FALSE,
                   value=TRUE)

stepsize<-scan(stepsizefile,
               what="numeric",
               dec = ".",
               sep="\n"
               )

if (qtlmethod == 'mr')
  {
    stepsize<-c(0)
  }else
if 
  (qtlmethod != 'mr' & stepsize == "zero")
    {
      stepsize<-c(0)
    }

stepsize<-as.numeric(stepsize)



######genotype calculation method############
genoprobmethodfile<-grep("stat_prob_method",
                         statfiles,
                         ignore.case=TRUE,
                         fixed = FALSE,
                         value=TRUE
                         )

genoprobmethod<-scan(genoprobmethodfile,
                     what="character",
                     dec = ".",
                     sep="\n"
                     )

{'fraction_non_alphanumeric': 0.13262739907346127, 'fraction_numerical': 0.0018530774321641296, 'mean_word_length': 1.5709424974481117, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3492148', 'n_tokens_mistral': 2309, 'n_tokens_neox': 2091, 'n_words': 461}