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

K-mer.scala code #1105

Closed
Pavan637 opened this Issue Aug 9, 2016 · 4 comments

Comments

Projects
None yet
3 participants
@Pavan637

Pavan637 commented Aug 9, 2016

K-mer.scala code given at https://github.com/bigdatagenomics/adam is giving me errors.
I ran that code in two ways "

adam-shell -i kmer.scala

scalac kmer.scala

I am getting following errors
$scalac kmer.scala
kmer.scala:5: error: expected class or object definition
val ac = new ADAMContext(sc)
^
kmer.scala:7: error: expected class or object definition
val reads = ac.loadAlignments(
^
kmer.scala:19: error: expected class or object definition
val kmers =
^
kmer.scala:26: error: expected class or object definition
kmers.take(10).foreach(println)
^
four errors found

And when i run on spark "adam-shell -i kmer.scala". I am getting following errors
:19: error: object rdd is not a member of package org.bdgenomics.adam
import org.bdgenomics.adam.rdd.ADAMContext
^
:19: error: object rdd is not a member of package org.bdgenomics.adam
import org.bdgenomics.adam.rdd.ADAMContext._
^
:19: error: object projections is not a member of package org.bdgenomics.adam
import org.bdgenomics.adam.projections.{ AlignmentRecordField, Projection }
^
:21: error: not found: type ADAMContext
val ac = new ADAMContext(sc)
^
:19: error: not found: value ac
val reads = ac.loadAlignments(
^
:20: error: not found: value reads
reads
^
:1: error: illegal start of definition
.flatMap(.getSequence.sliding(21).map(k => (k, 1L)))
^
:1: error: illegal start of definition
.reduceByKey(
+ )
^
:1: error: illegal start of definition
.map(
.swap)
^
:1: error: illegal start of definition
.sortByKey(ascending = false)
^
:20: error: not found: value kmers
kmers.take(10).foreach(println)
^
Kindly help me to solve the issues.

Regards
Pavan

@fnothaft

This comment has been minimized.

Show comment
Hide comment
@fnothaft

fnothaft Aug 9, 2016

Member

Hi @Pavan637! What is the content of kmers.scala? Can you post it as a gist?

Member

fnothaft commented Aug 9, 2016

Hi @Pavan637! What is the content of kmers.scala? Can you post it as a gist?

@Pavan637

This comment has been minimized.

Show comment
Hide comment
@Pavan637

Pavan637 Aug 10, 2016

Thanks for replying...
Here is the code from the link (https://github.com/bigdatagenomics/adam)

`import org.bdgenomics.adam.rdd.ADAMContext
import org.bdgenomics.adam.rdd.ADAMContext._
import org.bdgenomics.adam.projections.{AlignmentRecordField, Projection}

val ac = new ADAMContext(sc)
// Load alignments from disk
val reads = ac.loadAlignments(
"/data/NA21144.chrom11.ILLUMINA.adam",
projection = Some(
Projection(
AlignmentRecordField.sequence,
AlignmentRecordField.readMapped,
AlignmentRecordField.mapq
)
)
)

// Generate, count and sort 21-mers
val kmers =
reads
.flatMap(.getSequence.sliding(21).map(k => (k, 1L)))
.reduceByKey(
+ )
.map(
.swap)
.sortByKey(ascending = false)

// Print the top 10 most common 21-mers
kmers.take(10).foreach(println)`

Pavan637 commented Aug 10, 2016

Thanks for replying...
Here is the code from the link (https://github.com/bigdatagenomics/adam)

`import org.bdgenomics.adam.rdd.ADAMContext
import org.bdgenomics.adam.rdd.ADAMContext._
import org.bdgenomics.adam.projections.{AlignmentRecordField, Projection}

val ac = new ADAMContext(sc)
// Load alignments from disk
val reads = ac.loadAlignments(
"/data/NA21144.chrom11.ILLUMINA.adam",
projection = Some(
Projection(
AlignmentRecordField.sequence,
AlignmentRecordField.readMapped,
AlignmentRecordField.mapq
)
)
)

// Generate, count and sort 21-mers
val kmers =
reads
.flatMap(.getSequence.sliding(21).map(k => (k, 1L)))
.reduceByKey(
+ )
.map(
.swap)
.sortByKey(ascending = false)

// Print the top 10 most common 21-mers
kmers.take(10).foreach(println)`

@fnothaft

This comment has been minimized.

Show comment
Hide comment
@fnothaft

fnothaft Aug 10, 2016

Member

Hi @Pavan637! We changed our build recently, and accidentally broke ./bin/adam-shell. I've just opened #1111 with a fix for this. Can you try this on your side?

Member

fnothaft commented Aug 10, 2016

Hi @Pavan637! We changed our build recently, and accidentally broke ./bin/adam-shell. I've just opened #1111 with a fix for this. Can you try this on your side?

@heuermh

This comment has been minimized.

Show comment
Hide comment
@heuermh

heuermh Aug 12, 2016

Member

Thank you for reporting this, @Pavan637.

This issue was closed when I merged the pull request. If the change does not work for you, please reopen this issue.

Member

heuermh commented Aug 12, 2016

Thank you for reporting this, @Pavan637.

This issue was closed when I merged the pull request. If the change does not work for you, please reopen this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment