MaxentVariableSelection Error in read.table(file = file, header = header, sep = sep, quote = quote, : no lines available in input - maxent

I'm trying to run VariableSelection function in MaxentVariableSelection but stuck with the error saying
Error in read.table(file = file, header = header, sep = sep, quote = quote, :
no lines available in input
Here is the code I am using,
MaxentVariableSelection::VariableSelection(maxent="c:/Users/Piyali/Downloads/Software/maxent/maxent.jar",
outdir="/Users/Piyali/Desktop/msc_paper/R_SDM/outputtest",
gridfolder="/Users/Piyali/Desktop/msc_paper/R_SDM/30sclippedascii",
occurrencelocations="/Users/Piyali/Desktop/msc_paper/R_SDM/occ_full.csv",
backgroundlocations="/Users/Piyali/Desktop/msc_paper/R_SDM/bg_full.csv",
additionalargs="additionalargs",
contributionthreshold=5,
correlationthreshold=0.9,
betamultiplier=seq(2,6,0.5))
Any idea to solve this, please?

Related

Biopython Genbank.Record : trying to understand source code

I am writing a csv reader to generate Genbank files to capture annotations with sequence.
First I used a Bio.SeqRecord and got correctly formatted output but the SeqRecord class lacks fields that I need.
Blockquote
FEATURES Location/Qualifiers
HCDR1 27..35
HCDR2 50..66
HCDR3 99..109
I switched to Bio.GenBank.Record and have the needed fields except now the annotation formatting is wrong. It can't have the extra "type:" "location:" and "qualifiers:" text and the information should all be on one line.
Blockquote
FEATURES Location/Qualifiers
type: HCDR1
location: [26:35]
qualifiers:
type: HCDR2
location: [49:66]
qualifiers:
type: HCDR3
location: [98:109]
qualifiers:
The code for pulling annotations is the same for both versions. Only the class changed.
# Read csv entries and create a container with the data
container = Record()
container.locus = row['Sample']
container.size = len(row['Seq'])
container.residue_type="PROTEIN"
container.data_file_division="PRI"
container.date = (datetime.date.today().strftime("%d-%b-%Y")) # today's date
container.definition = row['FullCloneName']
container.accession = [row['Vgene'],row['HCDR3']]
container.version = getpass.getuser()
container.keywords = [row['ProjectName']]
container.source = "test"
container.organism = "Homo Sapiens"
container.sequence = row['Seq']
annotations = []
CDRS = ["HCDR1", "HCDR2", "HCDR3"]
for CDR in CDRS:
start = row['Seq'].find(row[CDR])
end = start + len(row[CDR])
feature = SeqFeature(FeatureLocation(start=start, end=end), type=CDR)
container.features.append(feature)
I have looked at the source code for Bio.Genbank.Record but can't figure out why the SeqFeature class has different formatting output compared to Bio.SeqRecord.
Is there an elegant fix or do I write a separate tool to reformat the annotations in the Genbank file?
After reading the source code again, I discovered Bio.Genbank.Record has its own Features method that takes key and location as strings. These are formatted correctly in the output Genbank file.
CDRS = ["HCDR1", "HCDR2", "HCDR3"]
for CDR in CDRS:
start = row['Seq'].find(row[CDR])
end = start + len(row[CDR])
feature = Feature()
feature.key = "{}".format(CDR)
feature.location = "{}..{}".format(start, end)
container.features.append(feature)

GATE_ Parsing error

I have tried to execute the below grammar. But, it is throwing an error.
Phase: SvP_updates_featuretype
Input: Macro_Requirement updates_KW
Options: control = appelt debug = true
Rule: updates_featuretype
Priority:20
(
(Macro_Requirement contains updates_KW)
)
:updates_featuretypeFired
-->
:updates_featuretypeFired.Macro_Requirement_updates = {category = "Macro_Requirement_updates", rule = "updates_featuretype"}
Error:
gate.creole.ResourceInstantiationException: Error while parsing the grammar (file:/C:/Users/Singo/Dropbox/Gayatri%20Kumari%20Damarasingu/Identification%20Stage%20Resources/GATE-Resources/Processing_resources/main_POSTINGAPPROACH.jape):
at gate.creole.Transducer.init(Transducer.java:127)
at gate.creole.AbstractProcessingResource.reInit(AbstractProcessingResource.java:65)
at gate.gui.NameBearerHandle$ReloadAction$1.run(NameBearerHandle.java:1456)
at java.lang.Thread.run(Thread.java:745)
Caused by: gate.jape.JapeException: Batch: error parsing transducer: Cannot parse a phase in file:/C:/Users/Singo/Dropbox/Gayatri%20Kumari%20Damarasingu/Identification%20Stage%20Resources/GATE-Resources/Processing_resources/SvP/SvP_database_featuretype.jape: file:/C:/Users/Singo/Dropbox/Gayatri%20Kumari%20Damarasingu/Identification%20Stage%20Resources/GATE-Resources/Processing_resources/SvP/SvP_database_featuretype.jape:22:2: unknown macro name Macro_Requirement
at gate.jape.Batch.parseJape(Batch.java:175)
at gate.jape.Batch.<init>(Batch.java:101)
at gate.creole.Transducer.init(Transducer.java:109)
... 3 more
Could not able to figure out how come the macro name Macro_requirement is not correct here. Can someone please help me in this
You forgot curly braces around Macro Requirement contains updates KW:
Phase: SvP_updates_featuretype
Input: Macro_Requirement updates_KW
Options: control = appelt debug = true
Rule: updates_featuretype
Priority:20
(
({Macro_Requirement contains updates_KW})
)
:updates_featuretypeFired
-->
:updates_featuretypeFired.Macro_Requirement_updates = {category = "Macro_Requirement_updates", rule = "updates_featuretype"}

Correct syntax for using custom methods with caret package

I get the following error in caret trainControl() using the custom methods syntax documented in the package vignette (pdf) on page 46. Does anyone know if this document out of date or incorrect? It seems at odds with the caret documentation page where the "custom" parameter is not used.
> fitControl <- trainControl(custom=list(parameters=lpgrnn$grid, model=lpgrnn$fit,
prediction=lpgrnn$predict, probability=NULL,
sort=lpgrnn$sort, method="cv"),
number=10)
Error in trainControl(custom = list(parameters = lpgrnn$grid, model = lpgrnn$fit, :
unused argument (custom = list(parameters = lpgrnn$grid, model = lpgrnn$fit,
prediction = lpgrnn$predict, probability = NULL, sort = lpgrnn$sort, method = "cv",
number = 10))
The cited pdf is out of date. The caret website is the canonical source of documentation.

Unable to pass URL params into api request

I'm working with the Bing API and when I am making a SOAP request to acquire my campaign stats I'm having trouble passing URL params for date (provided by bootstrap datepicker) to the request.
I keep receiving the following error -
(a:DeserializationFailed) The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter https://adcenter.microsoft.com/v8:ReportRequest. The InnerException message was 'There was an error deserializing the object of type Microsoft.AdCenter.Advertiser.Reporting.Api.DataContracts.Request.ReportRequest. The value '' cannot be parsed as the type 'Int32'.'. Please see InnerException for more details.
It seems to me as though it is not able to receive the values I have set as the start/end date in the params. It is working when the params[:start]/[:end] values are nil
Here is the controller code setting up the date params (datepicker works fine for all other requests):
#Start Bing Reporting Code - set date for request ID
if params[:start].nil?
bing_start_date = DateTime.parse((Date.today - 7).to_s).strftime("%Y-%m-%d")
yearstart = bing_start_date[0,4]
monthstart = bing_start_date[5..6]
daystart = bing_start_date[8..9]
bing_end_date = DateTime.parse((Date.today - 1).to_s).strftime("%Y-%m-%d")
yearend = bing_end_date[0,4]
monthend = bing_end_date[5..6]
dayend = bing_end_date[8..9]
else
bing_start_date = params[:start]
yearstart = bing_start_date[2,4]
monthstart = bing_start_date[5..6]
daystart = bing_start_date[8..9]
bing_end_date = params[:end]
yearend = bing_end_date[2,4]
monthend = bing_end_date[5..6]
dayend = bing_end_date[8..9]
end
Here is the SOAP request body where I set the custom date range (using Savon gem):
soap.body = "<CustomDateRangeEnd i:nil=\"false\"><Day>#{dayend}</Day><Month>#{monthend}</Month><Year>#{yearend}</Year></CustomDateRangeEnd><CustomDateRangeStart i:nil=\"false\"><Day>#{daystart}</Day><Month>#{monthstart}</Month><Year>#{yearstart}</Year></CustomDateRangeStart></Time></ReportRequest>"
It works fine If I just set the yearend/start, monthend/start, dayend/start variables manually like so:
yearstart = '2014'
monthstart = '01'
daystart = '01'
#this would set the start date properly to Jan 1 2014
Foolish mistake. I used the same start index/length and ranges for the 'if' statement as I did for the 'else'. As a result it was throwing and empty string to <day>
The date output for the 'if' was "2014-01-13" and the output for the else was "20140113"
Therefore, I needed to adjust the index/length and ranges like so:
bing_start_date = params[:start]
yearstart = bing_start_date[0,4]
monthstart = bing_start_date[4..5]
daystart = bing_start_date[6..7]

Parsing response.getEntity(String.class) string to xml with DocumentHelper.parseText() in dom4j

dom4j has no trouble doing
String text = "<person> <name>James</name> </person>";
Document document = DocumentHelper.parseText(text);
What I need is this
String text = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"+
"<person> <name>James</name> </person>";
Document document = DocumentHelper.parseText(text);
But it throws an exception.
org.dom4j.DocumentException: Error on line 1 of document : parsing initialization error: org.gjt.xpp.XmlPullParserException: only whitespace content allowed outside root element at line 1 and column 1 seen
I find the problem. The before line below is the one that fails. The after line works.
BEFORE
Document output = DocumentHelper.parseText(response.getEntity(String.class));
AFTER
Document output = DocumentHelper.parseText(response.getEntity(String.class).trim());

Resources