<commit_before>/**
 * Licensed to Big Data Genomics (BDG) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The BDG licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.bdgenomics.adam.converters

import htsjdk.samtools.{ SAMFileHeader, SAMRecord }
import org.bdgenomics.adam.instrumentation.Timers._
import org.bdgenomics.adam.models._
import org.bdgenomics.adam.rich.RichAlignmentRecord
import org.bdgenomics.formats.avro.{ AlignmentRecord, Fragment }
import scala.collection.JavaConversions._

/**
 * This class contains methods to convert AlignmentRecords to other formats.
 */
private[adam] class AlignmentRecordConverter extends Serializable {

  /**
   * Converts a single record to FASTQ. FASTQ format is:
   *
   * {{{
   * @readName
   * sequence
   * +<optional readname>
   * ASCII quality scores
   * }}}
   *
   * If the base qualities are unknown (qual is null or equals "*"), the quality
   * scores will be a repeated string of 'B's that is equal to the read length.
   *
   * @param adamRecord Read to convert to FASTQ.
   * @param maybeAddSuffix If true, check if a "/%d" suffix is attached to the
   *   read. If there is no suffix, a slash and the number of the read in the
   *   sequenced fragment is appended to the readname. Default is false.
   * @param outputOriginalBaseQualities If true and the original base quality
   *   field is set (SAM "OQ" tag), outputs the original qualities. Else,
   *   output the qual field. Defaults to false.
   * @return Returns this read in string form.
   */<commit_msg>Make AlignmentRecordConverter public so that it can be used from other projects.<commit_after>/**
 * Licensed to Big Data Genomics (BDG) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The BDG licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.bdgenomics.adam.converters

import htsjdk.samtools.{ SAMFileHeader, SAMRecord }
import org.bdgenomics.adam.instrumentation.Timers._
import org.bdgenomics.adam.models._
import org.bdgenomics.adam.rich.RichAlignmentRecord
import org.bdgenomics.formats.avro.{ AlignmentRecord, Fragment }
import scala.collection.JavaConversions._

/**
 * This class contains methods to convert AlignmentRecords to other formats.
 */
class AlignmentRecordConverter extends Serializable {

  /**
   * Converts a single record to FASTQ. FASTQ format is:
   *
   * {{{
   * @readName
   * sequence
   * +<optional readname>
   * ASCII quality scores
   * }}}
   *
   * If the base qualities are unknown (qual is null or equals "*"), the quality
   * scores will be a repeated string of 'B's that is equal to the read length.
   *
   * @param adamRecord Read to convert to FASTQ.
   * @param maybeAddSuffix If true, check if a "/%d" suffix is attached to the
   *   read. If there is no suffix, a slash and the number of the read in the
   *   sequenced fragment is appended to the readname. Default is false.
   * @param outputOriginalBaseQualities If true and the original base quality
   *   field is set (SAM "OQ" tag), outputs the original qualities. Else,
   *   output the qual field. Defaults to false.
   * @return Returns this read in string form.
   */
{'fraction_non_alphanumeric': 0.073027356997513, 'fraction_numerical': 0.0018087271082975356, 'mean_word_length': 3.617954070981211, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5455774', 'n_tokens_mistral': 1232, 'n_tokens_neox': 1182, 'n_words': 548}